[IMP] base_comment_template: Refactor code and convert to Many2Many

This commit is contained in:
Víctor Martínez
2021-04-22 18:04:48 +02:00
parent 1d8e552b70
commit 19b7692ee8
10 changed files with 168 additions and 278 deletions

View File

@@ -1,7 +1,8 @@
# Copyright 2020 NextERP Romania SRL
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
from odoo import api, fields, models
class ResPartner(models.Model):
@@ -9,6 +10,14 @@ class ResPartner(models.Model):
base_comment_template_ids = fields.Many2many(
comodel_name="base.comment.template",
relation="base_comment_template_res_partner_rel",
column1="base_comment_template_id",
column2="res_partner_id",
string="Comment Templates",
help="Specific partner comments that can be included in reports",
)
@api.model
def _commercial_fields(self):
"""Add comment templates to commercial fields"""
return super()._commercial_fields() + ["base_comment_template_ids"]