Closed edy1192 closed 4 years ago
Hi @luisg123v @moylop260 Could you check this, please?
Regards.
Hi @JulioSerna Could you check this please?
I made this PR to avoid the traceback that the user of DHM reported, (Vx issue 9479). I am going to create test instances for DHM and TyP which are the customers that I know have this module (in v11)
cc @luisg123v @moylop260
Why the user is using a big value?
For me a big value is disabling the feature really.
What about allow -1
in order to disable it?
If you can use an sql_constraint instead of an odoo constraint better using sql_constraint. It is faster and it allows to validate the database layer too. You can check similar examples here:
So you can create a check to validate -1 to 999999
values.
What do you think?
Could you add in the title the number of task/ticket of this change?
Check if the widget from fields definition allow use a particular quantity of digits in this case 6 In order to validate it from UI layer too. So you will have validate it from: GUI, DB, PY
Hi @moylop260
An SQL constraint wouldn't work here, because the involved field is company-dependent, so it's not stored, at least not in this table.
Hi @luisg123v You have a good point, thanks for clarify it.
@edy1192
Could you change simply the validation, please?
if not 0 < record.grace_payment_days < 999999: raise...
Question:
Why grace_payment_days
is a float instead of integer if it is talking number of days?
Question: Why
grace_payment_days
is a float instead of integer if it is talking number of days?
I was wondering the same when I noticed it :confused:
Dear customer, you have a grace period of 0.5 days
@hugho-ad Should we change to Integer instead of Float?
@JulioSerna your comments are welcome too!
Why grace_payment_days is a float instead of integer if it is talking number of days?
Hi @moylop260 Same question :( Maybe it's because the customer can have a day and a half or half a day? I don't know really.
Could you change simply the validation, please? if not 0 < record.grace_payment_days < 999999: raise...
Done
Could you add in the title the number of task/ticket of this change?
Done. It is worth mentioning that the ticket is closed because it was resolved by setting the field value to an acceptable value and the cause of the error was told to the client.
cc @luisg123v
Ok, I got it
Consider for another PR use a -1 value (I'm not sure yet. I need the opinion of @hugho-ad @JulioSerna @luisg123v)
...and the float to integer and force number of digits Low priority
@moylop260
Consider for another PR use a -1 value If you mean allowing
-1
as a valid value, it would be pointless, because with 0 the customer already has no gracing days, i.e. neets to pay immediately.
I'm more with attr size of the field
we can define the size of the field.Float as following https://github.com/odoo/odoo/blob/12.0/addons/l10n_it_edi/models/account_invoice.py#L42 and avoid user set more than 6 digits. (I don't know if decimals included, we must check)
Changing the Float by an integer it's a good option too, but I would prefer to keep it as Float because it gives us the chance to handle a portion of a day, including hours left, maybe if we take the decimals as the hours.
Regards!
AFAIK, @edy1192 tried using:
size=6
digits=(6, 2)
I'm more with attr size of the field
we can define the size of the field.Float as following https://github.com/odoo/odoo/blob/12.0/addons/l10n_it_edi/models/account_invoice.py#L42 and avoid user set more than 6 digits. (I don't know if decimals included, we must check)
Changing the Float by an integer it's a good option too, but I would prefer to keep it as Float because it gives us the chance to handle a portion of a day, including hours left, maybe if we take the decimals as the hours.
Regards!
Hi @hugho-ad
As @luisg123v comments, I did tests using size and digits but saw no change.
Here a video with my tests (data demo) https://youtu.be/-zxF-64eQ9I
Regards.
Since the grace_payment_days field is a float, in some cases the user can set really high values
(> 999999)
which causes the tracebackOverflowError: date value out of range
.Since that field is used for date operations in the debit_credit_maturity method of the
res.partner
model.issue
When the user see the contact, it gets the following traceback