~slobodni-programi/addons-sp/61

« back to all changes in this revision

Viewing changes to l10n_hr_account/invoice.py

  • Committer: Goran Kliska
  • Date: 2011-11-10 09:30:26 UTC
  • Revision ID: goran.kliska@slobodni-programi.hr-20111110093026-q4dqc6lmfoo60ngh
croatian VAT rules and postings on payment

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    OpenERP, Open Source Management Solution
 
5
#    Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
 
6
#    $Id$
 
7
#
 
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.
 
12
#
 
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.
 
17
#
 
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/>.
 
20
#
 
21
##############################################################################
 
22
 
 
23
from osv import fields, osv
 
24
 
 
25
class account_invoice(osv.osv):
 
26
    _inherit = "account.invoice"
 
27
 
 
28
    def button_change_fiscal_position(self, cr, uid, ids, context=None):
 
29
        if context is None:
 
30
            context = {}
 
31
 
 
32
        fpos_obj = self.pool.get('account.fiscal.position')
 
33
        inv_line_obj = self.pool.get('account.invoice.line')
 
34
        
 
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)]})
 
39
 
 
40
        return True
 
41
 
 
42
account_invoice()
 
 
b'\\ No newline at end of file'