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

[4804][IMP] sale_order_pricelist_commitment_date #228

Open
wants to merge 8 commits into
base: 12.0
Choose a base branch
from

Conversation

AungKoKoLin1997
Copy link
Contributor

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, it would be better to just update sale_order_pricelist_commitment_date instead of having changes on the same method in two separate modules.

  • Add sale_order_secondary_unit_price as a dependency of sale_order_pricelist_commitment_date
  • Adjust onchange_commitment_date() accordingly
  • No changes on sale_order_secondary_unit_price

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 12.0-imp-sale_order_pricelist_commitment_date branch from 0452024 to 83a0dce Compare February 17, 2025 04:55
Comment on lines 13 to 16
"depends": [
"sale",
"product_secondary_unit",
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid making unnecessary changes.

Comment on lines 18 to 21
date=self.date_order,
pricelist=self.pricelist_id.id,
uom=line.product_uom.id,
commitment_date=self.commitment_date,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
date=self.date_order,
pricelist=self.pricelist_id.id,
uom=line.product_uom.id,
commitment_date=self.commitment_date,
date=self.commitment_date,
pricelist=self.pricelist_id.id,
uom=line.product_uom.id,
fiscal_position=self.env.context.get("fiscal_position"),

How about making it like this, and removing the adjustment on _compute_price_rule()?

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, removing the adjustments on _compute_price_rule() was a mistake -- it would break the price recalculation behavior when product, quantity, or UoM is changed.

Comment on lines 18 to 21
date=self.commitment_date,
pricelist=self.pricelist_id.id,
uom=line.product_uom.id,
fiscal_position=self.env.context.get("fiscal_position"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
date=self.commitment_date,
pricelist=self.pricelist_id.id,
uom=line.product_uom.id,
fiscal_position=self.env.context.get("fiscal_position"),
date=self.date_order,
pricelist=self.pricelist_id.id,
uom=line.product_uom.id,
fiscal_position=self.env.context.get("fiscal_position"),
commitment_date=self.commitment_date,

Comment on lines 1 to 20
# Copyright 2020 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import api, fields, models


class Pricelist(models.Model):
_inherit = "product.pricelist"

@api.multi
def _compute_price_rule(self, products_qty_partner, date=False, uom_id=False):
date = (
self._context.get("commitment_date")
or self._context.get("date")
or fields.Date.today()
)
date = fields.Date.to_date(date)
return super(Pricelist, self)._compute_price_rule(
products_qty_partner=products_qty_partner, date=date, uom_id=uom_id
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revive this.

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review.

@AungKoKoLin1997
Copy link
Contributor Author

@kanda999 @nobuQuartile Please review when you are available.

Copy link

@nobuQuartile nobuQuartile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional test
LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants