Ujjvala Collins (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-816138-uco into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #816138 in OpenERP Addons: "Freight tax not calculating automatically on 
invoice"
  https://bugs.launchpad.net/openobject-addons/+bug/816138

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-816138-uco/+merge/78233

[FIX] delivery:
---------------------------
* Fixed problem of adding the freight twice on invoice and automatic 
calculation of taxes on invoice, when created from picking order.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-816138-uco/+merge/78233
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-816138-uco.
=== modified file 'delivery/stock.py'
--- delivery/stock.py	2011-07-01 23:41:24 +0000
+++ delivery/stock.py	2011-10-05 11:15:07 +0000
@@ -118,16 +118,20 @@
                 account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner.property_account_position, account_id)
                 taxes_ids = self.pool.get('account.fiscal.position').map_tax(cursor, user, partner.property_account_position, taxes)
 
-            invoice_line_obj.create(cursor, user, {
-                'name': picking.carrier_id.name,
-                'invoice_id': invoice.id,
-                'uos_id': picking.carrier_id.product_id.uos_id.id,
-                'product_id': picking.carrier_id.product_id.id,
-                'account_id': account_id,
-                'price_unit': price,
-                'quantity': 1,
-                'invoice_line_tax_id': [(6, 0,taxes_ids)],
-            })
+            if any(inv_line.product_id.id == picking.carrier_id.product_id.id for inv_line in invoice.invoice_line):
+                continue
+            else:
+                invoice_line_obj.create(cursor, user, {
+                    'name': picking.carrier_id.name,
+                    'invoice_id': invoice.id,
+                    'uos_id': picking.carrier_id.product_id.uos_id.id,
+                    'product_id': picking.carrier_id.product_id.id,
+                    'account_id': account_id,
+                    'price_unit': price,
+                    'quantity': 1,
+                    'invoice_line_tax_id': [(6, 0,taxes_ids)],
+                })
+        invoice_obj.button_compute(cursor, user, [invoice.id], context=context)
         return result
 
 stock_picking()

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to