From 4a1ae0e58e19653cc7ed4aa101dee19731ce0647 Mon Sep 17 00:00:00 2001 From: yosa-odoo Date: Wed, 3 Apr 2024 13:47:39 +0200 Subject: [PATCH] [FIX] hr_expense: prevent unnecessary quantity assignment Steps to reproduce: - with demo data - go on expense report - open the report from marc demo - refresh Issue: New log note on each refresh Note: Issue happening only in 17 commit introducing the bug: https://github.com/odoo/odoo/commit/f261c83b0dbc27dacc9cd0e0d935d52626723dac opw-3817367 closes odoo/odoo#160327 Signed-off-by: Brice Bartoletti (bib) --- addons/hr_expense/models/hr_expense.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py index 6dcbfe88c28..7c779dc1cc1 100644 --- a/addons/hr_expense/models/hr_expense.py +++ b/addons/hr_expense/models/hr_expense.py @@ -281,7 +281,7 @@ class HrExpense(models.Model): expense.product_has_cost = expense.product_id and not expense.company_currency_id.is_zero(expense.product_id.standard_price) tax_ids = expense.product_id.supplier_taxes_id.filtered_domain(self.env['account.tax']._check_company_domain(expense.company_id)) expense.product_has_tax = bool(tax_ids) - if not expense.product_has_cost and expense.state in {'draft', 'reported'}: + if not expense.product_has_cost and expense.state in {'draft', 'reported'} and expense.quantity != 1: expense.quantity = 1 @api.depends('product_id.uom_id')