Skip to content
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

[ADD] product_uom_merge #1809

Closed

Conversation

JasminSForgeFlow
Copy link
Contributor

Module for merge duplicate uoms

cc @ForgeFlow

@JasminSForgeFlow JasminSForgeFlow force-pushed the 15.0-add-product_uom_merge branch 2 times, most recently from c217748 to eb79e99 Compare August 3, 2023 12:32
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with done stock moves. Works good. Thanks!

@JasminSForgeFlow JasminSForgeFlow marked this pull request as ready for review August 4, 2023 04:40
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved as green now and functional tests done

"name": "Base Product UOMs Merge",
"summary": "Merge duplicate product UOMs",
"version": "15.0.1.0.0",
"license": "LGPL-3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"license": "LGPL-3",
"license": "AGPL-3",

based on https://github.com/OCA/openupgradelib/blob/master/openupgradelib/openupgrade_merge_records.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, Thanks

Copy link

@OriolMForgeFlow OriolMForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments

Functional review: it works properly

@@ -0,0 +1 @@
We can merge duplicates products into single product

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We can merge duplicates products into single product
We can merge duplicates UOMs into single UOM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, Thanks

@@ -0,0 +1,3 @@
Select uoms from same cateogry then click on Merge UOMs in Action menu.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Select uoms from same cateogry then click on Merge UOMs in Action menu.
Select uoms from same category then click on Merge UOMs in Action menu.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, Thanks

"license": "AGPL-3",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Warehouse Management",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change the category field, as this module is not exclusively for Warehouse Management. It can be used from the Sales application without requiring the use of a warehouse, as it no depends to "stock"

Maybe change to category "Product".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update category as per dependent module Product's category.

Thanks for suggestion

@@ -0,0 +1,3 @@
===================
Base Products Merge

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change to Base Product UOMs Merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, Thanks



class TestMergeUOM(TransactionCase):
def setUp(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to setUpClass according to the migration rules to v15

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, Thanks

Copy link

@OriolMForgeFlow OriolMForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@rousseldenis
Copy link
Contributor

@JasminSForgeFlow My 10k€ question: is this should be here or in product-attribute repository as it does not depends on stock ?

Copy link
Member

@hbrunn hbrunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should either forbid merging UoMs with different factors too, or add code that converts the quantity of quants. Otherwise you'll get wrong stock levels, as quants always refer to the product's standard UoM. Maybe a big red warning also suffices for cases where stock is wrong anyways and the merging is the first step to get it right?

Imagine you have product A with UoM km and product B with UoM m. If you now go and merge km into m, your stock levels of product A will be off by factor 1000.

I'm working on a generic merge addon where my customer has been bitten by a very similar issue when merging products, there also quants suddenly refer to a different UoM and are potentially off by the factor difference of the merged products' UoMs.

My fix is to convert quantities before merging: https://github.com/OCA/server-ux/pull/625/files#diff-b166ff54d6536b547b2dbad5be3664f2b7926c93fda8cbb3ddf38e312037aa78R23

@rousseldenis that would then also answer the 10k question, if you want to implement the conversion here, you'd need a dependency on stock.

@rousseldenis
Copy link
Contributor

@rousseldenis that would then also answer the 10k question, if you want to implement the conversion here, you'd need a dependency on stock.

@hbrunn I haven't look at the implementation yet 😅 but indeed this needs to be more coercive. In fact, your module depends on stock but could be split (supplierinfo in product / quant in stock ones).

@hbrunn
Copy link
Member

hbrunn commented Aug 17, 2023

@JasminSForgeFlow I had to implement UoM support for the PR above anyways, so it might be just a little more work to simply lift this to v15 (I expect you just have to change the version number and some field names), then you get all the checks and conversions I talked about for free. And the possibility to merge countries, states and whatever else users tend to duplicate by misspelling things in many2one fields with inline create activated.
Note this is not meant to bully you into doing this, I'll just as happily review an update here where you add the conversion/check/warning. I just think you/your customers would get much more options this way for free.

@rousseldenis let's discuss stuff related to my PR there such as not to hijack the discussion here :-)

@JasminSForgeFlow
Copy link
Contributor Author

Closing PR

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.

6 participants