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

[16.0][ADD] stock_account_move_reset_to_draft: New module #1813

Conversation

victoralmau
Copy link
Member

New module

Please @pedrobaeza and @carlosdauden can you review it?

@Tecnativa TT51201

@yostashiro
Copy link
Member

Looks like we should converge the ideas. OCA/account-financial-tools#1946 :)
CC: @rousseldenis

@pedrobaeza
Copy link
Member

This one seems more complete, handling all the SVLs adjustments.

@pedrobaeza pedrobaeza added this to the 16.0 milestone Oct 9, 2024
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.

Why "multi" in the module name?

@pedrobaeza
Copy link
Member

Because you can reset to draft "multiple" times. The standard only allows one.

@yostashiro
Copy link
Member

yostashiro commented Oct 9, 2024

The standard only allows one.

I don't see it this way. You can reset a bill to draft multiple times with the standard as long as there is no adjustment SVL, no?

@pedrobaeza
Copy link
Member

Yes, correct, but we are referring if you change the price multiple times. That's difficult to be reflected in the technical name, but if you have a nicer name, we are all ears.

@yostashiro
Copy link
Member

My preference is stock_account_move_force_reset_to_draft but it's not a strong one. I was just curious.

@victoralmau victoralmau force-pushed the 16.0-add-stock_account_move_multi_reset_to_draft branch from 5fc94b3 to 5a0b36c Compare October 9, 2024 15:49
Copy link
Contributor

@carlosdauden carlosdauden left a comment

Choose a reason for hiding this comment

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

Code LGTM

@victoralmau victoralmau force-pushed the 16.0-add-stock_account_move_multi_reset_to_draft branch from 5a0b36c to 393a244 Compare October 10, 2024 06:52
@rousseldenis
Copy link
Contributor

Looks like we should converge the ideas. OCA/account-financial-tools#1946 :) CC: @rousseldenis

Yes, I think this one is better in terms of reliability and avoid to enforce additional protections on prices changes or ...

@rousseldenis
Copy link
Contributor

Yes, correct, but we are referring if you change the price multiple times. That's difficult to be reflected in the technical name, but if you have a nicer name, we are all ears.

I'm also in favor of not making 'multi' in the name. As, if you do it once, you can dot it more. That's the same principle for all existing modules that reset objects to draft state. But you can add it to USAGE which is a good approach IMHO.

@pedrobaeza
Copy link
Member

Then which name?

@victoralmau victoralmau force-pushed the 16.0-add-stock_account_move_multi_reset_to_draft branch from 393a244 to ddbfdb6 Compare October 10, 2024 07:38
@rousseldenis
Copy link
Contributor

stock_account_move_force_reset_to_draft

Preference for stock_account_move_reset_to_draft which means what it does.

@pedrobaeza
Copy link
Member

OK, let's rename it, but first please do the review for performing all the possible changes at the same time.

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.

Can you please check my suggestion?

@victoralmau victoralmau force-pushed the 16.0-add-stock_account_move_multi_reset_to_draft branch from ddbfdb6 to 9c1760c Compare October 14, 2024 06:53
@victoralmau victoralmau changed the title [16.0][ADD] stock_account_move_multi_reset_to_draft: New module [16.0][ADD] stock_account_move_reset_to_draft: New module Oct 14, 2024
@rousseldenis
Copy link
Contributor

@victoralmau @pedrobaeza Could you check @yostashiro comments ?

@victoralmau
Copy link
Member Author

Renamed to stock_account_move_reset_to_draft and applied the changes suggested in #1813 (comment) (personally I think it is adding logic that this module should not have).

@yostashiro
Copy link
Member

personally I think it is adding logic that this module should not have

@victoralmau Thanks for the update but I'm not sure where your comment is coming from. If an implementation risks compromising data integrity/consistency, we must do our best to prevent that. No question about it, IMO.

@gdgellatly
Copy link

@pedrobaeza @victoralmau I added some comments here OCA/account-financial-tools#1947 (comment) about an alternative approach which is strictly speaking less accurate, but more tolerant of intervening transactions (e.g. valuation already fixed, sold though etc) and avoids editing svl's. I make no claim that it is better or worse, just food for thought.

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 test.

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

We have a good start with some constraints and amount rectifications code, so let's merge it, and we can improve it later when used in real cases.

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-1813-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Nov 1, 2024
Signed-off-by pedrobaeza
@yostashiro
Copy link
Member

Maybe it's too late now, but there is an issue with the code. We will propose a fix in another PR if it's too late.

@OCA-git-bot
Copy link
Contributor

@pedrobaeza your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-1813-by-pedrobaeza-bump-nobump.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

@pedrobaeza
Copy link
Member

I have cancelled the CI. Tell us the problem.

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.

@pedrobaeza Thanks!

This is why the error didn't reproduce: #1813 (comment)

stock_account_move_reset_to_draft/models/account_move.py Outdated Show resolved Hide resolved
stock_account_move_reset_to_draft/models/account_move.py Outdated Show resolved Hide resolved
@victoralmau victoralmau force-pushed the 16.0-add-stock_account_move_multi_reset_to_draft branch 2 times, most recently from 1e71713 to c07bb95 Compare November 4, 2024 07:39
@victoralmau
Copy link
Member Author

Changes done.

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.

LGTM just with a correction of the license. Thanks!

stock_account_move_reset_to_draft/models/account_move.py Outdated Show resolved Hide resolved
@victoralmau victoralmau force-pushed the 16.0-add-stock_account_move_multi_reset_to_draft branch from c07bb95 to a5e3f54 Compare November 4, 2024 07:55
@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-1813-by-pedrobaeza-bump-nobump, awaiting test results.

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

@OCA-git-bot OCA-git-bot merged commit 77ec372 into OCA:16.0 Nov 4, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 697bc18. Thanks a lot for contributing to OCA. ❤️

@rrebollo
Copy link

rrebollo commented Nov 5, 2024

we can improve it later when used in real cases.

We have a customer being hit by this. We deployed OCA/account-financial-tools#1962 for them but if @yostashiro looks our code and PR description there and grant us this addon cover the same use case we are open to deploy this and we'll give U feedback about it.

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.

10 participants