Skip to content

Commit

Permalink
[FIX] stock_incoterm_extension: using BoM for sales works (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane authored Oct 17, 2018
1 parent 4b4667b commit b69c3d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion stock_incoterm_extension/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

{
"name": "Stock Incoterm Extension",
"version": "8.0.1.3.0",
"version": "8.0.1.4.0",
"license": "AGPL-3",
"depends": [
"stock_account",
Expand Down
26 changes: 14 additions & 12 deletions stock_incoterm_extension/models/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ def _create_invoice_from_picking(self, picking, vals):
class StockMove(models.Model):
_inherit = "stock.move"

@api.multi
def action_confirm(self):
res = super(StockMove, self).action_confirm()
for move in self:
if (move.procurement_id and move.procurement_id.sale_line_id):
sale = move.procurement_id.sale_line_id.order_id
picking = move.picking_id
if picking and sale:
picking.incoterm = sale.incoterm
picking.destination_port = sale.destination_port
picking.transport_type = sale.transport_type
return res
@api.model
def _prepare_picking_assign(self, move):
""" Prepares a new picking for this move as it could not be assigned to
another picking. This method is designed to be inherited.
"""
values = super(StockMove, self)._prepare_picking_assign(move=move)
if (move.procurement_id and move.procurement_id.sale_line_id):
sale = move.procurement_id.sale_line_id.order_id
values.update({
'incoterm': sale.incoterm.id,
'destination_port': sale.destination_port,
'transport_type': sale.transport_type,
})
return values

0 comments on commit b69c3d7

Please sign in to comment.