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

[4346][ADD] mrp_mto_analytic, purchase_mto_analytic #110

Merged
merged 5 commits into from
Apr 16, 2024

Conversation

AungKoKoLin1997
Copy link
Contributor

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

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

@AungKoKoLin1997 Can you please update the OCA PR with the content of my commit?

@yostashiro yostashiro force-pushed the 16.0-add-mrp_mto_analytic branch from bebaf50 to aa76cb8 Compare March 11, 2024 14:04
@yostashiro
Copy link
Member

@AungKoKoLin1997 Can you please add a consideration in purchase_mto_analytic to split the procurement based on the analytic distribution? I suppose we should extend this https://github.com/OCA/OCB/blob/52bec03/addons/purchase_stock/models/stock_rule.py#L182-L191 to add analytic_distribution as a key.

Haven't checked whether an equivalent consideration is needed in mrp_mto_analytic. I am guessing not. Please help check.

@AungKoKoLin1997
Copy link
Contributor Author

I suppose we should extend this https://github.com/OCA/OCB/blob/52bec03/addons/purchase_stock/models/stock_rule.py#L182-L191 to add analytic_distribution as a key.

I think we can't do like this because analytic_distribution is json type value and we can't use as a key for groupby. Even we get analytic accounts from analytic_distribution and use as a key, I don't think we can get our expected behavior.

@AungKoKoLin1997
Copy link
Contributor Author

There is blocking issue when we want to split purchase order line depends on analytic_distribution because of the behavior of this function. This function always return the first PO line of matched PO lines.
https://github.com/odoo/odoo/blob/990aae55b1a2b95765a848b6fc122bb69f768ce1/addons/purchase_stock/models/purchase.py#L620
It returns the first PO line.
So, in case of scenario like below, the workflow is not correct.

This is after create two PO lines depends on analytic_distribution.
Screenshot 2024-03-19 at 11 50 40

After that, when we create new document with the same analytic_distribution of existing second PO line, it checks whether it is create new PO line or use existing one. Then, it creates new PO line because the first line of existing PO doesn't have the same analytic_distribution with the coming PO line. So, we need to complete override above function.
Screenshot 2024-03-19 at 11 51 07

@yostashiro yostashiro changed the title [16.0][4346][ADD] mrp_mto_analytic, purchase_mto_analytic [4346][ADD] mrp_mto_analytic, purchase_mto_analytic Mar 19, 2024
@yostashiro yostashiro merged commit fe27b14 into 16.0 Apr 16, 2024
3 checks passed
@yostashiro yostashiro deleted the 16.0-add-mrp_mto_analytic branch June 4, 2024 09:13
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.

2 participants