Tryton - Issues

 

Message45638

Author ced
Recipients semarie
Date 2018-12-30.23:41:58
Content
You do not need to test backend to use filter_, python-sql manage that.
Instead of setting empty dict on result, you could just use a
defaultdict like this:

    result = defaultdict(defaultdict)

You could loop over the cursor dict instead of testing each name.

For payment_complete the SQL expression could use EVERY which is
standard (but we need to add a fallback in python-sql like
https://blog.jooq.org/2014/12/18/a-true-sql-gem-you-didnt-know-yet-the-every-aggregate-function/)

On 2018-12-25 10:20, Sebastien Marie wrote:
> and a question: in get_payment_aggregated() I am using:
>     cls(group_id).currency_digits
> to retreive the number of digits to quantize the amounts.
> 
> Should the method uses @fields.depends('currency_digits') decorator ?
> 
> I am unsure. The fields have the dependency to 'currency_digits' at class level, and the method is used for compute the value of the fields.

No depends can not be used on class method.
Indeed you need to round only for SQLite backend and it is better to use
groups instances for that to take advantage of the background cache and batch.
You can find an example in Invoice.get_amount

I do not think scenario_account_payment_invoice.rst need to be updated.
Having one scenario that test the new function fields is enough.
History
Date User Action Args
2018-12-30 23:41:58cedsetrecipients: + semarie
2018-12-30 23:41:58cedlinkissue7890 messages
2018-12-30 23:41:58cedcreate