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

[MIG] stock_account_operating_unit: Migration to 17.0 #725

Open
wants to merge 20 commits into
base: 17.0
Choose a base branch
from

Conversation

BT-dherreros
Copy link

No description provided.

serpentcs-dev1 and others added 19 commits January 3, 2025 13:28
Added Test Cases.

Improved code for test cases

Migrated Valuation method of quants.

Migrated Valuation method _account_entry_move of quants.

Completed test cases and modified valuation method
Currently translated at 100.0% (3 of 3 strings)

Translation: operating-unit-13.0/operating-unit-13.0-stock_account_operating_unit
Translate-URL: https://translation.odoo-community.org/projects/operating-unit-13-0/operating-unit-13-0-stock_account_operating_unit/es/
@BT-dherreros BT-dherreros force-pushed the 17.0-mig-stock-account-operating-unit branch from e6fc13f to fb9abce Compare January 3, 2025 14:26
Copy link

@BT-rmartin BT-rmartin left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Choose a reason for hiding this comment

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

Wrong header, should be LGPL

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.

Functional 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). 🤖

@BT-dherreros
Copy link
Author

Functional review LGTM

I had another functional look at this code and it seems to be creating 2 journal entries, one that seems to be correct and comes form Odoo's core and the other one coming from this migrated module with an incorrect ref field. Could you confirm this? maybe this migration is not needed anymore

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.

Yes. I think it is a past improvement done in a previous version:

Create stock moves between internal locations within the same company, but
different OU’s. The journal entries are created and they are self-balanced
within the OU when the journal entries are posted

This may be creating double JE when the products are actually moved out of the company. In my opinion, it is best to remove the action_done method, or at least, check if the products are move between internal locations of different OUs for doing the change.

I've some issues with moving products between different OU. That is why I have forbidden this action in my instances and I force to move first out of the company from OU1 and then move into the company using OU2. So, I am ok with removing the overwrite in the action_done method of stock.move

@BT-dherreros BT-dherreros force-pushed the 17.0-mig-stock-account-operating-unit branch from 238681a to fbe0c16 Compare February 14, 2025 16:43
@BT-dherreros
Copy link
Author

@AaronHForgeFlow I have removed the action_done inherited method. I also adapted the unit tests that were failing. Do you think my changes to the tests make sense? To me it does of course, as the balances must change with different amount of moves.

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.

Thank you for attending the comments @BT-dherreros I still have some doubts in regards inter OU transfers. Can you please give your opinion?

# GL account ‘Inventory’ has balance 0 on OU main_operating_unit
expected_balance = 0.0
# GL account ‘Inventory’ has balance 1 on OU main_operating_unit
expected_balance = 1.0
self._check_account_balance(
self.account_inventory.id,
operating_unit=self.ou1,
expected_balance=expected_balance,
)
# GL account ‘Inventory’ has balance 2 on OU b2c
Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion the comment is correct, it should be 1 (the previous reception) + 1 (this internal transfer).

So the removal of the action_done method probably made this to have balance 1 in b2c instead of 2. Perhaps we should not remove the method but check we are not moving from in/out the company to avoid the double posting. So the override of the action_done method would be only for this inter-OU transfers between internal locations. What do you think?

operating_unit=self.ou1,
expected_balance=expected_balance,
)
# GL account ‘Goods Received Not Invoiced’ has balance 0 on OU b2c
Copy link
Contributor

Choose a reason for hiding this comment

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

balance -1

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.

9 participants