Tuesday, April 16, 2024
2 changes
Resolved issues and error corrections
This fix resolves a critical error that occurred when restaurant staff zeroed out product quantities in POS orders before payment. The system was attempting a mathematical division by zero, causing the payment process to fail. The fix prevents this error by skipping the problematic calculation for items with zero quantity, allowing payments to process smoothly.
Original PR description
**Current behavior:** Adding a product to a POS order then zero-ing out the quantity of the line will result in an instance of division with this qty (now zero) in the denominator. **Expected…
**Current behavior:**
Adding a product to a POS order then zero-ing out the quantity
of the line will result in an instance of division with this qty
(now zero) in the denominator.
**Expected behavior:**
Don't allow a scenario to occur where 0 can appear in the
denominator of a division operation.
**Steps to reproduce:**
1. Switch to the demo German company installed with
`l10n_de_pos_res_cert`
2. Enable Fiskaly in the company settings for the German
company
3. Add a payment method in the POS config
3. Add a POS of type Restaurant and enable the TSS toggle
setting (comment out the `_l10n_de_fiskaly_iap_rpc()` call
in `l10n_de_pos_cert/models/pos_config.py` to save)
4. Add a floor and a table to the restaurant
5. Start a POS session and start an order, add some product
then select the order line and zero out the quantity with
the digital numpad
6. Go to payment -> register payment -> validate
7. Observe the error dialog
**Cause of the issue:**
In `l10n_de_pos_res_cert/models/pos_order.py`, the
`remove_from_ui` method calls `_line_differences()` if fiskaly
is setup for our German company which makes the call to
`_merge_order_lines()` where the following operation:
`str(group[0]['price_subtotal_incl']/group[0]['qty'])` may have
a denominator equal to 0.
**Fix:**
Do not call `_merge_order_lines()` on order lines which have a
quantity of zero.
opw-3751492
Forward-Port-Of: odoo/enterprise#60097This fix resolves memory errors that occurred when exporting large financial datasets in XAF format. The update optimizes how data is processed and streamed, allowing users with large databases (millions of records) to successfully complete exports without system crashes.
Original PR description
Currently, on large databases (several million move lines), the XAF export can cause a `MemoryError`. The way to bypass this limitation is threefold: 1. Reduce memory usage during query results post processing. - First by removing the unnecessary `res_list`, and directly writing each batch in former `vals_dict`. - Second by updating former `vals_dict` instead of creating an additional (and useless) `values` dictionary. 2. Instead of rendering the entire file at once, the process is now divided in two steps: - Render the header first using Qweb (as before). - Generate the journals, moves and move lines manually. 3. Use a generator and stream the content of the file to the user, which will prevent having the entire dataset/file in memory. task-3816030 opw-3332771 Forward-Port-Of: odoo/enterprise#60609 Forward-Port-Of: odoo/enterprise#58612