[IMP] To determine the invoice we put extra moves in, it is better to take the values from the sale order / purchase order if we can find it through the picking
[IMP] Add comments [IMP] Simplify code
This commit is contained in:
parent
cb6e27c992
commit
d416492259
|
@ -89,7 +89,13 @@ class stock_move(osv.osv):
|
|||
if move.purchase_line_id:
|
||||
purchase_order = move.purchase_line_id.order_id
|
||||
return purchase_order.partner_id, purchase_order.create_uid.id, purchase_order.currency_id.id
|
||||
else:
|
||||
elif move.picking_id:
|
||||
# In case of an extra move, it is better to use the data from the original moves
|
||||
for purchase_move in move.picking_id.move_lines:
|
||||
if purchase_move.purchase_line_id:
|
||||
purchase_order = purchase_move.purchase_line_id.order_id
|
||||
return purchase_order.partner_id, purchase_order.create_uid.id, purchase_order.currency_id.id
|
||||
|
||||
partner = move.picking_id and move.picking_id.partner_id or False
|
||||
code = self.get_code_from_locs(cr, uid, move, context=context)
|
||||
if partner and partner.property_product_pricelist_purchase and code == 'incoming':
|
||||
|
|
|
@ -381,6 +381,10 @@ class stock_move(osv.osv):
|
|||
if move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.order_id.order_policy == 'picking':
|
||||
sale_order = move.procurement_id.sale_line_id.order_id
|
||||
return sale_order.partner_invoice_id, sale_order.user_id.id, sale_order.pricelist_id.currency_id.id
|
||||
elif move.picking_id.sale_id:
|
||||
# In case of extra move, it is better to use the same data as the original moves
|
||||
sale_order = move.picking_id.sale_id
|
||||
return sale_order.partner_invoice_id, sale_order.user_id.id, sale_order.pricelist_id.currency_id.id
|
||||
return super(stock_move, self)._get_master_data(cr, uid, move, company, context=context)
|
||||
|
||||
def _get_invoice_line_vals(self, cr, uid, move, partner, inv_type, context=None):
|
||||
|
|
Loading…
Reference in New Issue