-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[16.0][IMP] sale_pricelist_from_commitment_date: enable feature on pricelists #3205
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
Open
sebalix
wants to merge
7
commits into
OCA:16.0
Choose a base branch
from
camptocamp:16-sale_pricelist_from_commitment_date-add-parameter
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3c7d9d6
sale_pricelist_from_commitment_date: enable feature on pricelists
sebalix 67367da
sale_pricelist_from_commitment_date: fallback on expected date if no …
sebalix e72f089
sale_pricelist_from_commitment_date: add roadmap entry to rename module
sebalix 502d2f1
sale_pricelist_from_commitment_date: avoid calling several times super()
sebalix 0167c71
fixup! sale_pricelist_from_commitment_date: enable feature on pricelists
sebalix f0ccb9d
fixup! fixup! sale_pricelist_from_commitment_date: enable feature on …
sebalix 277526f
fixup! fixup! fixup! sale_pricelist_from_commitment_date: enable feat…
sebalix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
sale_pricelist_from_commitment_date/migrations/16.0.1.1.0/post-migrate.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright 2024 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
|
||
| import logging | ||
|
|
||
| from odoo import SUPERUSER_ID, api | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def migrate(cr, version): | ||
| # Price was based on commitment/delivery date by default before, so enable | ||
| # the new option on all pricelists. | ||
| if not version: | ||
| return | ||
| _logger.info("Enable price based on delivery date for all pricelists...") | ||
| env = api.Environment(cr, SUPERUSER_ID, {}) | ||
| pricelists = env["product.pricelist"].search([]) | ||
| pricelists.write({"price_based_on_delivery_date": True}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
sale_pricelist_from_commitment_date/models/product_pricelist.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Copyright 2024 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
|
||
| from odoo import models | ||
|
|
||
|
|
||
| class SaleOrder(models.Model): | ||
| _inherit = "sale.order" | ||
|
|
||
| def _get_pricelist_date(self): | ||
| if self.env.context.get("force_pricelist_date"): | ||
| return self.env.context["force_pricelist_date"] | ||
| if self.pricelist_id.price_based_on_delivery_date: | ||
| return self.commitment_date or self.expected_date | ||
| else: | ||
| return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * rename module to `sale_price_from_delivery_date` for next migration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
sale_pricelist_from_commitment_date/views/product_pricelist.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- Copyright 2024 Camptocamp SA | ||
| License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
| <odoo> | ||
|
|
||
| <record id="product_pricelist_view" model="ir.ui.view"> | ||
| <field name="name">product.pricelist.form</field> | ||
| <field name="model">product.pricelist</field> | ||
| <field name="inherit_id" ref="product.product_pricelist_view" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//field[@name='company_id']" position="after"> | ||
| <field name="price_based_on_delivery_date" /> | ||
| </xpath> | ||
|
|
||
| </field> | ||
| </record> | ||
|
|
||
| </odoo> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.