[FIX] purchase: fix the problem for invoice while delivery order
authorRifakat (OpenERP) <rha@tinyerp.com>
Fri, 24 Feb 2012 12:55:01 +0000 (18:25 +0530)
committerRifakat (OpenERP) <rha@tinyerp.com>
Fri, 24 Feb 2012 12:55:01 +0000 (18:25 +0530)
bzr revid: rha@tinyerp.com-20120224125501-av56ujhkyqv1tm79

addons/purchase/stock.py

index f595a3e..2e1ebdb 100644 (file)
@@ -101,7 +101,7 @@ class stock_picking(osv.osv):
         return super(stock_picking, self)._get_taxes_invoice(cursor, user, move_line, type)
 
     def _get_account_analytic_invoice(self, cursor, user, picking, move_line):
-        if move_line.purchase_line_id:
+        if picking.purchase_id and move_line.purchase_line_id:
             return move_line.purchase_line_id.account_analytic_id.id
         return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line)