-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[18.0][MIG] sale_order_carrier_auto_assign: Migration to 18.0 #3394
base: 18.0
Are you sure you want to change the base?
Changes from all commits
8686950
3069514
a4f2f18
5d3f5d0
bce1380
9a09a53
724f319
436e7c3
03d9690
fc9d830
ab11784
6ebbb28
110621c
76c9373
a1385ec
4e1c4a3
0a7955a
9e07f3f
27addb3
7ac24bd
21eb927
af338e9
0cf228e
c9139b4
a8a174b
d000290
9173cd9
8f48b87
3120cea
8c100ac
6032287
2cdc20f
cd684d4
04684c0
f1e9d20
034f284
86f0256
216ba9b
42e714d
e082bdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
============================== | ||
Sale Order Carrier Auto Assign | ||
============================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:2095b87a55c93f980c861af47ededa6b2886cf0ccdfb2cbfe9e3d9a8db2446cd | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Alpha | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github | ||
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_carrier_auto_assign | ||
:alt: OCA/sale-workflow | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_carrier_auto_assign | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module assigns automatically delivery carrier on sale order | ||
confirmation. | ||
|
||
.. IMPORTANT:: | ||
This is an alpha version, the data model and design can change at any time without warning. | ||
Only for development or testing purpose, do not use in production. | ||
`More details on development status <https://odoo-community.org/page/development-status>`_ | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
To enable sale order carrier auto assign: | ||
|
||
1. Go to *Settings > Sales > Carrier Auto Assign*. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_carrier_auto_assign%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* Camptocamp | ||
|
||
Contributors | ||
------------ | ||
|
||
- Akim Juillerat <[email protected]> | ||
- Son (Ho Dac) <[email protected]> | ||
- Phuc (Tran Thanh) <[email protected]> | ||
- Telmo Santos <[email protected]> | ||
- Tris Doan <[email protected]> | ||
|
||
Other credits | ||
------------- | ||
|
||
|
||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_carrier_auto_assign>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2020 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
{ | ||
"name": "Sale Order Carrier Auto Assign", | ||
"summary": "Auto assign delivery carrier on sale order confirmation", | ||
"version": "18.0.1.0.0", | ||
"development_status": "Alpha", | ||
"category": "Operations/Inventory/Delivery", | ||
"website": "https://github.com/OCA/sale-workflow", | ||
"author": "Camptocamp, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"data": ["views/res_config_settings_views.xml"], | ||
"application": False, | ||
"installable": True, | ||
"depends": ["delivery"], | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_carrier_auto_assign | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2024-09-19 18:06+0000\n" | ||
"Last-Translator: Juan José Scarafía <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 5.6.2\n" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model_terms:ir.ui.view,arch_db:sale_order_carrier_auto_assign.res_config_settings_view_form_sale | ||
msgid "Assigns automatically delivery carrier on sale order confirmation." | ||
msgstr "" | ||
"Asigna automáticamente el transportista de entrega en la confirmación del " | ||
"pedido de venta." | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model.fields,field_description:sale_order_carrier_auto_assign.field_res_company__carrier_auto_assign | ||
#: model:ir.model.fields,field_description:sale_order_carrier_auto_assign.field_res_config_settings__carrier_auto_assign | ||
msgid "Carrier Auto Assign" | ||
msgstr "Asignación automática del transportista" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_res_company | ||
msgid "Companies" | ||
msgstr "Empresas" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "Ajustes de configuración" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model.fields,help:sale_order_carrier_auto_assign.field_res_config_settings__carrier_auto_assign | ||
msgid "Enable carrier auto assign on sale order confirmation." | ||
msgstr "" | ||
"Habilite la asignación automática del transportista en la confirmación del " | ||
"pedido de venta." | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "Pedido de venta" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_carrier_auto_assign | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2024-03-18 09:38+0000\n" | ||
"Last-Translator: mymage <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model_terms:ir.ui.view,arch_db:sale_order_carrier_auto_assign.res_config_settings_view_form_sale | ||
msgid "Assigns automatically delivery carrier on sale order confirmation." | ||
msgstr "" | ||
"Assegna automaticamente il corriere della consegna alla conferma " | ||
"dell'ordineidi vendita." | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model.fields,field_description:sale_order_carrier_auto_assign.field_res_company__carrier_auto_assign | ||
#: model:ir.model.fields,field_description:sale_order_carrier_auto_assign.field_res_config_settings__carrier_auto_assign | ||
msgid "Carrier Auto Assign" | ||
msgstr "Auto assegnazione corriere" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_res_company | ||
msgid "Companies" | ||
msgstr "Aziende" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "Impostazioni configurazione" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model.fields,help:sale_order_carrier_auto_assign.field_res_config_settings__carrier_auto_assign | ||
msgid "Enable carrier auto assign on sale order confirmation." | ||
msgstr "" | ||
"Anilita l'auto assegnazione corriere alla conferma dell'ordine di vendita." | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "Ordine di vendita" | ||
|
||
#~ msgid "Carrier auto assign" | ||
#~ msgstr "Auto assegnazione corriere" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_carrier_auto_assign | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 17.0\n" | ||
"Report-Msgid-Bugs-To: \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_order_carrier_auto_assign | ||
#: model_terms:ir.ui.view,arch_db:sale_order_carrier_auto_assign.res_config_settings_view_form_sale | ||
msgid "Assigns automatically delivery carrier on sale order confirmation." | ||
msgstr "" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model.fields,field_description:sale_order_carrier_auto_assign.field_res_company__carrier_auto_assign | ||
#: model:ir.model.fields,field_description:sale_order_carrier_auto_assign.field_res_config_settings__carrier_auto_assign | ||
msgid "Carrier Auto Assign" | ||
msgstr "" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_res_company | ||
msgid "Companies" | ||
msgstr "" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_res_config_settings | ||
msgid "Config Settings" | ||
msgstr "" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model.fields,help:sale_order_carrier_auto_assign.field_res_config_settings__carrier_auto_assign | ||
msgid "Enable carrier auto assign on sale order confirmation." | ||
msgstr "" | ||
|
||
#. module: sale_order_carrier_auto_assign | ||
#: model:ir.model,name:sale_order_carrier_auto_assign.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import sale_order | ||
from . import res_company | ||
from . import res_config_settings |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
carrier_auto_assign = fields.Boolean() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
carrier_auto_assign = fields.Boolean( | ||
related="company_id.carrier_auto_assign", | ||
readonly=False, | ||
help="Enable carrier auto assign on sale order confirmation.", | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2020 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
from odoo import models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
def action_confirm(self): | ||
self.filtered( | ||
lambda so: so.company_id.carrier_auto_assign | ||
)._add_delivery_carrier_on_confirmation() | ||
return super().action_confirm() | ||
|
||
def _add_delivery_carrier_on_confirmation(self): | ||
"""Automatically add delivery.carrier on sale order confirmation""" | ||
for order in self: | ||
if order.delivery_set: | ||
continue | ||
delivery_wiz_action = order.action_open_delivery_wizard() | ||
delivery_wiz_context = delivery_wiz_action.get("context", {}) | ||
if not delivery_wiz_context.get("default_carrier_id"): | ||
continue | ||
delivery_wiz = ( | ||
self.env[delivery_wiz_action.get("res_model")] | ||
.with_context(**delivery_wiz_context) | ||
.create({}) | ||
) | ||
delivery_wiz._get_delivery_rate() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we really need to call this function, I checked and found that it is mainly called in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I deleted the line and I get an error in the tests and if I don't delete it I don't get an error. Can you check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for taking the time, maybe it was worth appearing on that line. |
||
delivery_wiz.button_confirm() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
To enable sale order carrier auto assign: | ||
|
||
1. Go to *Settings \> Sales \> Carrier Auto Assign*. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- Akim Juillerat \<<[email protected]>\> | ||
- Son (Ho Dac) \<<[email protected]>\> | ||
- Phuc (Tran Thanh) \<<[email protected]>\> | ||
- Telmo Santos \<<[email protected]>\> | ||
- Tris Doan \<<[email protected]>\> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This module assigns automatically delivery carrier on sale order | ||
confirmation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
action_confirm
has iterated over the records insale.order
and called_add_delivery_carrier_on_confirmation
function for each single record. So why do we need to iterate over it again, you can consider it with function that directly handles that record and callensure_one
function will make the code clearerThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it another way, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks fine to me. thanks