← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3

 

pso (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #539539 product - VAT definition - multicompany
  https://bugs.launchpad.net/bugs/539539
  #617974 trunk - hr payment - rounding issue payment slip
  https://bugs.launchpad.net/bugs/617974
  #663585 [6.0rc1] suggested improvements to PO and SO form view
  https://bugs.launchpad.net/bugs/663585
  #663967 [RC1] SO -History - can delete related invoice
  https://bugs.launchpad.net/bugs/663967
  #666592 save and close crash adding product in point of sale
  https://bugs.launchpad.net/bugs/666592
  #669360 hr_timeeshet_sheet : installation fails on 1st (and probably last) date of the month.
  https://bugs.launchpad.net/bugs/669360
  #669533 [hr_timesheet] Employee timesheet reports confuse employee id and user id
  https://bugs.launchpad.net/bugs/669533
  #672684 Manual Global Tax
  https://bugs.launchpad.net/bugs/672684


Hello,

Fixed bug: 539539. Improved product onchange method of invoice line.

https://bugs.launchpad.net/openobject-addons/+bug/539539

Thanks,
pso (Open ERP)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/43326
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'account/invoice.py'
--- account/invoice.py	2010-11-27 20:16:05 +0000
+++ account/invoice.py	2010-12-10 10:01:35 +0000
@@ -1399,18 +1399,25 @@
         a = fpos_obj.map_account(cr, uid, fpos, a)
         if a:
             result['account_id'] = a
-
+        
+        tax_ids = self.pool.get('account.tax').search(cr, uid, [('company_id', '=', company_id)])
         if type in ('out_invoice', 'out_refund'):
-            taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
-            tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
+            def_sale_taxes = map(lambda x: x.id, res.taxes_id)
+            sale_tax_list = [tax for tax in tax_ids if tax in def_sale_taxes]
+            sale_tax_id = self.pool.get('account.tax').browse(cr, uid, sale_tax_list)
+            sale_taxes = sale_tax_id and sale_tax_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
+            tax_id = fpos_obj.map_tax(cr, uid, fpos, sale_taxes)
         else:
-            taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
-            tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
+            def_pur_taxes = map(lambda x: x.id, res.supplier_taxes_id)
+            pur_tax_list = [tax for tax in tax_ids if tax in def_pur_taxes]
+            pur_tax_id = self.pool.get('account.tax').browse(cr, uid, pur_tax_list)
+            pur_taxes = pur_tax_id and pur_tax_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
+            tax_id = fpos_obj.map_tax(cr, uid, fpos, pur_taxes)
+            
         if type in ('in_invoice', 'in_refund'):
             result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
         else:
             result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
-
 #        if not name:
         result['name'] = res.partner_ref
 
@@ -1420,7 +1427,7 @@
             res2 = res.uom_id.category_id.id
             if res2:
                 domain = {'uos_id':[('category_id','=',res2 )]}
-
+                
         result['categ_id'] = res.categ_id.id
         res_final = {'value':result, 'domain':domain}
 


Follow ups