[18.0][IMP] product_contract - add constraints#1316
[18.0][IMP] product_contract - add constraints#1316anthonissen-a wants to merge 2 commits intoOCA:18.0from
Conversation
|
Hi @sbejaoui, |
cfb98b3 to
fe0e004
Compare
yvaucher
left a comment
There was a problem hiding this comment.
Errors that will displayed to the user must be translatable.
ValidationError doesn't handle on itself the translation of the message. You must use env._ or from odoo import _
| return | ||
| if product.auto_renew_interval <= 0: | ||
| raise ValidationError( | ||
| f"Value of {product._fields['auto_renew_interval'].string}" |
There was a problem hiding this comment.
You want to make your error message translatable by wrapping them in env._ .
Be aware that vars included in the string will be evaluated inside the source string to translate.
https://www.odoo.com/documentation/18.0/developer/howtos/translations.html
What you want should be pretty close to this:
https://github.com/odoo/odoo/blob/18.0/addons/web_editor/models/ir_ui_view.py#L84-L88
| return | ||
| if product.termination_notice_interval < 0: | ||
| raise ValidationError( | ||
| f"Value of {product._fields['termination_notice_interval'].string}" |
08e1205 to
9065320
Compare
yvaucher
left a comment
There was a problem hiding this comment.
Thanks for the changes, LGTM
9065320 to
2bcf56c
Compare
|
Also added constraints to limit the range of:
|
2bcf56c to
4e4b846
Compare
mamcode
left a comment
There was a problem hiding this comment.
Thanks, these constraints are a very good contribution 👍🏼
|
This PR has the |
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Co-authored-by: Pedro M. Baeza <[email protected]>
Add 2 constraints to limit the range of: