diff --git a/ext/custom-addons/dp_line_comment_template/__manifest__.py b/ext/custom-addons/dp_line_comment_template/__manifest__.py index 3d4277df..5821177e 100644 --- a/ext/custom-addons/dp_line_comment_template/__manifest__.py +++ b/ext/custom-addons/dp_line_comment_template/__manifest__.py @@ -3,7 +3,7 @@ # noinspection PyStatementEffect { - 'name': 'dp Order line comments', + 'name': 'dp line comments', 'summary': 'Comments templates on invoice and sale lines', 'version': '11.0.1.0.0', 'license': 'OPL-1', diff --git a/ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.py b/ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.py index 710ee0f0..f2216e03 100644 --- a/ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.py +++ b/ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.py @@ -17,7 +17,12 @@ class AddLineComment(models.TransientModel): def _onchange_note_line(self): comment = self.comment_line_template_id if comment: - self.note_line = comment.get_value(self.env[self.env.context.get('model_name')].browse([self.env.context.get('model_id')]).partner_id.id) + model_name = self.env.context.get('model_name') + model_id = self.env.context.get('model_id') + if model_name == 'sale.order.line': + self.note_line = comment.get_value(self.env[model_name].browse([model_id]).order_id.partner_id.id) + if model_name == 'account.invoice.line': + self.note_line = comment.get_value(self.env[model_name].browse([model_id]).invoice_id.partner_id.id) def add_line_comment(self): self.ensure_one()