diff --git a/l10n_it_delivery_note/README.rst b/l10n_it_delivery_note/README.rst index d607eedd283d..f1d652754a57 100644 --- a/l10n_it_delivery_note/README.rst +++ b/l10n_it_delivery_note/README.rst @@ -7,7 +7,7 @@ ITA - Documento di trasporto !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:86cc264b131150d0e14a593b955879a5dfe4ecfe7db4069f8ede4f8a416c9e20 + !! source digest: sha256:e389fbd4dff70da2d65271df7684c21141a86b5e861217fe285b4df642e5a57a !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/l10n_it_delivery_note/__manifest__.py b/l10n_it_delivery_note/__manifest__.py index e75951c2591b..b94f657811ac 100644 --- a/l10n_it_delivery_note/__manifest__.py +++ b/l10n_it_delivery_note/__manifest__.py @@ -13,12 +13,12 @@ "author": "Marco Calcagni, Gianmarco Conte, Link IT Europe Srl, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-italy", - "version": "14.0.2.5.1", + "version": "14.0.2.6.0", "category": "Localization/Italy", "license": "AGPL-3", "maintainers": ["MarcoCalcagni", "aleuffre", "renda-dev"], "depends": [ - "delivery", + "delivery_carrier_partner", "l10n_it_delivery_note_base", "mail", "sale_stock", diff --git a/l10n_it_delivery_note/cli/migrate_l10n_it_ddt.py b/l10n_it_delivery_note/cli/migrate_l10n_it_ddt.py index 4162a9dec8c8..afb84b38eeb2 100644 --- a/l10n_it_delivery_note/cli/migrate_l10n_it_ddt.py +++ b/l10n_it_delivery_note/cli/migrate_l10n_it_ddt.py @@ -288,7 +288,8 @@ def vals_getter(record): "type_id": self._document_types[record.ddt_type_id].id, "date": record.date, "carrier_id": record.carrier_id.id, - "delivery_method_id": record.partner_id.property_delivery_carrier_id.id, + "delivery_method_id": record.picking_ids.mapped("carrier_id")[:1].id + or record.partner_id.property_delivery_carrier_id.id, "transport_datetime": record.date_done, "packages": record.parcels, "volume": record.volume, diff --git a/l10n_it_delivery_note/migrations/14.0.2.6.0/post-migrate.py b/l10n_it_delivery_note/migrations/14.0.2.6.0/post-migrate.py new file mode 100644 index 000000000000..a7890e8513bf --- /dev/null +++ b/l10n_it_delivery_note/migrations/14.0.2.6.0/post-migrate.py @@ -0,0 +1,11 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + note_ids = env["stock.delivery.note"].search( + [("carrier_id", "!=", False), ("delivery_method_id", "!=", False)] + ) + + for note_id in note_ids: + note_id.delivery_method_id.write({"partner_id": note_id.carrier_id.id}) diff --git a/l10n_it_delivery_note/models/res_partner.py b/l10n_it_delivery_note/models/res_partner.py index 31a36e66eaf4..928760d2b8de 100644 --- a/l10n_it_delivery_note/models/res_partner.py +++ b/l10n_it_delivery_note/models/res_partner.py @@ -19,4 +19,3 @@ class ResPartner(models.Model): default_transport_method_id = fields.Many2one( "stock.picking.transport.method", string="Method of transport" ) - is_carrier = fields.Boolean("Is Carrier") diff --git a/l10n_it_delivery_note/models/stock_delivery_note.py b/l10n_it_delivery_note/models/stock_delivery_note.py index b99dccecf0b2..74e637fd2dd1 100644 --- a/l10n_it_delivery_note/models/stock_delivery_note.py +++ b/l10n_it_delivery_note/models/stock_delivery_note.py @@ -143,7 +143,8 @@ def _domain_weight_uom(self): string="Carrier", states=DONE_READONLY_STATE, tracking=True, - domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + store=True, + compute="_compute_carrier_id", ) delivery_method_id = fields.Many2one( "delivery.carrier", @@ -313,6 +314,11 @@ def name_get(self): return result + @api.depends("delivery_method_id.partner_id") + def _compute_carrier_id(self): + for note in self: + note.carrier_id = note.delivery_method_id.partner_id + @api.depends("state", "line_ids", "line_ids.invoice_status") def _compute_invoice_status(self): for note in self: diff --git a/l10n_it_delivery_note/models/stock_picking.py b/l10n_it_delivery_note/models/stock_picking.py index 28b527896e54..bbbadeeae5b5 100644 --- a/l10n_it_delivery_note/models/stock_picking.py +++ b/l10n_it_delivery_note/models/stock_picking.py @@ -346,7 +346,8 @@ def _create_delivery_note(self): "partner_shipping_id": partners[1].id, "type_id": type_id.id, "date": self.date_done, - "delivery_method_id": self.partner_id.property_delivery_carrier_id.id, + "delivery_method_id": self.mapped("carrier_id")[:1].id + or self.partner_id.property_delivery_carrier_id.id, "transport_condition_id": ( self.sale_id.default_transport_condition_id.id or partners[1].default_transport_condition_id.id diff --git a/l10n_it_delivery_note/security/ir.model.access.csv b/l10n_it_delivery_note/security/ir.model.access.csv index 725630b093f3..b1c7697ae157 100644 --- a/l10n_it_delivery_note/security/ir.model.access.csv +++ b/l10n_it_delivery_note/security/ir.model.access.csv @@ -23,3 +23,4 @@ access_stock_delivery_note_create_wizard_manager,access_stock_delivery_note_crea access_stock_delivery_note_select_wizard_manager,access_stock_delivery_note_select_wizard manager,l10n_it_delivery_note.model_stock_delivery_note_select_wizard,,1,1,1,1 access_stock_delivery_note_base_wizard_manager,access_stock_delivery_note_base_wizard manager,l10n_it_delivery_note.model_stock_delivery_note_base_wizard,,1,1,1,1 access_stock_delivery_note_invoice_wizard_manager,access_stock_delivery_note_invoice_wizard manager,l10n_it_delivery_note.model_stock_delivery_note_invoice_wizard,,1,1,1,1 +access_delivery_carrier_portal,delivery.carrier portal,delivery.model_delivery_carrier,base.group_portal,1,0,0,0 diff --git a/l10n_it_delivery_note/static/description/index.html b/l10n_it_delivery_note/static/description/index.html index 060cae4a5b50..43fba4276a7d 100644 --- a/l10n_it_delivery_note/static/description/index.html +++ b/l10n_it_delivery_note/static/description/index.html @@ -1,3 +1,4 @@ +
@@ -366,7 +367,7 @@English
diff --git a/l10n_it_delivery_note/views/res_partner.xml b/l10n_it_delivery_note/views/res_partner.xml index 965c49b0a1ed..186739fe4475 100644 --- a/l10n_it_delivery_note/views/res_partner.xml +++ b/l10n_it_delivery_note/views/res_partner.xml @@ -12,7 +12,6 @@
+
+