← Back to team overview

credativ team mailing list archive

[Branch ~credativ/openobject-addons/6.1] Rev 7066: [FIX] Correctly identify taxes on purchase order lines from product accounts

 

------------------------------------------------------------
revno: 7066
committer: Craig Gowing (credativ) <craig.gowing@xxxxxxxxxxxxxx>
branch nick: addons
timestamp: Mon 2015-01-12 12:48:37 +0000
message:
  [FIX] Correctly identify taxes on purchase order lines from product accounts
modified:
  purchase/purchase.py


--
lp:~credativ/openobject-addons/6.1
https://code.launchpad.net/~credativ/openobject-addons/6.1

Your team credativ is subscribed to branch lp:~credativ/openobject-addons/6.1.
To unsubscribe from this branch go to https://code.launchpad.net/~credativ/openobject-addons/6.1/+edit-subscription
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2012-10-09 12:16:14 +0000
+++ purchase/purchase.py	2015-01-12 12:48:37 +0000
@@ -798,8 +798,9 @@
         # - determine price_unit and taxes_id
         price = product_pricelist.price_get(cr, uid, [pricelist_id],
                     product.id, qty or 1.0, partner_id, {'uom': uom_id, 'date': date_order})[pricelist_id]
-        
-        taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id))
+
+        taxes = product.supplier_taxes_id or product.property_account_expense.tax_ids or \
+                        product.categ_id.property_account_expense_categ.tax_ids
         fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False
         taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes)
         res['value'].update({'price_unit': price, 'taxes_id': taxes_ids})
@@ -910,7 +911,8 @@
             context.update({'lang': partner.lang, 'partner_id': partner_id})
 
             product = prod_obj.browse(cr, uid, procurement.product_id.id, context=context)
-            taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id
+            taxes_ids = product.supplier_taxes_id or product.property_account_expense.tax_ids or \
+                    product.categ_id.property_account_expense_categ.tax_ids
             taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
 
             line_vals = {