-
Notifications
You must be signed in to change notification settings - Fork 30.1k
[9.0][FIX] Fixed inconsistent UoM domain in Quotations/Order #3 #13546
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
Conversation
Create test
I agree to the license terms
CLA try #2 |
…m would be changed in the onchange function called by a changed product_id. This onchange function would change the domain on product_uom for ALL lines in the order. Also, when editing the order, the product_uom would have no domain. The user would experience an inconsistent UI compared to when he created the lines. To solve these issues: 1) I Added a relative field for the category_id of product_uom, and stored it in the database. 2) I added this relative field to the view (invisible=1), and used it in the default domain for product_uom.
[9.0][BUG] Fixed inconsistent UoM domain in Quotations/Order
product_uom_qty = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True, default=1.0) | ||
product_uom = fields.Many2one('product.uom', string='Unit of Measure', required=True) | ||
#We've added a related field to store the category of the UoM for this line. We use this as a default domain in the view. | ||
relcatid = fields.Many2one(related='product_uom.category_id', store=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not compatible with stable policy
Hello, We can not add new fields in stable versions. Please either resubmit for the master branch or adapt your code to avoid the new field. |
Dear @nicknomo, Thank you for your contribution but the version 9.0 is no longer supported. We apology if we could not look at your request in time. This is an automated message. |
Description of the issue/feature this PR addresses:
The product_uom field's domain in sale.order.line would be inconsistent and improper in several situations.
Current behavior before PR:
When adding a line to a quotation/order, the domain of the product_uom would be changed in the onchange function called by a changed product_id. This onchange function would change the domain on product_uom for ALL lines in the order.
Also, when editing the order, the product_uom would have no domain. The user would experience an inconsistent UI compared to when they created the lines.
Desired behavior after PR is merged:
The category for the product_uom's domain will always be properly defined. Each line will have an independent domain, and it will restrict the product_uom selection so that it can only be changed to UoM's in the same category as the existing UoM.
To solve these issues:
I Added a relative field for the category_id of product_uom, and stored it in the database.
I added this relative field to the view (invisible=1), and used it in the default domain for product_uom.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr