Skip to content

Commit

Permalink
[MIG] stock_incoterm_extension
Browse files Browse the repository at this point in the history
  • Loading branch information
yibudak committed Jan 17, 2025
1 parent a98bb59 commit 84743cb
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 66 deletions.
4 changes: 2 additions & 2 deletions stock_incoterm_extension/__manifest__.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.0.0",
"version": "16.0.0.1.0",
"license": "AGPL-3",
"depends": ["stock_account",
"sale_stock",
Expand All @@ -31,7 +31,7 @@
'data': ["security/ir.model.access.csv",
"views/account_incoterm_view.xml",
"views/stock_view.xml",
"views/account_invoice_view.xml",
"views/account_move_view.xml",
"views/sale_order_view.xml",
# "views/purchase_order_view.xml"
],
Expand Down
8 changes: 4 additions & 4 deletions stock_incoterm_extension/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import account_incoterm
from . import account_incoterms
from . import account_move
from . import sale_order
from . import stock
from . import account_invoice
#from . import purchase_order
from . import account_move
# from . import purchase_order
26 changes: 0 additions & 26 deletions stock_incoterm_extension/models/account_incoterm.py

This file was deleted.

9 changes: 9 additions & 0 deletions stock_incoterm_extension/models/account_incoterms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api


class AccountIncoterms(models.Model):
_inherit = "account.incoterms"

destination_port = fields.Boolean(string="Requires destination port")
transport_type = fields.Boolean(string="Requires transport type")
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@
from odoo import models, fields, api


class AccountInvoice(models.Model):

_inherit = 'account.invoice'
class AccountMove(models.Model):
_inherit = "account.move"

@api.model
def _get_selection_transport_type(self):
return self.env['sale.order'].fields_get(
allfields=['transport_type'])['transport_type']['selection']

return self.env["sale.order"].fields_get(allfields=["transport_type"])[
"transport_type"
]["selection"]

req_destination_port = fields.Boolean(string="Requires destination port",
related="incoterm_id.destination_port")
req_transport_type = fields.Boolean(string="Requires transport type",
related="incoterm_id.transport_type")
req_destination_port = fields.Boolean(
string="Requires destination port", related="invoice_incoterm_id.destination_port"
)
req_transport_type = fields.Boolean(
string="Requires transport type", related="invoice_incoterm_id.transport_type"
)
destination_port = fields.Char(string="Destination port")
transport_type = fields.Selection(
selection='_get_selection_transport_type', string="Transport type")
selection="_get_selection_transport_type", string="Transport type"
)
1 change: 0 additions & 1 deletion stock_incoterm_extension/models/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ 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:
Expand Down
22 changes: 0 additions & 22 deletions stock_incoterm_extension/views/account_invoice_view.xml

This file was deleted.

20 changes: 20 additions & 0 deletions stock_incoterm_extension/views/account_move_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_move_form_ext_inh" model="ir.ui.view">
<field name="name">account.move.form.ext.inh.form</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="model">account.move</field>
<field name="arch" type="xml">
<field name="invoice_incoterm_id" position="replace"/>
<page name="other_info" position="inside">
<group string="Incoterms">
<field name="invoice_incoterm_id"/>
<field name="req_destination_port" invisible="1"/>
<field name="req_transport_type" invisible="1"/>
<field name="destination_port" attrs="{'required':[('req_destination_port', '=', True)]}"/>
<field name="transport_type" attrs="{'required':[('req_transport_type', '=', True)]}"/>
</group>
</page>
</field>
</record>
</odoo>

0 comments on commit 84743cb

Please sign in to comment.