← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-724525-rha into lp:openobject-addons

 

Rifakat Haradwala (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-724525-rha into lp:openobject-addons.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  #724525 Purchase Orders created from Sales Orders do not honour the Analytic Account or product description
  https://bugs.launchpad.net/bugs/724525

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-724525-rha/+merge/51707

Purchase: put check if procurement is not generated from sale order
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-724525-rha/+merge/51707
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-724525-rha.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2011-02-28 10:49:36 +0000
+++ purchase/purchase.py	2011-03-01 07:29:21 +0000
@@ -796,9 +796,15 @@
             context.update({'lang': partner.lang, 'partner_id': partner_id})
 
             product = prod_obj.browse(cr, uid, procurement.product_id.id, context=context)
+            analytic_account = False
+            prod_description = product.partner_ref
+            if procurement.move_id.sale_line_id:
+                sale_order_line = procurement.move_id.sale_line_id
+                analytic_account = sale_order_line.order_id.project_id and sale_order_line.order_id.project_id.id or False
+                prod_description = sale_order_line.name
 
             line = {
-                'name': product.partner_ref,
+                'name': prod_description or False,
                 'product_qty': qty,
                 'product_id': procurement.product_id.id,
                 'product_uom': uom_id,
@@ -806,6 +812,7 @@
                 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
                 'move_dest_id': res_id,
                 'notes': product.description_purchase,
+                'account_analytic_id': analytic_account,
             }
 
             taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id


Follow ups