Skip to content

Commit

Permalink
Merge cc790b8 into 4c043a2
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane committed Aug 7, 2018
2 parents 4c043a2 + cc790b8 commit 3279d8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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.2.0",
"version": "8.0.1.3.0",
"license": "AGPL-3",
"depends": [
"stock_account",
Expand Down
5 changes: 5 additions & 0 deletions stock_incoterm_extension/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def _get_selection_transport_type(self):
transport_type = fields.Selection(
selection='_get_selection_transport_type', string="Transport type")

@api.onchange('incoterm_id')
def _onchange_incoterm(self):
for order in self:
order.destination_port = order.incoterm_id.default_destination_port

@api.model
def _prepare_invoice(self, order, line_ids):
res = super(PurchaseOrder, self)._prepare_invoice(order, line_ids)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ def test_sale_order_onchange(self):
self.sale_order._onchange_incoterm()
self.assertEquals(self.sale_order.destination_port,
self.incoterm.default_destination_port)

def test_purchase_order_onchange(self):
self.assertTrue(self.incoterm.default_destination_port)
self.purchase_order._onchange_incoterm()
self.assertEquals(self.purchase_order.destination_port,
self.incoterm.default_destination_port)

0 comments on commit 3279d8c

Please sign in to comment.