From 50d882162b874aa53f4fa738817a868119dc1ba9 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 1 Feb 2025 01:36:10 +0100 Subject: [PATCH] [MIG] l10n_fr_intrastat_product: migrate to v18 --- l10n_fr_intrastat_product/__manifest__.py | 2 +- .../data/intrastat_product_reminder.xml | 1 - l10n_fr_intrastat_product/models/__init__.py | 3 ++- .../models/stock_location.py | 18 ++++++++++++++++++ .../models/{stock.py => stock_warehouse.py} | 13 ------------- .../views/intrastat_fr_regime.xml | 8 ++++---- .../views/intrastat_product_declaration.xml | 2 +- 7 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 l10n_fr_intrastat_product/models/stock_location.py rename l10n_fr_intrastat_product/models/{stock.py => stock_warehouse.py} (61%) diff --git a/l10n_fr_intrastat_product/__manifest__.py b/l10n_fr_intrastat_product/__manifest__.py index dd5bf0acc..1dd1d095b 100644 --- a/l10n_fr_intrastat_product/__manifest__.py +++ b/l10n_fr_intrastat_product/__manifest__.py @@ -4,7 +4,7 @@ { "name": "EMEBI", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "category": "Localisation/Report Intrastat", "license": "AGPL-3", "summary": "EMEBI (ex-DEB) for France", diff --git a/l10n_fr_intrastat_product/data/intrastat_product_reminder.xml b/l10n_fr_intrastat_product/data/intrastat_product_reminder.xml index 8603ed14a..d0059e71f 100644 --- a/l10n_fr_intrastat_product/data/intrastat_product_reminder.xml +++ b/l10n_fr_intrastat_product/data/intrastat_product_reminder.xml @@ -12,7 +12,6 @@ 1 months - -1 +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class StockLocation(models.Model): + _inherit = "stock.location" + + def _get_fr_department(self): + self.ensure_one() + warehouse = self.env["stock.warehouse"].search( + [("lot_stock_id", "parent_of", self.id)], limit=1 + ) + if warehouse: + return warehouse._get_fr_department() + return None diff --git a/l10n_fr_intrastat_product/models/stock.py b/l10n_fr_intrastat_product/models/stock_warehouse.py similarity index 61% rename from l10n_fr_intrastat_product/models/stock.py rename to l10n_fr_intrastat_product/models/stock_warehouse.py index 5502b0f8c..d26dcdb76 100644 --- a/l10n_fr_intrastat_product/models/stock.py +++ b/l10n_fr_intrastat_product/models/stock_warehouse.py @@ -14,16 +14,3 @@ def _get_fr_department(self): if not self.partner_id: raise UserError(_("Missing partner on warehouse '%s'.") % self.display_name) return self.partner_id.country_department_id - - -class StockLocation(models.Model): - _inherit = "stock.location" - - def _get_fr_department(self): - self.ensure_one() - warehouse = self.env["stock.warehouse"].search( - [("lot_stock_id", "parent_of", self.ids)], limit=1 - ) - if warehouse: - return warehouse._get_fr_department() - return None diff --git a/l10n_fr_intrastat_product/views/intrastat_fr_regime.xml b/l10n_fr_intrastat_product/views/intrastat_fr_regime.xml index ab0638ba2..171a9bec6 100644 --- a/l10n_fr_intrastat_product/views/intrastat_fr_regime.xml +++ b/l10n_fr_intrastat_product/views/intrastat_fr_regime.xml @@ -40,8 +40,8 @@ intrastat.fr.regime - - + + @@ -52,7 +52,7 @@ decoration-warning="declaration_type == 'dispatches'" widget="badge" /> - + @@ -96,7 +96,7 @@ Regime Codes intrastat.fr.regime - tree,form + list,form EMEBI intrastat.product.declaration - tree,form,graph,pivot + list,form,graph,pivot