Skip to content

Conversation

nicknomo
Copy link

@nicknomo nicknomo commented Sep 21, 2016

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:

  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.

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@nicknomo
Copy link
Author

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
@nicknomo nicknomo changed the title Nick Ross (nicknomo) CLA [9.0][BUG] Fixed inconsistent UoM domain in Quotations/Order #3 Sep 22, 2016
@nicknomo nicknomo changed the title [9.0][BUG] Fixed inconsistent UoM domain in Quotations/Order #3 [9.0][FIX] Fixed inconsistent UoM domain in Quotations/Order #3 Sep 22, 2016
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)
Copy link
Contributor

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

@mart-e
Copy link
Contributor

mart-e commented Dec 13, 2016

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.

@C3POdoo
Copy link
Contributor

C3POdoo commented Oct 24, 2019

Dear @nicknomo,

Thank you for your contribution but the version 9.0 is no longer supported.
We only support the last 3 stable versions so no longer accepts patches into this branch.

We apology if we could not look at your request in time.
If the contribution still makes sense for the upper version, please let us know and do not hesitate to recreate one for the recent versions. We will try to check it as soon as possible.

This is an automated message.

@C3POdoo C3POdoo closed this Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants