Skip to content

Commit 666199b

Browse files
[ADD] sale_pricelist_delivery_date
1 parent eac36e8 commit 666199b

17 files changed

+742
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Configuration
40+
=============
41+
42+
- Go to Sales → Configuration → Settings
43+
- Enable “Use Delivery Date for Price Computation” to calculate the
44+
prices of sale order lines from the pricelist based on the assigned
45+
Delivery Date. If not enabled, the prices will be calculated using
46+
the expected delivery date instead.
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
52+
In case of trouble, please check there if your issue has already been reported.
53+
If you spotted it first, help us to smash it by providing a detailed and welcomed
54+
`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**>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
Credits
59+
=======
60+
61+
Authors
62+
-------
63+
64+
* Quartile
65+
66+
Contributors
67+
------------
68+
69+
- Quartile <<https://www.quartile.co>>
70+
71+
- Yoshi Tashiro
72+
- Aung Ko Ko Lin
73+
74+
Maintainers
75+
-----------
76+
77+
This module is maintained by the OCA.
78+
79+
.. image:: https://odoo-community.org/logo.png
80+
:alt: Odoo Community Association
81+
:target: https://odoo-community.org
82+
83+
OCA, or the Odoo Community Association, is a nonprofit organization whose
84+
mission is to support the collaborative development of Odoo features and
85+
promote its widespread use.
86+
87+
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.
88+
89+
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: 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).
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+
)
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 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+
)
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+
use_delivery_date_price = fields.Boolean(
11+
related="company_id.use_delivery_date_price"
12+
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
)
16+
def _compute_price_unit(self):
17+
return super()._compute_price_unit()
18+
19+
@api.depends(
20+
"product_id",
21+
"product_uom",
22+
"product_uom_qty",
23+
"order_id.commitment_date",
24+
)
25+
def _compute_pricelist_item_id(self):
26+
return super()._compute_pricelist_item_id()
27+
28+
def _get_order_date(self):
29+
super()._get_order_date()
30+
if self.order_id.use_delivery_date_price:
31+
return self.order_id.commitment_date
32+
return self.order_id.expected_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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- Go to Sales → Configuration → Settings
2+
- Enable “Use Delivery Date for Price Computation” to calculate the prices of sale order
3+
lines from the pricelist based on the assigned Delivery Date. If not enabled, the prices
4+
will be calculated using the expected delivery date instead.

0 commit comments

Comments
 (0)