Friday, November 15, 2024
5 changes · saas-17.4
Resolved issues and error corrections
Price comparisons in the online shop now appear only when a pricelist rule represents an actual discount, instead of showing for fixed-price or formula rules that are not discounts. This avoids misleading shoppers with crossed-out prices while still highlighting genuine promotional discounts where appropriate.
Original PR description
**Steps:** - Create a new pricelist - Apply pricelist rules - For eg: Apply it on Acoustic Bloc Screen, with a fixed price of 20. - When seen on the shop page or product page, it shows a…
**Steps:** - Create a new pricelist - Apply pricelist rules - For eg: Apply it on Acoustic Bloc Screen, with a fixed price of 20. - When seen on the shop page or product page, it shows a strikethrough price along with the original price - Same happens when we use formula instead of fixed price. **Changes:** Changed some test cases because currently, the pricelist had fixed price which was causing the strikethrough to not appear. But due to the code change, it will now not appear, hence giving the percentage price to the tour to run it smoothly. **Before this commit:** The strikethrough prices on the shop page were shown for all the pricelist rules **After this commit:** The strikethrough prices are now shown everywhere only if the pricelist rule is a 'discount'. Formula based discount rules strikethrough prices are also displayed on the shop/configurator and product pages, but not on the cart and subsequent steps of the checkout to allow customer to apply discounts while still keeping 'beautiful' prices. **Affected version:** saas-17.4~master opw-4181825
This fix prevents errors when posting messages that include @mentions in certain multi-company chatter conversations. It ensures notifications are prepared safely so users can mention colleagues without triggering a crash.
Original PR description
Follow-up of https://github.com/odoo/odoo/pull/185583 PR above fixed an issue that results in a traceback when posting a message with `@`mention in multi-company. This happens because a message post…
Follow-up of https://github.com/odoo/odoo/pull/185583
PR above fixed an issue that results in a traceback when posting a message with `@`mention in multi-company. This happens because a message post with `@`mention notifies the recipients of new message in their inbox, but the computing of this notification was made in the context of the recipient but with `allowed_company_ids` of the person that sends the message. If the recipient does not have access to the `allowed_company_ids` of the sender then this leads to the crash that PR above fixes.
The PR fixed it by removing the `allowed_company_ids` from the context, with `allowed_company_ids=None`. However, some code inspect presence of `ctx.allowed_company_ids` with the following code:
```py
len(self.env.context.get('allowed_company_ids', [])) <= 1
```
Due to `allowed_company_ids` being present as `None`, code attempts to `len(None)` which is invalid thus it crashes.
This commit fixes the issue by passing `[]` as allowed_company_ids. This is semantically the same as passing no `allowed_company_ids` but it prevents crash from the pattern above.
opw-4231529Point of Sale now sends only changed order lines to the server, so existing lines are no longer accidentally removed when they were not part of the latest device update. This reduces the risk of lost order information, especially when multiple devices update the same table or order at the same time.
Original PR description
*: pos_sale, pos_loyalty, pos_restaurant, pos_event Before all lines was sent to the backend to be processed, if the backend had a line that wasn't sent by the frontend, it was removed from the order. Now the frontend sends only modified lines to the backend, if a line is deleted from the frontend, it will be deleted from the backend too. But the backend doesn't remove lines that weren't sent by the frontend. This change was made to avoid losing information when the backend delete a line that wasn't sent by the frontend. Cherry-picked from bdd57e0576ad2c061494676325a26644a8427c5e
This fixes an issue where edited restaurant Point of Sale orders could lose their assigned sales team. Sales reporting by team will now place those orders under the correct team instead of grouping them under "None".
Original PR description
When modifying an existing order in the PoS the sales team would be unset. Steps to reproduce: ------------------- * Open a table and add some items to it * Leave the table and go back on it 2 times * Validate the order > Observation: Go on the sale report and group by sale team, your order will appear under the "None" section Why the fix: ------------ We make sure that when we write on the order we will the values of the crm team defined on the pos config opw-4232473 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This update fixes a reporting issue where Profit and Loss reports grouped by Analytic could fail when custom accounting fields used uppercase names or overlapped with analytic field names. It helps ensure reports and upgrades work reliably for databases customized with Studio or manual fields.
Original PR description
It defeats the purpose to use `SQL` with f-strings. We observed that if there is an uppercase letter in field names we get an error. Steps to reproduce: 1. Install account_reports 2. Add a manual…
It defeats the purpose to use `SQL` with f-strings. We observed that if there is an uppercase letter in field names we get an error. Steps to reproduce:
1. Install account_reports
2. Add a manual field `x_M` to `account.move.line`
3. Open Profit and Loss report
4. Group by Analytic.
Error (edited to reduce space):
```
2024-11-13 11:12:53,437 1855548 ERROR test_17.4 odoo.sql_db: bad query:
-- Create a temporary table, dropping not null constraints because we're not filling those columns
CREATE TEMPORARY TABLE IF NOT EXISTS analytic_temp_account_move_line () inherits (account_move_line) ON COMMIT DROP;
ALTER TABLE analytic_temp_account_move_line NO INHERIT account_move_line;
ALTER TABLE analytic_temp_account_move_line DROP CONSTRAINT IF EXISTS account_move_line_check_amount_currency_balance_sign;
ALTER TABLE analytic_temp_account_move_line ALTER COLUMN move_id DROP NOT NULL;
ALTER TABLE analytic_temp_account_move_line ALTER COLUMN currency_id DROP NOT NULL;
INSERT INTO analytic_temp_account_move_line (...)
SELECT account_move_line.company_id AS "account_move_line.company_id",... to_jsonb(UNNEST(ARRAY[account_analytic_line.account_id, x_plan2_id, x_plan3_id])) AS "account_move_line.analytic_distribution", ... account_move_line.x_M AS "account_move_line.x_M", ...
FROM account_analytic_line
LEFT JOIN account_move_line
ON account_analytic_line.move_line_id = account_move_line.id
WHERE
account_analytic_line.general_account_id IS NOT NULL;
-- Create a supporting index to avoid seq.scans
CREATE INDEX IF NOT EXISTS analytic_temp_account_move_line__composite_idx ON analytic_temp_account_move_line (analytic_distribution, journal_id, date, company_id);
-- Update statistics for correct planning
ANALYZE analytic_temp_account_move_line
ERROR: column account_move_line.x_m does not exist
LINE 10: ... AS "account_move_line.discount_amount_currency", account_mo...
^
HINT: Perhaps you meant to reference the column "account_move_line.x_M".
```
After this patch the same query is:
```
-- Create a temporary table, dropping not null constraints because we're not filling those columns
CREATE TEMPORARY TABLE IF NOT EXISTS analytic_temp_account_move_line () inherits (account_move_line) ON COMMIT DROP;
ALTER TABLE analytic_temp_account_move_line NO INHERIT account_move_line;
ALTER TABLE analytic_temp_account_move_line DROP CONSTRAINT IF EXISTS account_move_line_check_amount_currency_balance_sign;
ALTER TABLE analytic_temp_account_move_line ALTER COLUMN move_id DROP NOT NULL;
ALTER TABLE analytic_temp_account_move_line ALTER COLUMN currency_id DROP NOT NULL;
INSERT INTO analytic_temp_account_move_line (...)
SELECT "account_move_line"."company_id" AS "account_move_line.company_id", ... "account_move_line"."x_M" AS "account_move_line.x_M", ... to_jsonb(UNNEST(ARRAY["account_analytic_line"."account_id", "account_analytic_line"."x_plan2_id", "account_analytic_line"."x_plan3_id"])) AS "account_move_line.analytic_distribution", ...
FROM account_analytic_line
LEFT JOIN account_move_line
ON account_analytic_line.move_line_id = account_move_line.id
WHERE
account_analytic_line.general_account_id IS NOT NULL;
-- Create a supporting index to avoid seq.scans
CREATE INDEX IF NOT EXISTS analytic_temp_account_move_line__composite_idx ON analytic_temp_account_move_line (analytic_distribution, journal_id, date, company_id);
-- Update statistics for correct planning
ANALYZE analytic_temp_account_move_line
```
A similar issue can be triggered if we add a manual field `x_plan2_id` to `account.move.line`:
```
ERROR: column reference "x_plan2_id" is ambiguous
LINE 10: ...nb(UNNEST(ARRAY[account_analytic_line.account_id, x_plan2_id...
```
Both issues are fixed here.
This was observed during upgrades. Mainly due to studio fields being generated with uppercase letters. Still, as shown above, it also fails for manual fields.