-
-
Notifications
You must be signed in to change notification settings - Fork 697
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] product_pricelist_simulation_margin: Migration to 16.0 #1354
[MIG] product_pricelist_simulation_margin: Migration to 16.0 #1354
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial review.
- could you take a look on the red CI ?
- ideally, adding a test could be great.
(I think you can recover code base here https://github.com/OCA/margin-analysis/blob/12.0/product_pricelist_margin/tests/test_module.py and adapt with the new name of the transient model).
readonly=True, | ||
) | ||
|
||
bg_color = fields.Char(compute="_compute_bg_color") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should remove bg_color and computation and so one. That was a try in V12, but in fact, the result is not good, and my user asked me to disable the backgrounds.
Not a blocking point. What do you think ?
Side question : |
hi @legalsylvain. I haven't finished migrating the module yet, I stopped for lunch and left the PR uploaded so as not to lose it. That's why I hadn't pinged you yet. I'm going to add the test and fix the pre-commit bugs. Regarding what you comment about 'bg_color', I agree with you, I don't see sense that this is still there, in my experience, I have never used it, nor do I find that it brings a great added value. Finally, in my opinion, the module should stay in this repository. |
Yes, being such tiny extension to a module being hosted here, it would be weird to not be located in the same place. |
sorry for the nagging! I was impatient...
👍
I think you can so remove it. Less code to maintain. |
db2ca77
to
2e1a8e6
Compare
@legalsylvain you are correct, I did not put the pr in draft. I have uploaded an update, it should be all correct. I am waiting for your feedback :) Best regards! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @legalsylvain, I haven't forgotten about this, but this week it has been impossible for me to get busy. I'll check it tomorrow! |
no problem ! take your time. Just ping me when you want a review. Thanks ! |
15d326b
to
8c8fa24
Compare
Hi @legalsylvain, how are you? I have made the changes you proposed, when you have time, can you check that everything works fine? Regards! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functional review. LGTM ! Thanks !
Some minor propositions inline.
regards.
) | ||
rslt.update( | ||
{ | ||
"pricelist_id": pricelist.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to return that value, as the super function return the value. See :
https://github.com/OCA/product-attribute/blob/16.0/product_pricelist_simulation/wizards/wizard_preview_pricelist.py#L59-L67
don't you think ?
_inherit = "wizard.preview.pricelist.line" | ||
_description = "wizard - Preview Pricelist Line" | ||
|
||
price_vat_excl = fields.Float(string="Unit Sales Price (Excl.)", readonly=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
price_vat_excl = fields.Float(string="Unit Sales Price (Excl.)", readonly=True) | |
price_vat_excl = fields.Monetary( | |
string="Unit Sales Price (Excl.)", | |
readonly=True, | |
currency_field="currency_id", | |
digits="Price", | |
) |
_description = "wizard - Preview Pricelist Line" | ||
|
||
price_vat_excl = fields.Float(string="Unit Sales Price (Excl.)", readonly=True) | ||
price_vat_incl = fields.Float(string="Unit Sales Price (Incl.)", readonly=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
price_vat_incl = fields.Float(string="Unit Sales Price (Incl.)", readonly=True) | |
price_vat_incl = fields.Monetary( | |
string="Unit Sales Price (Incl.)", | |
readonly=True, | |
currency_field="currency_id", | |
digits="Price", | |
) |
price_vat_excl = fields.Float(string="Unit Sales Price (Excl.)", readonly=True) | ||
price_vat_incl = fields.Float(string="Unit Sales Price (Incl.)", readonly=True) | ||
|
||
margin = fields.Float( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
margin = fields.Float( | |
margin = fields.Monetary( |
|
||
margin = fields.Float( | ||
store=True, | ||
digits=dp.get_precision("Product Price"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
digits=dp.get_precision("Product Price"), | |
digits="Price", | |
currency_field="currency_id", |
margin_percent = fields.Float( | ||
string="Margin (%)", | ||
store=True, | ||
digits=dp.get_precision("Product Price"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
digits=dp.get_precision("Product Price"), | |
digits="Price", |
|
||
from odoo import fields, models | ||
|
||
from odoo.addons import decimal_precision as dp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from odoo.addons import decimal_precision as dp |
8c8fa24
to
ded4554
Compare
Hi @legalsylvain! Thanks for the review. I have just made the changes. I have a question, what is the difference between creating a float field and adding the monetary widget or making the field 'monetary' directly? |
Float + digits will set allways the same number of digits. Not work in multi currency context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work !
Understood, thanks for the explanation @legalsylvain. @pedrobaeza can you check this pr? Thank you very much!! |
/ocabot migration product_pricelist_simulation_margin |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at bc0f253. Thanks a lot for contributing to OCA. ❤️ |
ADD new module product_pricelist_simulation_margin into version 16.0