Skip to content

Commit

Permalink
[14.0][ADD] sale_import_wizard_delivery: In "Sale import wizard" new …
Browse files Browse the repository at this point in the history
…field "Shipping Method".
  • Loading branch information
alfredoavanzosc authored and anajuaristi committed Aug 8, 2024
1 parent c0bfb50 commit 1c22df0
Show file tree
Hide file tree
Showing 13 changed files with 396 additions and 0 deletions.
30 changes: 30 additions & 0 deletions sale_import_wizard_delivery/README.rst
Original file line number Diff line number Diff line change
@@ -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
<https://github.com/avanzosc/sale-addons/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 <[email protected]>
* Alfredo de la Fuente <[email protected]>
1 change: 1 addition & 0 deletions sale_import_wizard_delivery/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions sale_import_wizard_delivery/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
63 changes: 63 additions & 0 deletions sale_import_wizard_delivery/i18n/en_GB.po
Original file line number Diff line number Diff line change
@@ -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 ""
63 changes: 63 additions & 0 deletions sale_import_wizard_delivery/i18n/en_US.po
Original file line number Diff line number Diff line change
@@ -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 ""
63 changes: 63 additions & 0 deletions sale_import_wizard_delivery/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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"
63 changes: 63 additions & 0 deletions sale_import_wizard_delivery/i18n/sale_import_wizard_delivery.pot
Original file line number Diff line number Diff line change
@@ -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 ""
2 changes: 2 additions & 0 deletions sale_import_wizard_delivery/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import sale_order_import
from . import sale_order
25 changes: 25 additions & 0 deletions sale_import_wizard_delivery/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -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()
22 changes: 22 additions & 0 deletions sale_import_wizard_delivery/models/sale_order_import.py
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions sale_import_wizard_delivery/views/sale_order_import_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="sale_order_import_view_tree" model="ir.ui.view">
<field name="model">sale.order.import</field>
<field name="inherit_id" ref="sale_import_wizard.sale_order_import_view_tree" />
<field name="arch" type="xml">
<field name="company_id" position="before">
<field name="carrier_id" />
</field>
</field>
</record>

<record id="sale_order_import_view_form" model="ir.ui.view">
<field name="model">sale.order.import</field>
<field name="inherit_id" ref="sale_import_wizard.sale_order_import_view_form" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<field name="carrier_id" />
</field>
</field>
</record>

<record id="sale_order_import_view_search" model="ir.ui.view">
<field name="model">sale.order.import</field>
<field
name="inherit_id"
ref="sale_import_wizard.sale_order_import_view_search"
/>
<field name="arch" type="xml">
<field name="file_date" position="after">
<field name="carrier_id" />
</field>
<filter name="state_group" position="after">
<filter
string="Shipping Method"
name="carrier_group"
domain="[]"
context="{'group_by':'carrier_id'}"
/>
</filter>
</field>
</record>
</odoo>
Loading

0 comments on commit 1c22df0

Please sign in to comment.