mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[IMP] base_comment_template multi company rules
[IMP] Move comment_template_id from account_invoice_comment_template and make it company_dependant [IMP] base_comment_template: Add test
This commit is contained in:
committed by
Pierre Verkest
parent
0bfc51ec59
commit
e7d0910671
@@ -1,3 +1,3 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import comment
|
||||
from . import res_partner
|
||||
|
||||
@@ -9,23 +9,35 @@ class BaseCommentTemplate(models.Model):
|
||||
_name = "base.comment.template"
|
||||
_description = "Base comment template"
|
||||
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
name = fields.Char(
|
||||
string='Comment summary',
|
||||
required=True
|
||||
required=True,
|
||||
)
|
||||
|
||||
position = fields.Selection(
|
||||
selection=[
|
||||
('before_lines', 'Before lines'),
|
||||
('after_lines', 'After lines')
|
||||
('after_lines', 'After lines'),
|
||||
],
|
||||
required=True,
|
||||
default='before_lines',
|
||||
help="Position on document"
|
||||
help="Position on document",
|
||||
)
|
||||
|
||||
text = fields.Html(
|
||||
string='Comment',
|
||||
translate=True,
|
||||
required=True
|
||||
required=True,
|
||||
)
|
||||
|
||||
company_id = fields.Many2one(
|
||||
'res.company',
|
||||
string='Company',
|
||||
help="If set, it'll only be available for this company",
|
||||
ondelete='cascade',
|
||||
index=True,
|
||||
)
|
||||
|
||||
@api.multi
|
||||
|
||||
19
base_comment_template/models/res_partner.py
Normal file
19
base_comment_template/models/res_partner.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = "res.partner"
|
||||
|
||||
property_comment_template_id = fields.Many2one(
|
||||
comodel_name='base.comment.template',
|
||||
string='Conditions template',
|
||||
company_dependant=True,
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _commercial_fields(self):
|
||||
res = super(ResPartner, self)._commercial_fields()
|
||||
res += ['property_comment_template_id']
|
||||
return res
|
||||
Reference in New Issue
Block a user