Skip to content

Commit 0d7dca6

Browse files
[ADD] sale_pricelist_delivery_date
1 parent eac36e8 commit 0d7dca6

17 files changed

+763
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
============================
2+
Sale Pricelist Delivery Date
3+
============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:0e2d45cfc91cdcf0127e51f6a29140e8cf06f497aa494e2d5bd5395330469eb2
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_pricelist_delivery_date
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_pricelist_delivery_date
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows users to calculate the unit price of sale order lines
32+
based on the delivery date of the sales order. The delivery date is
33+
taken from the sales order’s commitment date (``commitment_date``) when
34+
set; otherwise, it falls back to the expected date (``expected_date``).
35+
36+
**Table of contents**
37+
38+
.. contents::
39+
:local:
40+
41+
Configuration
42+
=============
43+
44+
To enable delivery-date-based pricing:
45+
46+
- Go to Sales → Configuration → Settings
47+
- Enable “Use Delivery Date for Price Computation”
48+
- Enable “Delivery Date Required” to make the Delivery Date field
49+
mandatory on the sales order.
50+
51+
Bug Tracker
52+
===========
53+
54+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
55+
In case of trouble, please check there if your issue has already been reported.
56+
If you spotted it first, help us to smash it by providing a detailed and welcomed
57+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_pricelist_delivery_date%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
58+
59+
Do not contact contributors directly about support or help with technical issues.
60+
61+
Credits
62+
=======
63+
64+
Authors
65+
-------
66+
67+
* Quartile
68+
69+
Contributors
70+
------------
71+
72+
- Quartile <https://www.quartile.co>
73+
74+
- Yoshi Tashiro
75+
- Aung Ko Ko Lin
76+
77+
Maintainers
78+
-----------
79+
80+
This module is maintained by the OCA.
81+
82+
.. image:: https://odoo-community.org/logo.png
83+
:alt: Odoo Community Association
84+
:target: https://odoo-community.org
85+
86+
OCA, or the Odoo Community Association, is a nonprofit organization whose
87+
mission is to support the collaborative development of Odoo features and
88+
promote its widespread use.
89+
90+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_pricelist_delivery_date>`_ project on GitHub.
91+
92+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
3+
{
4+
"name": "Sale Pricelist Delivery Date",
5+
"author": "Quartile, Odoo Community Association (OCA)",
6+
"website": "https://github.com/OCA/sale-workflow",
7+
"category": "Sales",
8+
"version": "18.0.1.0.0",
9+
"license": "AGPL-3",
10+
"depends": ["sale"],
11+
"data": [
12+
"views/sale_order_views.xml",
13+
"views/res_config_settings_views.xml",
14+
],
15+
"installable": True,
16+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from . import res_company
2+
from . import res_config_settings
3+
from . import sale_order_line
4+
from . import sale_order
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResCompany(models.Model):
8+
_inherit = "res.company"
9+
10+
use_delivery_date_price = fields.Boolean(
11+
string="Use Delivery Date for Price Computation"
12+
)
13+
is_delivery_date_required = fields.Boolean()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResConfigSettings(models.TransientModel):
8+
_inherit = "res.config.settings"
9+
10+
use_delivery_date_price = fields.Boolean(
11+
related="company_id.use_delivery_date_price",
12+
readonly=False,
13+
)
14+
is_delivery_date_required = fields.Boolean(
15+
related="company_id.is_delivery_date_required",
16+
readonly=False,
17+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import fields, models
5+
6+
7+
class SaleOrder(models.Model):
8+
_inherit = "sale.order"
9+
10+
is_delivery_date_required = fields.Boolean(
11+
related="company_id.is_delivery_date_required"
12+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2025 Quartile (https://www.quartile.co)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import api, models
5+
6+
7+
class SaleOrderLine(models.Model):
8+
_inherit = "sale.order.line"
9+
10+
@api.depends(
11+
"product_id",
12+
"product_uom",
13+
"product_uom_qty",
14+
"order_id.commitment_date",
15+
# "order_id.expected_date",
16+
)
17+
def _compute_price_unit(self):
18+
return super()._compute_price_unit()
19+
20+
@api.depends(
21+
"product_id",
22+
"product_uom",
23+
"product_uom_qty",
24+
"order_id.commitment_date",
25+
# "order_id.expected_date",
26+
)
27+
def _compute_pricelist_item_id(self):
28+
return super()._compute_pricelist_item_id()
29+
30+
def _get_order_date(self):
31+
if self.order_id.company_id.use_delivery_date_price:
32+
return self.order_id.commitment_date or self.order_id.expected_date
33+
return super()._get_order_date()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To enable delivery-date-based pricing:
2+
- Go to Sales → Configuration → Settings
3+
- Enable “Use Delivery Date for Price Computation”
4+
- Enable “Delivery Date Required” to make the Delivery Date field mandatory on the
5+
sales order.

0 commit comments

Comments
 (0)