diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 61e4054300e..8a63563c8dc 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -538,6 +538,12 @@ class AccountMove(models.Model):
help='International Commercial Terms are a series of predefined commercial '
'terms used in international transactions.',
)
+ incoterm_location = fields.Char(
+ string='Incoterm Location',
+ compute='_compute_incoterm_location',
+ readonly=False,
+ store=True,
+ )
invoice_cash_rounding_id = fields.Many2one(
comodel_name='account.cash.rounding',
string='Cash Rounding Method',
@@ -1545,6 +1551,9 @@ class AccountMove(models.Model):
for move in self:
move[attachment_field] = move_vals.get(move._origin.id, False)
+ def _compute_incoterm_location(self):
+ pass
+
# -------------------------------------------------------------------------
# INVERSE METHODS
# -------------------------------------------------------------------------
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index 95f8b7217eb..e832d5a2766 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -1215,6 +1215,7 @@
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'))]}">
+
Reference:
+
@@ -272,9 +280,6 @@
-
- Incoterm: -
-
diff --git a/addons/l10n_ar/views/report_invoice.xml b/addons/l10n_ar/views/report_invoice.xml
index 3881f5588b9..350cd5353e3 100644
--- a/addons/l10n_ar/views/report_invoice.xml
+++ b/addons/l10n_ar/views/report_invoice.xml
@@ -222,7 +222,13 @@
-
Incoterm:
+
+ Incoterm:
+
+
+
+
+
diff --git a/addons/l10n_cl/views/report_invoice.xml b/addons/l10n_cl/views/report_invoice.xml
index d1cbf654d9e..e4360ca943e 100644
--- a/addons/l10n_cl/views/report_invoice.xml
+++ b/addons/l10n_cl/views/report_invoice.xml
@@ -111,7 +111,11 @@
Incoterm:
-
+
+ -
+
+
+
diff --git a/addons/l10n_gcc_invoice/views/report_invoice.xml b/addons/l10n_gcc_invoice/views/report_invoice.xml
index 43bee4ed29c..3a658c519ae 100644
--- a/addons/l10n_gcc_invoice/views/report_invoice.xml
+++ b/addons/l10n_gcc_invoice/views/report_invoice.xml
@@ -535,27 +535,21 @@
-
-
Incoterm:
-
-
- -
-
+
+ Incoterm:
-
-
شرط تجاري:
-
-
+
+
-
-
+
+ -
+
+
+
+ :شرط تجاري
-
diff --git a/addons/purchase_stock/models/account_invoice.py b/addons/purchase_stock/models/account_invoice.py
index 497c60c7f3a..8c2c635abde 100644
--- a/addons/purchase_stock/models/account_invoice.py
+++ b/addons/purchase_stock/models/account_invoice.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import fields, models
+from odoo import fields, models, api
from odoo.tools import float_compare, float_is_zero
from odoo.tools.misc import groupby
@@ -193,3 +193,13 @@ class AccountMove(models.Model):
for invoice in self.filtered(lambda x: x.move_type == 'in_refund'):
rslt += invoice.mapped('invoice_line_ids.purchase_line_id.move_ids').filtered(lambda x: x.state == 'done' and x.location_dest_id.usage == 'supplier')
return rslt
+
+ @api.depends('purchase_id')
+ def _compute_incoterm_location(self):
+ super()._compute_incoterm_location()
+ for move in self:
+ purchase_locations = move.line_ids.purchase_line_id.order_id.mapped('incoterm_location')
+ incoterm_res = next((incoterm for incoterm in purchase_locations if incoterm), False)
+ # if multiple purchase order we take an incoterm that is not false
+ if incoterm_res:
+ move.incoterm_location = incoterm_res
diff --git a/addons/purchase_stock/report/purchase_report_templates.xml b/addons/purchase_stock/report/purchase_report_templates.xml
index d0cafb0d891..95260ea3cbe 100644
--- a/addons/purchase_stock/report/purchase_report_templates.xml
+++ b/addons/purchase_stock/report/purchase_report_templates.xml
@@ -16,7 +16,10 @@
@@ -38,7 +41,10 @@
diff --git a/addons/sale_stock/models/account_move.py b/addons/sale_stock/models/account_move.py
index 99e07f2caa2..ce8f8ed6974 100644
--- a/addons/sale_stock/models/account_move.py
+++ b/addons/sale_stock/models/account_move.py
@@ -118,6 +118,15 @@ class AccountMove(models.Model):
if effective_date_res:
move.delivery_date = effective_date_res
+ @api.depends('line_ids.sale_line_ids.order_id')
+ def _compute_incoterm_location(self):
+ super()._compute_incoterm_location()
+ for move in self:
+ sale_locations = move.line_ids.sale_line_ids.order_id.mapped('incoterm_location')
+ incoterm_res = next((incoterm for incoterm in sale_locations if incoterm), False)
+ # if multiple purchase order we take an incoterm that is not false
+ if incoterm_res:
+ move.incoterm_location = incoterm_res
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
diff --git a/addons/sale_stock/models/res_config_settings.py b/addons/sale_stock/models/res_config_settings.py
index 981c4bad311..edd571c5327 100644
--- a/addons/sale_stock/models/res_config_settings.py
+++ b/addons/sale_stock/models/res_config_settings.py
@@ -8,7 +8,6 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
security_lead = fields.Float(related='company_id.security_lead', string="Security Lead Time", readonly=False)
- group_display_incoterm = fields.Boolean("Incoterms", implied_group='sale_stock.group_display_incoterm')
use_security_lead = fields.Boolean(
string="Security Lead Time for Sales",
config_parameter='sale_stock.use_security_lead',
diff --git a/addons/sale_stock/report/sale_order_report_templates.xml b/addons/sale_stock/report/sale_order_report_templates.xml
index 5278aa93da8..536ee3de26b 100644
--- a/addons/sale_stock/report/sale_order_report_templates.xml
+++ b/addons/sale_stock/report/sale_order_report_templates.xml
@@ -2,20 +2,14 @@
-
+
-
-
-
-
-
-
diff --git a/addons/sale_stock/security/sale_stock_security.xml b/addons/sale_stock/security/sale_stock_security.xml
index e9b95f5328e..1d702239f5a 100644
--- a/addons/sale_stock/security/sale_stock_security.xml
+++ b/addons/sale_stock/security/sale_stock_security.xml
@@ -1,10 +1,5 @@
-
- Display incoterms on Sales Order and related invoices
-
-
-
diff --git a/addons/sale_stock/views/res_config_settings_views.xml b/addons/sale_stock/views/res_config_settings_views.xml
index 2a8f87b3899..80073ac797e 100644
--- a/addons/sale_stock/views/res_config_settings_views.xml
+++ b/addons/sale_stock/views/res_config_settings_views.xml
@@ -1,24 +1,6 @@
-
- res.config.settings.view.form.inherit.sale.stock.sale
- res.config.settings
-
-
-
-
-
-
-
-
-
-
-
res.config.settings.view.form.inherit.sale.stock.stock
res.config.settings
diff --git a/addons/sale_stock/views/sale_order_views.xml b/addons/sale_stock/views/sale_order_views.xml
index 57dea19a0b8..ad5200ffc56 100644
--- a/addons/sale_stock/views/sale_order_views.xml
+++ b/addons/sale_stock/views/sale_order_views.xml
@@ -22,8 +22,8 @@
-
-
+
+
diff --git a/addons/sale_stock/views/sale_stock_portal_template.xml b/addons/sale_stock/views/sale_stock_portal_template.xml
index 1d049a9ebf1..f11384ef70e 100644
--- a/addons/sale_stock/views/sale_stock_portal_template.xml
+++ b/addons/sale_stock/views/sale_stock_portal_template.xml
@@ -7,7 +7,14 @@