Skip to content

Commit

Permalink
T1780 FIX log_other_interaction deletions
Browse files Browse the repository at this point in the history
- Model was taken as a Transient although
  it was declared as _transient = False
- Solution was to revert the inheritance
  and move the fields.
  • Loading branch information
ecino committed Aug 29, 2024
1 parent 8d7a5ab commit b97b08a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion interaction_resume/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import wizards
from . import models
from . import wizards
27 changes: 24 additions & 3 deletions interaction_resume/models/other_interaction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from odoo import models
from odoo import models, fields
from odoo.tools import html2plaintext


Expand All @@ -7,12 +7,33 @@ class OtherInteractions(models.Model):
_inherit = [
"mail.activity.mixin",
"mail.thread",
"partner.log.other.interaction.wizard",
"interaction.source",
]
_description = "Logging for other interactions"
_rec_name = "subject"
_transient = False

partner_id = fields.Many2one(
"res.partner", "Partner", default=lambda self: self.env.context.get("active_id")
)
subject = fields.Char(required=True)
communication_type = fields.Selection(
[
("Paper", "Paper"),
("Phone", "Phone"),
("SMS", "SMS"),
("Email", "Email"),
("Mass", "Mass Mailing"),
("Other", "Other"),
("Support", "Support"),
],
required=True,
)
other_type = fields.Char()
date = fields.Datetime(default=fields.Datetime.now)
direction = fields.Selection(
[("in", "Incoming"), ("out", "Outgoing")], required=True
)
body = fields.Html()

def _get_interaction_data(self, partner_id):
return [
Expand Down
27 changes: 3 additions & 24 deletions interaction_resume/wizards/partner_log_other_interaction_wizard.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
from odoo import _, fields, models
from odoo import _, models


class LogOtherInteractionWizard(models.TransientModel):
_name = "partner.log.other.interaction.wizard"
_inherit = "partner.log.other.interaction"
_description = "Logging wizard for other interactions"

partner_id = fields.Many2one(
"res.partner", "Partner", default=lambda self: self.env.context.get("active_id")
)
subject = fields.Char(required=True)
communication_type = fields.Selection(
[
("Paper", "Paper"),
("Phone", "Phone"),
("SMS", "SMS"),
("Email", "Email"),
("Mass", "Mass Mailing"),
("Other", "Other"),
("Support", "Support"),
],
required=True,
)
other_type = fields.Char()
date = fields.Datetime(default=fields.Datetime.now)
direction = fields.Selection(
[("in", "Incoming"), ("out", "Outgoing")], required=True
)
body = fields.Html()
_transient = True

def log_interaction(self):
data = {
Expand Down

0 comments on commit b97b08a

Please sign in to comment.