← Back to team overview

openerp-india team mailing list archive

[Bug 796570] Re: Sale and purchase taxes are not get from account.accout default tax

 

** Branch linked: lp:~therp-nl/openobject-addons/6.1-lp796570-default-
taxes-so-po

-- 
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/796570

Title:
  Sale and purchase taxes are not get from account.accout default tax

Status in OpenERP Addons (modules):
  Invalid
Status in Therp Backports:
  Fix Committed

Bug description:
  Default taxes defined in product's income or expense account
  (product_template.property_income_account and
  product_template.property_expense_account) does not work in sale
  orders or purchase orders.

  The situation can be generated like this:

  1) create product. Define income account bot does not define any taxes direct to the product.
  2) Define default tax to income- and expense accounts related to the product
  3) Create SO and select the product you created. There is on taxes on that SO.

  Expected behavior would be that if there is  no taxes defined in
  product, default taxes from income account should be used.

  There is same situation with purchase orders as well.

  This is a tricky situation when you are working with multi-company
  database since product tax definition is not property.

  
  Proposed fix:

  With following path taxes seems to be added as they should (in my point of view). There is fix for procurement process as well. 
  ---
  addons/purchase/purchase.py:
  32a33,34
  > 
  > 
  667a670
  >         prod_tpl = self.pool.get('product.template').browse(cr, uid, product)
  674a678
  >         context['company_id'] = self.browse(cr, uid, ids[0], context).company_id
  705a710,714
  >         taxes = prod.supplier_taxes_id or\
  >                 prod_tpl.property_account_expense.tax_ids or\
  >                 prod_tpl.categ_id.property_account_expense_categ.tax_ids
  > 
  > 
  707c716
  <             'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id),
  ---
  >             'taxes_id': taxes,
  713d721
  <         taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id))
  798a807
  >             prod_tpl = self.pool.get('product.template').browse(cr, uid, procurement.product_id.id, context=context)
  811c820,822
  <             taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id
  ---
  >             taxes_ids = prod_tpl.supplier_taxes_id or\
  >                     prod_tpl.property_account_expense.tax_ids or\
  >                     prod_tpl.property_account_expense_categ.tax_ids
  ---
  ---
  addons/sale/sale.py

  1018a1019
  >         product_tpl = self.pool.get('product.template')
  1031a1033
  >         product_tpl = product_tpl.browse(cr, uid, product, context=context)
  1073a1076,1079
  >             if not result['tax_id']:
  >                 result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_tpl.property_account_income.tax_ids)
  >             if not result['tax_id']:
  >                 result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_tpl.categ_id.property_account_income_categ.tax_ids)
  ---

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