Skip to content

Conversation

@AungKoKoLin1997
Copy link
Contributor

@AungKoKoLin1997 AungKoKoLin1997 commented Dec 4, 2025

@qrtl QT6162

AungKoKoLin1997 and others added 21 commits December 4, 2025 03:46
Currently translated at 50.0% (1 of 2 strings)

Translation: manufacture-16.0/manufacture-16.0-mrp_subcontracting_skip_no_negative
Translate-URL: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_subcontracting_skip_no_negative/it/
Currently translated at 100.0% (2 of 2 strings)

Translation: manufacture-16.0/manufacture-16.0-mrp_subcontracting_skip_no_negative
Translate-URL: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_subcontracting_skip_no_negative/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: manufacture-16.0/manufacture-16.0-mrp_subcontracting_skip_no_negative
Translate-URL: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_subcontracting_skip_no_negative/
Currently translated at 100.0% (3 of 3 strings)

Translation: manufacture-16.0/manufacture-16.0-mrp_subcontracting_skip_no_negative
Translate-URL: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-mrp_subcontracting_skip_no_negative/it/
@AungKoKoLin1997
Copy link
Contributor Author

AungKoKoLin1997 commented Dec 4, 2025

I found that the commit introduced during the 17.0 migration (#1454 (comment)) not only affects partial subcontracting receipts, but also skips the check from that PR (#1372) when the component quantity is insufficient. Therefore, in my latest commit, I decided to remove the code I originally added in my first PR (#1025), since it is not related to the no negative stock module and the scenario that motivated it no longer occurs in Odoo 18 (#1025 (comment)).

Copy link

@kanda999 kanda999 left a comment

Choose a reason for hiding this comment

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

Functional review: It works as expected in my local env

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 Would you consider adding a test where subcontracting picking receipt fails when component stock is insufficient?

@AungKoKoLin1997
Copy link
Contributor Author

In my last commit, I bring back the fix from odoo 16 that was not included in17.0 migration and improve tests.
19343f6

I believe my latest two commit should be back ported to 17.0.

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.

Code review. 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). 🤖

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 18.0-mig-mrp_subcontracting_skip_no_negative branch from 957bc71 to 0e3dabd Compare December 15, 2025 03:09
@AungKoKoLin1997
Copy link
Contributor Author

@victoralmau @fdesmottes @Raul-S73
Please let me know if you have a different opinion on the comment above.
#1674 (comment)

@fdesmottes
Copy link

fdesmottes commented Dec 15, 2025

@victoralmau @fdesmottes @Raul-S73 Please let me know if you have a different opinion on the comment above. #1674 (commentaire)

Hi @AungKoKoLin1997 it's ok for me.

Copy link
Member

@victoralmau victoralmau left a comment

Choose a reason for hiding this comment

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

Code review OK

Can you merge the extra commits into the migration commit?

ejemplo

Comment on lines 7 to 11
from odoo.tests import Form, TransactionCase
from odoo.tools import mute_logger


class TestMrpSubcontractingSkipNoNegative(TransactionCase):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
from odoo.tests import Form, TransactionCase
from odoo.tools import mute_logger
class TestMrpSubcontractingSkipNoNegative(TransactionCase):
from odoo.addons.base.tests.common import BaseCommon
from odoo.tools import mute_logger
class TestMrpSubcontractingSkipNoNegative(BaseCommon):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that BaseCommon is an internal helper built on top of TransactionCase, mainly used to standardize core tests (such as a mail-disabled context and common user/company setup).
Since our test doesn’t rely on those features, I prefer using TransactionCase to keep it simpler and more explicit.

Copy link
Member

Choose a reason for hiding this comment

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

The suggestion is for speeding up tests. When you create a record, some chatter messages are added, some followers are auto-added, etc. Using this class, all that things are disabled by default. It's true there's a little overhead with the creation of some users, but it usually worths. Alternatively, you can do cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pedrobaeza Thank you for the explanation.
I applied cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) in the tests.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, it's not just those context values, it's more https://github.com/odoo/odoo/blob/18.0/odoo/addons/base/tests/common.py#L11. That's why we always suggest using that BaseCommon class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used BaseCommon class.

@AungKoKoLin1997
Copy link
Contributor Author

Can you merge the extra commits into the migration commit?

@victoralmau
I want to keep them as separate commits because I plan to backport these commits to 17.0 later. Also, the last commit already exists as a separate commit in Odoo 16.
#1674 (comment)

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 18.0-mig-mrp_subcontracting_skip_no_negative branch from 0e3dabd to 2fdfdb4 Compare January 8, 2026 07:48
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 18.0-mig-mrp_subcontracting_skip_no_negative branch from 2fdfdb4 to c5d2942 Compare January 8, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.