Skip to content
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

[14.0][FIX] delivery_auto_refresh #849

Open
wants to merge 16 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions delivery_auto_refresh/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ This module automates the delivery price handling for the following cases:
* If you deliver a different quantity than the ordered one, the delivery price
is adjusted on the linked SO when the picking is transferred.

Part of this module is a backport from Odoo SA and as such, it is not included in the OCA CLA.
That means we do not have a copy of the copyright on it like all other OCA modules.

**Table of contents**

.. contents::
Expand All @@ -45,39 +48,26 @@ This module automates the delivery price handling for the following cases:
Configuration
=============

* Activate developer mode.
* Go to *Settings > Technical > Parameters > System Parameters*.
* Locate the setting with key "delivery_auto_refresh.set_default_carrier"
or create a new one if not exists.
Put a non Falsy value (1, True...) if you want to have default carrier computed
automatically.
* Locate the setting with key "delivery_auto_refresh.auto_add_delivery_line"
or create a new one if not exists.
Put a non Falsy value (1, True...) if you want to add automatically the
delivery line on save.
* Locate the setting with key "delivery_auto_refresh.refresh_after_picking"
or create a new one if not exists.
Put a non Falsy value (1, True...) if you want to refresh delivery price
after transferring.
* Locate the setting with key "delivery_auto_refresh.auto_void_delivery_line"
or create a new one if it doesn't exists.
Put a non Falsy value (1, True...) if you want to void the delivery line
values (price, units ordered, units delivered) in the sale order when the
delivered picking is returned to refund prior to be invoiced.
Go to *Settings > Sales > Shipping*:

* Enable "Set default shipping method automalically" if you want to add
automatically the carrier on the sales quotation creation.
* Enable "Refresh shipping cost line automatically" if you want to add automatically the
delivery line on save and refresh the cost. This will also set the shipping method.
* Enable "Refresh After Picking Automatically" if you want to refresh delivery
price after delivering based on what has been delivered.
* Enable "Void delivery lines automatically" if you want to void the delivery
line values (price, units ordered, units delivered) in the sale order when
the delivery is returned to refund prior to be invoiced.

Known issues / Roadmap
======================

* After confirming the sales order, the price of the delivery line (if exists)
will be only updated after the picking is transferred, but not when you
might modify the order lines.
* There can be some duplicate delivery unset/set for assuring that the refresh
is done on all cases.
* On multiple deliveries, second and successive pickings update the delivery
price, but you can't invoice the new delivery price.
* This is only working from user interface, as there's no way of making
compatible the auto-refresh intercepting create/write methods from sale order
lines.

Bug Tracker
===========
Expand Down Expand Up @@ -109,6 +99,13 @@ Contributors
* Maksym Yankin
* Simone Orsi

* Jacques-Etienne Baudoux (BCIM) <[email protected]>

* Odoo SA <[email protected]>

* Ooops404 <https://www.ooops404.com/>:
* Eduard Brahas <[email protected]>

Maintainers
~~~~~~~~~~~

Expand Down
6 changes: 5 additions & 1 deletion delivery_auto_refresh/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
"application": False,
"installable": True,
"depends": ["delivery"],
"data": ["data/ir_config_parameter.xml", "views/sale_order_views.xml"],
"data": [
"data/ir_config_parameter.xml",
"views/sale_order_views.xml",
"views/res_config_settings_views.xml",
],
}
2 changes: 2 additions & 0 deletions delivery_auto_refresh/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from . import sale_order
from . import stock_picking
from . import res_company
from . import res_config_settings
22 changes: 22 additions & 0 deletions delivery_auto_refresh/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

sale_auto_assign_carrier_on_create = fields.Boolean(
"Set default shipping method automatically"
)

sale_auto_add_delivery_line = fields.Boolean(
"Refresh shipping cost line automatically",
)
sale_refresh_delivery_after_picking = fields.Boolean(
"Refresh delivery after picking automatically",
)
sale_auto_void_delivery_line = fields.Boolean(
"Void delivery lines automatically",
)
26 changes: 26 additions & 0 deletions delivery_auto_refresh/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 Tecnativa - Pilar Vargas Moreno
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

sale_auto_assign_carrier_on_create = fields.Boolean(
related="company_id.sale_auto_assign_carrier_on_create",
readonly=False,
)

sale_auto_add_delivery_line = fields.Boolean(
related="company_id.sale_auto_add_delivery_line",
readonly=False,
)
sale_refresh_delivery_after_picking = fields.Boolean(
related="company_id.sale_refresh_delivery_after_picking",
readonly=False,
)
sale_auto_void_delivery_line = fields.Boolean(
related="company_id.sale_auto_void_delivery_line",
readonly=False,
)
Loading
Loading