forked from OCA/account-invoice-reporting
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount_invoice.py
More file actions
45 lines (40 loc) · 1.8 KB
/
account_invoice.py
File metadata and controls
45 lines (40 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Guewen Baconnier
# Copyright 2013-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
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')
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')
def _set_note2(self):
comment = self.comment_template2_id
if comment:
self.note2 = comment.get_value(self.partner_id.id)