diff --git a/addons/account/account.py b/addons/account/account.py index d4712c656a4..fed71f5aca4 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2001,8 +2001,11 @@ class account_tax(osv.osv): cur_price_unit+=amount2 return res - def compute_all(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None): + def compute_all(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None, force_excluded=False): """ + :param force_excluded: boolean used to say that we don't want to consider the value of field price_include of + tax. It's used in encoding by line where you don't matter if you encoded a tax with that boolean to True or + False RETURN: { 'total': 0.0, # Total without taxes 'total_included: 0.0, # Total with taxes @@ -2014,10 +2017,10 @@ class account_tax(osv.osv): tin = [] tex = [] for tax in taxes: - if tax.price_include: - tin.append(tax) - else: + if not tax.price_include or force_excluded: tex.append(tax) + else: + tin.append(tax) tin = self.compute_inv(cr, uid, tin, price_unit, quantity, address_id=address_id, product=product, partner=partner) for r in tin: totalex -= r.get('amount', 0.0) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index dd749ba9820..35a65b51b4e 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1326,7 +1326,7 @@ class account_move_line(osv.osv): base_sign = 'base_sign' tax_sign = 'tax_sign' tmp_cnt = 0 - for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00).get('taxes'): + for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=True).get('taxes'): #create the base movement if tmp_cnt == 0: if tax[base_code]: @@ -1338,8 +1338,6 @@ class account_move_line(osv.osv): else: data = { 'move_id': vals['move_id'], - 'journal_id': vals['journal_id'], - 'period_id': vals['period_id'], 'name': tools.ustr(vals['name'] or '') + ' ' + tools.ustr(tax['name'] or ''), 'date': vals['date'], 'partner_id': vals.get('partner_id',False), @@ -1356,8 +1354,6 @@ class account_move_line(osv.osv): #create the VAT movement data = { 'move_id': vals['move_id'], - 'journal_id': vals['journal_id'], - 'period_id': vals['period_id'], 'name': tools.ustr(vals['name'] or '') + ' ' + tools.ustr(tax['name'] or ''), 'date': vals['date'], 'partner_id': vals.get('partner_id',False),