29 lines
		
	
	
		
			1014 B
		
	
	
	
		
			Python
		
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			1014 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)
 | |
| 
 | |
| 
 | |
| 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
 |