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][12.0] account_invoice_margin: Migration to v12.0 #66

Merged
merged 7 commits into from
Dec 9, 2019

Conversation

sergio-teruel
Copy link
Contributor

@sergio-teruel sergio-teruel commented Dec 4, 2019

cc @Tecnativa TT20158
@carlosdauden @chienandalu Canyou reviw?

@sergio-teruel sergio-teruel changed the title [WIP][MIG][12.0] account_invoice_margin: Migration to v12.0 [MIG][12.0] account_invoice_margin: Migration to v12.0 Dec 4, 2019
@sergio-teruel
Copy link
Contributor Author

Squashed administrative commits

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

Could you make a dependency to the module product_replenishment_cost and replace the line
purchase_price = self.product_id.standard_price
by
purchase_price = self.product_id.replenishment_cost

https://github.com/OCA/margin-analysis/tree/12.0/product_replenishment_cost

It will allow easy overload.

Thanks !

Otherwise, LGTM. Thanks for porting this usefull module.

@pedrobaeza
Copy link
Member

@legalsylvain sorry, but we don't want to introduce new dependencies for something not useful for us. There are 2 options:

  • Do a little hack looking if that fields is present and then using it, fallbacking to the other.
  • That you create a new glue module.

@legalsylvain
Copy link
Contributor

legalsylvain commented Dec 4, 2019

I understand, even if it is the objective of this OCA module is to harmonize, the use of standard_price.

Well, at least, could you just add a function to allow easily overload, avoiding to rewrite functions ?

Thanks.

Add :

def _get_standard_price(self):
    self.ensure_one()
    return self.product_id.standard_price

And :

purchase_price = self._get_standard_price()

@sergio-teruel
Copy link
Contributor Author

@legalsylvain Hi, I think that this changes would be done in a base module that returns the field or method to read price standard_price and other fields for analysis purposes and the other modules must denpend of this...
But I think that this PR is not the place to do that...
Maybe can you open an isuue to discuss it??

@legalsylvain
Copy link
Contributor

@sergio-teruel said :

and the other modules must denpend of this...

@pedrobaeza said :

sorry, but we don't want to introduce new dependencies

I see it a little bit contradictory.

@sergio-teruel : what about to implement my last proposal. I see it as very light change, without impact, and let developpers to overload the function as they want. If you have no time, I can do this little change, no problem.

@sergio-teruel sergio-teruel mentioned this pull request Dec 4, 2019
5 tasks
@pedrobaeza
Copy link
Member

pedrobaeza commented Dec 4, 2019

@legalsylvain it's not contradictory, because you are quoting just part of the reply. My colleague is proposing to open an issue for discussing the best way to implement it (as you know we always want the best in the ecosystem), but do it in the future (probably on v13), not now, due to time constraints.

The problem I see analyzing your proposal is that it's not possible to have a method (or not performant) on the invoice report: https://github.com/OCA/margin-analysis/pull/66/files#diff-d561cc05dc73b10d983544aff45e51e7R14

@legalsylvain
Copy link
Contributor

Hi, I think that I didn't explain correctly my request.
here is the PR : Tecnativa#1

i think that it is harmless, and allow customization, regarding purchase_price computation.

Is it OK for you ?

@pedrobaeza pedrobaeza added this to the 12.0 milestone Dec 4, 2019
@carlosdauden
Copy link
Contributor

@sergio-teruel the module product_replenishment_cost seems pretty basic to me.
Can you reinspect the module?

@pedrobaeza
Copy link
Member

@legalsylvain yes, I have mixed things about fields. I have merged your PR.

@pedrobaeza
Copy link
Member

@sergio-teruel this is missing the recent patch #64. Or is not needed anymore?

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

thanks !

LGTM. Code review. No test.

@carlosdauden
Copy link
Contributor

@pedrobaeza #64 is now in commit history

@pedrobaeza
Copy link
Member

#64 is removed again in the migration commit: ecb81bf

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.

Fix missing

sergio-teruel and others added 5 commits December 9, 2019 11:00
[UPD] README.rst

[UPD] Update account_invoice_margin.pot

Translated using Weblate (Spanish)

Currently translated at 100.0% (7 of 7 strings)

Translation: margin-analysis-11.0/margin-analysis-11.0-account_invoice_margin
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-11-0/margin-analysis-11-0-account_invoice_margin/es/
OCA-git-bot and others added 2 commits December 9, 2019 11:00
[FIX] account_invoice_margin: Set purchase_price when user has not set invoice margin security group set
@sergio-teruel
Copy link
Contributor Author

Now yes....

@pedrobaeza
Copy link
Member

/ocabot merge

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 12.0-ocabot-merge-pr-66-by-pedrobaeza-bump-no, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Dec 9, 2019
Signed-off-by pedrobaeza
@OCA-git-bot OCA-git-bot merged commit ebef67c into OCA:12.0 Dec 9, 2019
@OCA-git-bot
Copy link
Contributor

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

@legalsylvain
Copy link
Contributor

Seems that my commit (Tecnativa#1) has been lost in the last rebase. I don't understand why ?

@pedrobaeza pedrobaeza deleted the 12.0-mig-account_invoice_margin branch December 11, 2019 16:27
@pedrobaeza
Copy link
Member

@sergio-teruel you always have to do git pull before doing any other operation! I'm restoring the commit manually.

@legalsylvain
Copy link
Contributor

Thanks for your quick answer !

I'm restoring the commit manually.

No need. I'm currently working on a PR. I'll do it.

@pedrobaeza
Copy link
Member

OK, I'll wait then.

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.

5 participants