[15.0][IMP] onchange_helper: Support one2many fields in onchanges#3515
Open
pedrobaeza wants to merge 1 commit intoOCA:15.0from
Open
[15.0][IMP] onchange_helper: Support one2many fields in onchanges#3515pedrobaeza wants to merge 1 commit intoOCA:15.0from
pedrobaeza wants to merge 1 commit intoOCA:15.0from
Conversation
There are one2many fields that are computed, like for example
`sale.order.line~agent_ids` in module `sale_commission`. When another
module like `sale_product_set` uses this module to populate the order
lines, you get this error:
```
odoo.sql_db: bad query: INSERT INTO "sale_order_line_agent" ("id", "create_date", "create_uid", "object_id", "write_date", "write_uid") VALUES (nextval('sale_order_line_agent_id_seq'), ...) RETURNING id
odoo-1 | ERROR: null value in column "agent_id" of relation "sale_order_line_agent" violates not-null constraint
```
And this is because the commands that are passed consists on just
`(0, 0, {})`.
This commit fixes acting in 2 places:
- Populating correctly the onchange_spec to get those fields.
- Manipulating afterwards o2m fields the same way it's done with the
first level to clean many2one values from `(id, display_name)` to just
the id.
TT60729
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.
There are one2many fields that are computed, like for example
sale.order.line~agent_idsin modulesale_commission. When another module likesale_product_setuses this module to populate the order lines, you get this error:And this is because the commands that are passed consists on just
(0, 0, {}).This commit fixes this acting in 2 places:
(id, display_name)to just the id.@Tecnativa TT60729