Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-opw-573823-port-mma into 
lp:openobject-addons.

Requested reviews:
  Purnendu Singh (OpenERP) (psi-tinyerp)
  Fabien (Open ERP) (fp-tinyerp)
  Mayur Maheshwari(OpenERP) (mma-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-573823-port-mma/+merge/140364

Hello,

In Point of Sale, for PoS Order when we don't fill field 'Salesman' and try to 
set the company based on salesman's company then there will be a traceback so 
improve the code for it.

also solved problem for tax account, we any product has default tax configured 
and tax is not configured with tax account then in that case product's account 
should be used.

Code is forward port from 6.1

Thanks,
Mayur

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-573823-port-mma/+merge/140364
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-opw-573823-port-mma.
=== modified file 'point_of_sale/point_of_sale.py'
--- point_of_sale/point_of_sale.py	2012-11-29 22:26:45 +0000
+++ point_of_sale/point_of_sale.py	2012-12-18 07:13:29 +0000
@@ -913,14 +913,12 @@
                 tax_amount = line.price_subtotal * tax['ref_base_sign']
 
             return (tax_code_id, tax_amount,)
-
         for order in self.browse(cr, uid, ids, context=context):
             if order.account_move:
                 continue
             if order.state != 'paid':
                 continue
-
-            user_company = user_proxy.browse(cr, order.user_id.id, order.user_id.id).company_id
+            user_company = order.user_id and order.user_id.company_id or False
 
             group_tax = {}
             account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context).id
@@ -986,10 +984,14 @@
                 tax_amount = 0
                 taxes = [t for t in line.product_id.taxes_id]
                 computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, line.price_unit * (100.0-line.discount) / 100.0, line.qty)['taxes']
+                product_income_acc = line.product_id.product_tmpl_id.property_account_income and \
+                                     line.product_id.product_tmpl_id.property_account_income.id or \
+                                     line.product_id.categ_id.property_account_income_categ and \
+                                     line.product_id.categ_id.property_account_income_categ.id
 
                 for tax in computed_taxes:
                     tax_amount += round(tax['amount'], 2)
-                    group_key = (tax['tax_code_id'], tax['base_code_id'], tax['account_collected_id'], tax['id'])
+                    group_key = (tax['tax_code_id'], tax['base_code_id'], tax['account_collected_id'] or product_income_acc, tax['id'])
 
                     group_tax.setdefault(group_key, 0)
                     group_tax[group_key] += round(tax['amount'], 2)

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to