From 70d7238d5753337cd5569f92581df18c628c6b6f Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Wed, 27 Jun 2018 16:13:31 +0200 Subject: [PATCH] Fall 5559: Textbausteine - AN / AB / RE --- .../dp_line_comment_template/__init__.py | 1 + .../dp_line_comment_template/__manifest__.py | 1 + .../models/account_invoice.py | 11 +++++++ .../models/sale_order.py | 11 +++++++ .../views/account_invoice_view.xml | 4 +++ .../views/sale_order_view.xml | 4 +++ .../wizards/__init__.py | 1 + .../wizards/wizard_add_line_comment.py | 28 ++++++++++++++++ .../wizards/wizard_add_line_comment.xml | 33 +++++++++++++++++++ 9 files changed, 94 insertions(+) create mode 100644 ext/custom-addons/dp_line_comment_template/wizards/__init__.py create mode 100644 ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.py create mode 100644 ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.xml diff --git a/ext/custom-addons/dp_line_comment_template/__init__.py b/ext/custom-addons/dp_line_comment_template/__init__.py index 0650744f..aee8895e 100644 --- a/ext/custom-addons/dp_line_comment_template/__init__.py +++ b/ext/custom-addons/dp_line_comment_template/__init__.py @@ -1 +1,2 @@ from . import models +from . import wizards diff --git a/ext/custom-addons/dp_line_comment_template/__manifest__.py b/ext/custom-addons/dp_line_comment_template/__manifest__.py index 96787ce6..3d4277df 100644 --- a/ext/custom-addons/dp_line_comment_template/__manifest__.py +++ b/ext/custom-addons/dp_line_comment_template/__manifest__.py @@ -17,6 +17,7 @@ 'data': [ 'views/account_invoice_view.xml', 'views/sale_order_view.xml', + 'wizards/wizard_add_line_comment.xml', ], 'installable': True, 'auto_install': False, diff --git a/ext/custom-addons/dp_line_comment_template/models/account_invoice.py b/ext/custom-addons/dp_line_comment_template/models/account_invoice.py index 29b238a8..7afbc14d 100644 --- a/ext/custom-addons/dp_line_comment_template/models/account_invoice.py +++ b/ext/custom-addons/dp_line_comment_template/models/account_invoice.py @@ -15,3 +15,14 @@ class AccountInvoice(models.Model): comment = self.comment_line_template_id if comment: self.note_line = comment.get_value(self.partner_id.id) + + +class AccountInvoiceLine(models.Model): + _inherit = "account.invoice.line" + + @api.multi + def add_line_comment(self): + self.ensure_one() + action = self.env.ref('dp_line_comment_template.action_wizard_line_comment').read()[0] + action['context'] = str({"model_name": 'account.invoice.line', "model_id": self.id}) + return action diff --git a/ext/custom-addons/dp_line_comment_template/models/sale_order.py b/ext/custom-addons/dp_line_comment_template/models/sale_order.py index 2b901659..5e0d22a1 100644 --- a/ext/custom-addons/dp_line_comment_template/models/sale_order.py +++ b/ext/custom-addons/dp_line_comment_template/models/sale_order.py @@ -24,3 +24,14 @@ class SaleOrder(models.Model): 'note_line': self.note_line, }) return values + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + @api.multi + def add_line_comment(self): + self.ensure_one() + action = self.env.ref('dp_line_comment_template.action_wizard_line_comment').read()[0] + action['context'] = str({"model_name": 'sale.order.line', "model_id": self.id}) + return action diff --git a/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml b/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml index b15e3467..dc0c8449 100644 --- a/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml +++ b/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml @@ -16,6 +16,10 @@ + + +