Sunday, July 3, 2022
2 changes · master
Miscellaneous changes
Since odoo/enterprise#21825 a sale order is added in the context as "automatic" instead of a bool (in a test module generating test data) Since odoo/odoo#89141, if a recordset is compared to something else, a warning is logged. (changed to a "warnings" in odoo/odoo#94989) Because of 'Transaction.envs' being a Weakset, iteration on envs to find an existing one is randomized. All of that made some installation fail randomly with the following error. /data/build/odoo/odoo/api.py:
Original PR description
Since odoo/enterprise#21825 a sale order is added in the context as "automatic" instead of a bool (in a test module generating test data) Since odoo/odoo#89141, if a recordset is compared to…
Since odoo/enterprise#21825 a sale order is added in the context as
"automatic" instead of a bool (in a test module generating test data)
Since odoo/odoo#89141, if a recordset is compared to something else,
a warning is logged. (changed to a "warnings" in odoo/odoo#94989)
Because of 'Transaction.envs' being a Weakset, iteration on envs to find
an existing one is randomized.
All of that made some installation fail randomly with the following
error.
/data/build/odoo/odoo/api.py:511: UserWarning: unsupported operand type(s) for "==": 'sale.order()' == 'True'
...
File "/data/build/enterprise/test_sale_subscription/models/sale_order.py", line 57, in _test_demo_generate_subscriptions
subs_to_invoice._test_demo_create_invoices()
File "/data/build/enterprise/test_sale_subscription/models/sale_order.py", line 25, in _test_demo_create_invoices
self._create_recurring_invoice(automatic=automatic)
File "/data/build/enterprise/account_avatax_sale_subscription/models/sale_subscription.py", line 8, in _create_recurring_invoice
invoices = super()._create_recurring_invoice(automatic, batch_size)
File "/data/build/enterprise/sale_subscription/models/sale_order.py", line 1011, in _create_recurring_invoice
all_invoiceable_lines = all_subscriptions.with_context(recurring_automatic=automatic, line_zero_delivery=True)._get_invoiceable_lines(final=False)
File "/data/build/odoo/odoo/models.py", line 5495, in with_context
return self.with_env(self.env(context=context))
File "/data/build/odoo/odoo/api.py", line 571, in __call__
return Environment(cr, uid, context, su)
File "/data/build/odoo/odoo/api.py", line 511, in __new__
if env.args == args:
We may forbid adding record_set in the context
We may make envs iteration deterministic
Forward-Port-Of: odoo/enterprise#29054In case of a batch transaction, and if no total amount is provided, we cannot rely on the entry amount to compare with converted transaction amount. We should retrieve the entry details amount first and fallback on the entry amount. If not detailed amount is provided in the journal currency, then we should fallback on the generic return, but with adding the rate too to avoid returning a non-converted amount. opw-2895746 Forward-Port-Of: odoo/enterprise#29051 Forward-Port-Of: odoo/enterp
Original PR description
In case of a batch transaction, and if no total amount is provided, we cannot rely on the entry amount to compare with converted transaction amount. We should retrieve the entry details amount first and fallback on the entry amount. If not detailed amount is provided in the journal currency, then we should fallback on the generic return, but with adding the rate too to avoid returning a non-converted amount. opw-2895746 Forward-Port-Of: odoo/enterprise#29051 Forward-Port-Of: odoo/enterprise#28922