Skip to content

[FIX] price_security: discount restriction on lines added from the ca… - #919

Closed
lef-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-123508-lef
Closed

[FIX] price_security: discount restriction on lines added from the ca…#919
lef-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-h-123508-lef

Conversation

@lef-adhoc

Copy link
Copy Markdown
Contributor

…talog

The api.constrains on discount ran during the create flush, comparing discount values that may not be settled yet. With sale_triple_discount installed, its circular compute/inverse chain over discount1/2/3 leaves the pricelist discount unsettled at that point, so lines created without an explicit discount (e.g. adding products from the catalog view) transiently read 0.0 and were wrongly rejected for users with discount restrictions, while the same product added from the order form (which sends discount1 explicitly) passed.

  • price_security: validate at the end of create/write instead of the constraint, expose the _price_security_settle_discount hook, and compare net discounts using float precision (discount arithmetic can produce values like 32.99999999999999 that failed strict comparison).
  • price_security_sale_triple_discount: new auto-installable bridge module that settles the triple discount compute chain for lines created without explicit discount before the restriction validation.

@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

@lef-adhoc
lef-adhoc force-pushed the 19.0-h-123508-lef branch 2 times, most recently from d795806 to 3739e90 Compare July 24, 2026 18:38
…talog

The api.constrains on discount ran during the create flush, comparing
discount values that may not be settled yet. With sale_triple_discount
installed, its circular compute/inverse chain over discount1/2/3 leaves
the pricelist discount unsettled at that point, so lines created without
an explicit discount (e.g. adding products from the catalog view)
transiently read 0.0 and were wrongly rejected for users with discount
restrictions, while the same product added from the order form (which
sends discount1 explicitly) passed.

- price_security: validate at the end of create/write instead of the
  constraint, expose the _price_security_settle_discount hook, and
  compare net discounts using float precision (discount arithmetic can
  produce values like 32.99999999999999 that failed strict comparison).
- price_security_sale_triple_discount: new auto-installable bridge
  module that settles the triple discount compute chain for lines
  created without explicit discount before the restriction validation.
@lef-adhoc
lef-adhoc force-pushed the 19.0-h-123508-lef branch from 3739e90 to 6449ec0 Compare July 28, 2026 18:33
@matiasperalta1

Copy link
Copy Markdown
Contributor

@roboadhoc r+ nobump

@roboadhoc roboadhoc closed this in b31ef3e Jul 28, 2026
@roboadhoc
roboadhoc deleted the 19.0-h-123508-lef branch July 28, 2026 19:39
@roboadhoc roboadhoc added the 18.1 label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants