1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
23
from osv import fields, osv
25
class account_invoice(osv.osv):
26
_inherit = "account.invoice"
28
def button_change_fiscal_position(self, cr, uid, ids, context=None):
32
fpos_obj = self.pool.get('account.fiscal.position')
33
inv_line_obj = self.pool.get('account.invoice.line')
35
for inv in self.browse(cr,uid,ids):
36
for line in inv.invoice_line:
37
new_taxes = fpos_obj.map_tax(cr, uid, inv.fiscal_position, line.product_id.taxes_id)
38
inv_line_obj.write(cr, uid, [line.id], {'invoice_line_tax_id': [(6,0,new_taxes)]})
b'\\ No newline at end of file'