odoo/ext/custom-addons/dp_line_comment_template/models/account_invoice.py

18 lines
650 B
Python

# Copyright 2018-Today datenpol gmbh (<http://www.datenpol.at>)
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
from odoo import models, fields, api
class AccountInvoice(models.Model):
_inherit = "account.invoice"
comment_line_template_id = fields.Many2one('base.comment.template', string='Line Comment Template')
note_line = fields.Html('Line Comment')
@api.onchange('comment_line_template_id')
def _onchange_note_line(self):
comment = self.comment_line_template_id
if comment:
self.note_line = comment.get_value(self.partner_id.id)