diff --git a/sale_import_wizard_delivery/README.rst b/sale_import_wizard_delivery/README.rst new file mode 100644 index 00000000..424949ef --- /dev/null +++ b/sale_import_wizard_delivery/README.rst @@ -0,0 +1,30 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=========================== +Sale import wizard delivery +=========================== + +* In "Sale import wizard" new field "Shipping Method". +* If a shipping method is defined in the wizard, the "Update Shipping Cost" + button will automatically be executed when creating the sales order. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, +please check there if your issue has already been reported. If you spotted +it first, help us smash it by providing detailed and welcomed feedback. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Contributors +------------ + +* Ana Juaristi +* Alfredo de la Fuente diff --git a/sale_import_wizard_delivery/__init__.py b/sale_import_wizard_delivery/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/sale_import_wizard_delivery/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_import_wizard_delivery/__manifest__.py b/sale_import_wizard_delivery/__manifest__.py new file mode 100644 index 00000000..53ea872b --- /dev/null +++ b/sale_import_wizard_delivery/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2023 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Sale Import Wizard Delivery", + "version": "14.0.1.0.0", + "category": "Hidden/Tools", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "https://github.com/avanzosc/sale-addons", + "depends": ["sale_import_wizard", "delivery"], + "data": ["views/sale_order_import_views.xml"], + "installable": True, + "auto_install": True, +} diff --git a/sale_import_wizard_delivery/i18n/en_GB.po b/sale_import_wizard_delivery/i18n/en_GB.po new file mode 100644 index 00000000..825bd90e --- /dev/null +++ b/sale_import_wizard_delivery/i18n/en_GB.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_import_wizard_delivery +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-12-19 08:46+0000\n" +"PO-Revision-Date: 2023-12-19 08:46+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,help:sale_import_wizard_delivery.field_sale_order_import__carrier_id +msgid "Choose the method to deliver your goods" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__display_name +msgid "Display Name" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__id +msgid "ID" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__carrier_id +#: model_terms:ir.ui.view,arch_db:sale_import_wizard_delivery.sale_order_import_view_search +msgid "Shipping Method" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import_line +msgid "Wizard lines to import sale orders" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import +msgid "Wizard to import sale orders" +msgstr "" diff --git a/sale_import_wizard_delivery/i18n/en_US.po b/sale_import_wizard_delivery/i18n/en_US.po new file mode 100644 index 00000000..9fa38bea --- /dev/null +++ b/sale_import_wizard_delivery/i18n/en_US.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_import_wizard_delivery +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-12-19 08:47+0000\n" +"PO-Revision-Date: 2023-12-19 08:47+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,help:sale_import_wizard_delivery.field_sale_order_import__carrier_id +msgid "Choose the method to deliver your goods" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__display_name +msgid "Display Name" +msgstr "Mostrar nombre" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__id +msgid "ID" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order +msgid "Sales Order" +msgstr "Pedidos de venta" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__carrier_id +#: model_terms:ir.ui.view,arch_db:sale_import_wizard_delivery.sale_order_import_view_search +msgid "Shipping Method" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import_line +msgid "Wizard lines to import sale orders" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import +msgid "Wizard to import sale orders" +msgstr "" diff --git a/sale_import_wizard_delivery/i18n/es.po b/sale_import_wizard_delivery/i18n/es.po new file mode 100644 index 00000000..2517db73 --- /dev/null +++ b/sale_import_wizard_delivery/i18n/es.po @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_import_wizard_delivery +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-12-19 08:47+0000\n" +"PO-Revision-Date: 2023-12-19 08:47+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,help:sale_import_wizard_delivery.field_sale_order_import__carrier_id +msgid "Choose the method to deliver your goods" +msgstr "Elige el método para envíar tus productos" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__display_name +msgid "Display Name" +msgstr "Mostrar nombre" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__id +msgid "ID" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line____last_update +msgid "Last Modified on" +msgstr "Última moficación el" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__carrier_id +#: model_terms:ir.ui.view,arch_db:sale_import_wizard_delivery.sale_order_import_view_search +msgid "Shipping Method" +msgstr "Método de envío" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import_line +msgid "Wizard lines to import sale orders" +msgstr "Líneas del asistente para la importación de pedidos de venta" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import +msgid "Wizard to import sale orders" +msgstr "Asistente para la importación de pedidos de venta" diff --git a/sale_import_wizard_delivery/i18n/sale_import_wizard_delivery.pot b/sale_import_wizard_delivery/i18n/sale_import_wizard_delivery.pot new file mode 100644 index 00000000..825bd90e --- /dev/null +++ b/sale_import_wizard_delivery/i18n/sale_import_wizard_delivery.pot @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_import_wizard_delivery +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-12-19 08:46+0000\n" +"PO-Revision-Date: 2023-12-19 08:46+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,help:sale_import_wizard_delivery.field_sale_order_import__carrier_id +msgid "Choose the method to deliver your goods" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__display_name +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__display_name +msgid "Display Name" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__id +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line__id +msgid "ID" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import____last_update +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model.fields,field_description:sale_import_wizard_delivery.field_sale_order_import__carrier_id +#: model_terms:ir.ui.view,arch_db:sale_import_wizard_delivery.sale_order_import_view_search +msgid "Shipping Method" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import_line +msgid "Wizard lines to import sale orders" +msgstr "" + +#. module: sale_import_wizard_delivery +#: model:ir.model,name:sale_import_wizard_delivery.model_sale_order_import +msgid "Wizard to import sale orders" +msgstr "" diff --git a/sale_import_wizard_delivery/models/__init__.py b/sale_import_wizard_delivery/models/__init__.py new file mode 100644 index 00000000..2e47126d --- /dev/null +++ b/sale_import_wizard_delivery/models/__init__.py @@ -0,0 +1,2 @@ +from . import sale_order_import +from . import sale_order diff --git a/sale_import_wizard_delivery/models/sale_order.py b/sale_import_wizard_delivery/models/sale_order.py new file mode 100644 index 00000000..168570b1 --- /dev/null +++ b/sale_import_wizard_delivery/models/sale_order.py @@ -0,0 +1,25 @@ +# Copyright 2023 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + def _delivery_carrier_from_sale_import_wizard(self, carrier_id): + wizard_obj = self.env["choose.delivery.carrier"] + vals = { + "order_id": self.id, + "partner_id": self.partner_id.id, + "carrier_id": carrier_id.id, + } + wizard = wizard_obj.new(vals) + for comp_onchange in wizard._onchange_methods[ + "carrier_id", "order_id", "partner_id" + ]: + comp_onchange(wizard) + vals = wizard._convert_to_write(wizard._cache) + new_wizard = wizard_obj.create(vals) + if new_wizard.delivery_type not in ("fixed", "base_on_rule"): + new_wizard._get_shipment_rate() + new_wizard.button_confirm() diff --git a/sale_import_wizard_delivery/models/sale_order_import.py b/sale_import_wizard_delivery/models/sale_order_import.py new file mode 100644 index 00000000..fa0d6050 --- /dev/null +++ b/sale_import_wizard_delivery/models/sale_order_import.py @@ -0,0 +1,22 @@ +# Copyright 2023 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class SaleOrderImport(models.Model): + _inherit = "sale.order.import" + + carrier_id = fields.Many2one( + string="Shipping Method", + comodel_name="delivery.carrier", + help="Choose the method to deliver your goods", + copy=False, + ) + + def action_process(self): + result = super(SaleOrderImport, self).action_process() + orders = self.mapped("import_line_ids.sale_order_id") + if self.carrier_id: + for sale in orders: + sale._delivery_carrier_from_sale_import_wizard(self.carrier_id) + return result diff --git a/sale_import_wizard_delivery/views/sale_order_import_views.xml b/sale_import_wizard_delivery/views/sale_order_import_views.xml new file mode 100644 index 00000000..45984cd0 --- /dev/null +++ b/sale_import_wizard_delivery/views/sale_order_import_views.xml @@ -0,0 +1,43 @@ + + + + sale.order.import + + + + + + + + + + sale.order.import + + + + + + + + + + sale.order.import + + + + + + + + + + + diff --git a/setup/sale_import_wizard_delivery/odoo/addons/sale_import_wizard_delivery b/setup/sale_import_wizard_delivery/odoo/addons/sale_import_wizard_delivery new file mode 120000 index 00000000..55ef60dd --- /dev/null +++ b/setup/sale_import_wizard_delivery/odoo/addons/sale_import_wizard_delivery @@ -0,0 +1 @@ +../../../../sale_import_wizard_delivery \ No newline at end of file diff --git a/setup/sale_import_wizard_delivery/setup.py b/setup/sale_import_wizard_delivery/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/sale_import_wizard_delivery/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)