Skip to content

Commit

Permalink
Merge commit 'refs/pull/3104/head' of https://github.com/oca/sale-wor…
Browse files Browse the repository at this point in the history
…kflow into 17.0-6867
  • Loading branch information
docker-odoo committed May 3, 2024
2 parents 3b481b2 + a8345ef commit c334a1e
Show file tree
Hide file tree
Showing 20 changed files with 860 additions and 0 deletions.
98 changes: 98 additions & 0 deletions sale_order_carrier_auto_assign/README.rst
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:b5f0ff98a101634f6d21500615b789f2e2cbd6d305d896b93dd77cb31461dec0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/17.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-17-0/sale-workflow-17-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=17.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:%2017.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 <akim.juillerat@camptocamp.com>
- Son (Ho Dac) <hodacson.6491@gmail.com>
- Phuc (Tran Thanh) <phuc@trobz.com>
- Telmo Santos <telmo.santos@camptocamp.com>
- Tris Doan <tridm@trobz.com>

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/17.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.
1 change: 1 addition & 0 deletions sale_order_carrier_auto_assign/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions sale_order_carrier_auto_assign/__manifest__.py
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": "17.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"],
}
53 changes: 53 additions & 0 deletions sale_order_carrier_auto_assign/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 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: 2020-10-26 12:08+0000\n"
"Last-Translator: Daniel Martinez Vila <daniel.martinez@qubiq.es>\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 3.10\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_terms:ir.ui.view,arch_db:sale_order_carrier_auto_assign.res_config_settings_view_form_sale
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 "Pedido de venta"
56 changes: 56 additions & 0 deletions sale_order_carrier_auto_assign/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 <stefano.consolaro@mymage.it>\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_terms:ir.ui.view,arch_db:sale_order_carrier_auto_assign.res_config_settings_view_form_sale
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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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"
"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_terms:ir.ui.view,arch_db:sale_order_carrier_auto_assign.res_config_settings_view_form_sale
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 ""
3 changes: 3 additions & 0 deletions sale_order_carrier_auto_assign/models/__init__.py
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
10 changes: 10 additions & 0 deletions sale_order_carrier_auto_assign/models/res_company.py
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()
14 changes: 14 additions & 0 deletions sale_order_carrier_auto_assign/models/res_config_settings.py
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.",
)
31 changes: 31 additions & 0 deletions sale_order_carrier_auto_assign/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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):
for rec in self:
if not rec.company_id.carrier_auto_assign:
continue
rec._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_shipment_rate()
delivery_wiz.button_confirm()
3 changes: 3 additions & 0 deletions sale_order_carrier_auto_assign/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions sale_order_carrier_auto_assign/readme/CONFIGURE.md
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*.
5 changes: 5 additions & 0 deletions sale_order_carrier_auto_assign/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Akim Juillerat \<<akim.juillerat@camptocamp.com>\>
- Son (Ho Dac) \<<hodacson.6491@gmail.com>\>
- Phuc (Tran Thanh) \<<phuc@trobz.com>\>
- Telmo Santos \<<telmo.santos@camptocamp.com>\>
- Tris Doan \<<tridm@trobz.com>\>
1 change: 1 addition & 0 deletions sale_order_carrier_auto_assign/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions sale_order_carrier_auto_assign/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module assigns automatically delivery carrier on sale order
confirmation.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c334a1e

Please sign in to comment.