From f2b137ef20dc06620af34648db989776ce88a960 Mon Sep 17 00:00:00 2001 From: Stepan Savelyev Date: Fri, 6 Dec 2019 14:04:45 +0500 Subject: [PATCH] [ADD] mail.thread to contract form, generate documents attached into it --- __manifest__.py | 1 + models/contract_wizard.py | 4 +- models/res_partner_contract.py | 2 +- views/res_partner.xml | 52 ----------------------- views/res_partner_contract.xml | 78 ++++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 55 deletions(-) create mode 100644 views/res_partner_contract.xml diff --git a/__manifest__.py b/__manifest__.py index 81df632..de3da9c 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -26,6 +26,7 @@ # 'security/ir.model.access.csv', # 'views/templates.xml', 'views/res_partner.xml', + 'views/res_partner_contract.xml', 'views/contract_wizard.xml', ], } diff --git a/models/contract_wizard.py b/models/contract_wizard.py index 4a3dc05..9a84ac2 100644 --- a/models/contract_wizard.py +++ b/models/contract_wizard.py @@ -523,8 +523,8 @@ class ContractWizard(models.TransientModel): # Send message with attachment to a mail.thread of the company self.env['mail.message'].create({ - "model": "res.partner", - "res_id": self.partner_id.id, + "model": "res.partner.contract", + "res_id": self.contract_id.id, "message_type": "comment", "attachment_ids": [(4, document_as_attachment.id, False)] }) diff --git a/models/res_partner_contract.py b/models/res_partner_contract.py index aee9ccf..62ba7eb 100644 --- a/models/res_partner_contract.py +++ b/models/res_partner_contract.py @@ -5,7 +5,7 @@ from odoo import api, fields, models class PartnerContract(models.Model): _name = 'res.partner.contract' - _inherit = 'mail.thread' + _inherit = ['mail.thread', 'mail.activity.mixin', 'mail.followers'] name = fields.Char( string='Contract number', diff --git a/views/res_partner.xml b/views/res_partner.xml index 8317749..c4096a2 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -1,58 +1,6 @@ - - res_partner_contract_search - res.partner.contract - - - - - - - - - res_partner_contract - res.partner.contract - - - - - - - - - - - res_partner_contract - res.partner.contract - -
- - - - - - - - - - - -
-
-
- - - res_partner_contract - res.partner.contract - form - tree,form - {'search_default_partner_id': active_id} - - Appexes sale.order diff --git a/views/res_partner_contract.xml b/views/res_partner_contract.xml new file mode 100644 index 0000000..4ccb248 --- /dev/null +++ b/views/res_partner_contract.xml @@ -0,0 +1,78 @@ + + + + + + Contracts + res.partner.contract + + + + + + + + + + + + Contract Form + res.partner.contract + +
+ + + + + + + + + + + +
+
+
+ + + + + res.partner.contract.inherit.view.form + res.partner.contract + + + + +
+ + + +
+
+ +
+
+ + + + res_partner_contract_search + res.partner.contract + + + + + + + + + res_partner_contract + res.partner.contract + form + tree,form + {'search_default_partner_id': active_id} + + +
\ No newline at end of file