Skip to content
Snippets Groups Projects
Commit 39f483b8 authored by Quentin De Paoli's avatar Quentin De Paoli
Browse files

[FIX] setting to None the address of a stock.picking was crashing because of a browse null

[FIX] when generating the account_move_lines from a stock.picking, the partner wasn't linked

bzr revid: qdp@tinyerp.com-20090205152806-z5f4movn0itt2fwh
parent d2341bb9
No related branches found
No related tags found
No related merge requests found
...@@ -445,7 +445,6 @@ class stock_picking(osv.osv): ...@@ -445,7 +445,6 @@ class stock_picking(osv.osv):
# return super(stock_picking, self).copy(cr, uid, id, data, context) # return super(stock_picking, self).copy(cr, uid, id, data, context)
def onchange_partner_in(self, cr, uid, context, partner_id=None): def onchange_partner_in(self, cr, uid, context, partner_id=None):
sid = self.pool.get('res.partner.address').browse(cr, uid, partner_id, context).partner_id.property_stock_supplier.id
return { } return { }
def action_explode(self, cr, uid, moves, context={}): def action_explode(self, cr, uid, moves, context={}):
...@@ -1178,6 +1177,9 @@ class stock_move(osv.osv): ...@@ -1178,6 +1177,9 @@ class stock_move(osv.osv):
amount = move.product_qty * move.product_id.standard_price amount = move.product_qty * move.product_id.standard_price
date = time.strftime('%Y-%m-%d') date = time.strftime('%Y-%m-%d')
partner_id = False
if move.picking_id:
partner_id = move.picking_id.address_id and (move.picking_id.address_id.partner_id and move.picking_id.address_id.partner_id.id or False) or False
lines = [ lines = [
(0, 0, { (0, 0, {
'name': move.name, 'name': move.name,
...@@ -1185,14 +1187,16 @@ class stock_move(osv.osv): ...@@ -1185,14 +1187,16 @@ class stock_move(osv.osv):
'credit': amount, 'credit': amount,
'account_id': acc_src, 'account_id': acc_src,
'ref': ref, 'ref': ref,
'date': date}), 'date': date,
'partner_id': partner_id}),
(0, 0, { (0, 0, {
'name': move.name, 'name': move.name,
'quantity': move.product_qty, 'quantity': move.product_qty,
'debit': amount, 'debit': amount,
'account_id': acc_dest, 'account_id': acc_dest,
'ref': ref, 'ref': ref,
'date': date}) 'date': date,
'partner_id': partner_id})
] ]
self.pool.get('account.move').create(cr, uid, { self.pool.get('account.move').create(cr, uid, {
'name': move.name, 'name': move.name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment