Skip to content

[FIX] contract_sale_generation: Sale line violates check constraint#1478

Open
SirPyTech wants to merge 1 commit into
OCA:14.0from
PyTech-SRL:14.0-fix-contract_sale_generation-sale_product_display
Open

[FIX] contract_sale_generation: Sale line violates check constraint#1478
SirPyTech wants to merge 1 commit into
OCA:14.0from
PyTech-SRL:14.0-fix-contract_sale_generation-sale_product_display

Conversation

@SirPyTech

Copy link
Copy Markdown

Steps:

  1. Create a contract with "Sale" generation type
  2. Add a line without a product
  3. Generate a sale from the contract

Before this change:
The sale cannot be created because it raises:

ValueError: <class 'psycopg2.errors.CheckViolation'>: "new row for relation "sale_order_line" violates check constraint "sale_order_line_accountable_required_fields"

After this change:
The line must have a product in order to save the contract.

Additional context:
The same issue was also addressed in #1100 but from a UI point of view

Steps:
1. Create a contract with "Sale" generation type
2. Add a line without a product
3. Generate a sale from the contract

Before this change:
The sale cannot be created because it raises:
> ValueError: <class 'psycopg2.errors.CheckViolation'>: "new row for relation "sale_order_line" violates check constraint "sale_order_line_accountable_required_fields"

After this change:
The line must have a product in order to save the contract.
@OCA-git-bot OCA-git-bot added mod:contract_sale_generation Module contract_sale_generation series:14.0 labels Jun 29, 2026
@SirPyTech

Copy link
Copy Markdown
Author

pre-commit will succeed after #1477.

Tests fail because of #1479.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:contract_sale_generation Module contract_sale_generation series:14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants