← 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

 

I linked this bug to ocb-addons as the fix has not been ported to 7.0.

I see it is marked Opinion for official.

I my opinion, the patch is a valuable addition to ocb 7.0.

What do you think?


** Also affects: ocb-addons
   Importance: Undecided
       Status: New

-- 
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 Community Backports (Addons):
  New
Status in OpenERP Addons (modules):
  Opinion
Status in Therp Backports (Deprecated):
  Fix Released
Status in Therp Backports (Deprecated) addons-6.1 series:
  Fix Released
Status in Therp Backports (Deprecated) addons-7.0 series:
  New

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/ocb-addons/+bug/796570/+subscriptions