[FIX] purchase_analytic_plans: keep reference to analytic distribution

Purchase orders created with invoice policy 'Based on incoming shipments' were not keeping the reference to the account analytic distribution when invoiced. opw 607577
This commit is contained in:
Ravi Gohil 2014-06-09 12:47:54 +05:30 committed by Martin Trigaux
parent 67cca3f1e5
commit 1acf76bfc2
1 changed files with 10 additions and 0 deletions

View File

@ -42,4 +42,14 @@ class purchase_order(osv.osv):
purchase_order()
class stock_picking(osv.osv):
_name='stock.picking'
_inherit='stock.picking'
def _prepare_invoice_line(self, cr, uid, group, picking, move_line, invoice_id, invoice_vals, context=None):
res = super(stock_picking, self)._prepare_invoice_line(cr, uid, group, picking, move_line, invoice_id, invoice_vals, context=context)
if move_line.purchase_line_id and move_line.purchase_line_id.analytics_id:
res['analytics_id'] = move_line.purchase_line_id.analytics_id.id
return res
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: