[FIX] construction_developer: mark uom of WI required if no product#1869
Closed
[FIX] construction_developer: mark uom of WI required if no product#1869
Conversation
Collaborator
dhrs-odoo
reviewed
Mar 17, 2026
280095f to
11a8da2
Compare
Contributor
|
@vava-odoo LGTM 🚀 |
vava-odoo
reviewed
Mar 17, 2026
Currently, an error occurs when a user creates a work item.
Steps to Reproduce:
- Install the construction_developer.
- Go to Sales > Products > Work Items.
- Create a new record by entering only the name and save.
ValueError: ValueError('NotNullViolation(\'null value in column "uom_id" of relation "product_template" violates not-null constraint\\nDETAIL: Failing row contains (83, 1, null, null, null, null, 2, 2, service, no, null, {"en_US": "sadsa"}, null, null, null, null, 0.0, null, null, f, t, t, t, null, null, null, 2026-03-17 06:18:40.850849, 2026-03-17 06:18:40.850849, null, null, 15, null, {"1": 2}, null, null, null, null, null, null, purchase, null, null, null, manual, no, order, null, null, null, null, null, null, null, 0.9).\\n\') while evaluating\n\'for wi in records:\\n new_product = env[\\\'product.product\\\'].create({\\n \\\'name\\\': wi.x_name,\\n \\\'default_code\\\': wi.x_reference,\\n \\\'type\\\': \\\'service\\\',\\n \\\'service_policy\\\': "delivered_manual",\\n \\\'list_price\\\': wi.x_unit_price,\\n \\\'standard_price\\\': wi.x_unit_cost,\\n \\\'uom_id\\\': wi.x_unit_custom_id.id,\\n })\\n wi.write({\\\'x_product_id\\\': new_product.id})\'') while evaluating
'record.x_unit_cost'
This error occurs because when a product is not set on the work item,
a new product is created using the work item name. During this process,
the system tries to assign uom_id from x_unit_custom_id [1], which is empty
if the user has not selected any unit, causing the error.
This commit ensures that the field x_unit_custom_id is set as required
at the view level when no product is set on the work item.
[1]: https://github.com/odoo/industry/blob/92cd04cc4f35007e232ae1bddafc75a3fe1b4732/construction_developer/data/ir_actions_server.xml#L164
[2]: https://github.com/odoo/industry/blob/92cd04cc4f35007e232ae1bddafc75a3fe1b4732/construction_developer/data/ir_ui_view.xml#L156
sentry-7339061587
11a8da2 to
ef5b322
Compare
vava-odoo
approved these changes
Mar 18, 2026
Collaborator
|
Merge method set to squash. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Currently, an error occurs when a user creates a work item.
Steps to Reproduce:
construction_developer.Sales>Products>Work Items.nameand save.Error:
This error occurs because when a product is not set on the work item, a new product
is created using the work item name. During this process, the system tries to assign
uom_id from x_unit_custom_id 1, which is empty if the user has not selected any unit,
causing the error.
This commit ensures that the field x_unit_custom_id is set as required
at the view level.
[2]-
industry/construction_developer/data/ir_ui_view.xml
Line 156 in 92cd04c
sentry-7339061587