[IMP] stock_picking_comment_template: black, isort, prettier

This commit is contained in:
Alfredo Zamora
2021-05-31 11:32:56 +02:00
parent 560f70a922
commit 8b855e6d02
8 changed files with 89 additions and 74 deletions

View File

@@ -8,6 +8,6 @@ class ResPartner(models.Model):
_inherit = "res.partner"
comment_template_id = fields.Many2one(
comodel_name='base.comment.template',
string='Picking conditions template',
comodel_name="base.comment.template",
string="Picking conditions template",
)

View File

@@ -9,29 +9,31 @@ class StockPicking(models.Model):
_inherit = "stock.picking"
comment_template1_id = fields.Many2one('base.comment.template',
string='Top Comment Template')
comment_template2_id = fields.Many2one('base.comment.template',
string='Bottom Comment Template')
note1 = fields.Html('Top Comment')
note2 = fields.Html('Bottom Comment')
comment_template1_id = fields.Many2one(
"base.comment.template", string="Top Comment Template"
)
comment_template2_id = fields.Many2one(
"base.comment.template", string="Bottom Comment Template"
)
note1 = fields.Html("Top Comment")
note2 = fields.Html("Bottom Comment")
@api.onchange('comment_template1_id')
@api.onchange("comment_template1_id")
def _set_note1(self):
comment = self.comment_template1_id
if comment:
self.note1 = comment.get_value(self.partner_id.id)
@api.onchange('comment_template2_id')
@api.onchange("comment_template2_id")
def _set_note2(self):
comment = self.comment_template2_id
if comment:
self.note2 = comment.get_value(self.partner_id.id)
@api.onchange('partner_id')
@api.onchange("partner_id")
def _onchange_partner_id(self):
comment_template = self.partner_id.comment_template_id
if comment_template.position == 'before_lines':
if comment_template.position == "before_lines":
self.comment_template1_id = comment_template
elif comment_template.position == 'after_lines':
elif comment_template.position == "after_lines":
self.comment_template2_id = comment_template