← Back to team overview

openerp-india team mailing list archive

[Bug 1024285] Re: wrong tax grouping in invoice

 

** Branch linked: lp:~openerp-dev/openobject-addons/trunk-
bug-1024285-rmu

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1024285

Title:
  wrong tax grouping in invoice

Status in OpenERP Addons (modules):
  New

Bug description:
  OpenERP addons ver. 6.0
  Bug already posted once by Raphael, but marked as invalid
  https://bugs.launchpad.net/openobject-addons/+bug/312675

  Problem description:

  Taxes are  grouped if base_code_id, tax_code_id and account_id are
  equal- using first find tax name.

  But there are situations, when this approach is wrong e.g. :

  -In Latvia, they lowered VAT rate form 22% to 21% (Cry Spain and Greece - you will be affected by this BUG soon, only in opposite direction!)
  - so due to VAT rate change we introduced additional VAT tax, the SAME  base_code_id, tax_code_id and account_id, BUT different rate (0.21)
  - during transmission period we should use BOTH taxes VAT22(old) and VAT21(new), so there should be situations when there are two taxes in invoice.

  Existing code prevents to print correct invoice, because of wrong tax
  grouping. (It takes ONE tax name with lower id and sums tax rates).
  Invoice sum is right, but with wrong tax lines.

  Sollution: we add tax code (stupidly named as description) also in tax
  grouping:

  --- ./account/account.py	2012-03-30 12:24:35.000000000 +0300
  +++ ./account/account.py	2012-07-13 10:37:18.000000000 +0300
  @@ -1900,6 +1900,7 @@ class account_tax(osv.osv):
                       'price_unit': cur_price_unit,
                       'tax_code_id': tax.tax_code_id.id,
                       'ref_tax_code_id': tax.ref_tax_code_id.id,
  +                    'description': tax.description, 
               }
               res.append(data)
               if tax.type=='percent':
  @@ -2062,6 +2064,7 @@ class account_tax(osv.osv):
                   'price_unit': cur_price_unit,
                   'tax_code_id': tax.tax_code_id.id,
                   'ref_tax_code_id': tax.ref_tax_code_id.id,
  +                'description': tax.description, #nomis
               })
               if tax.child_ids:
                   if tax.child_depend:

  
  --- ./addons/account/invoice.py	2012-03-30 12:24:34.000000000 +0300
  +++ ./account/invoice.py	2012-07-13 11:18:43.000000000 +0300
  @@ -1536,6 +1536,7 @@ class account_invoice_tax(osv.osv):
                   val['manual'] = False
                   val['sequence'] = tax['sequence']
                   val['base'] = tax['price_unit'] * line['quantity']
  +                val['description'] = tax['description']
   
                   if inv.type in ('out_invoice','in_invoice'):
                       val['base_code_id'] = tax['base_code_id']
  @@ -1550,7 +1551,7 @@ class account_invoice_tax(osv.osv):
                       val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
                       val['account_id'] = tax['account_paid_id'] or line.account_id.id
   
  -                key = (val['tax_code_id'], val['base_code_id'], val['account_id'])
  +                key = (val['tax_code_id'], val['base_code_id'], val['account_id'], val['description'])
                   if not key in tax_grouped:
                       tax_grouped[key] = val
                   else:

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1024285/+subscriptions


References