[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) <bib@odoo.com>
This commit is contained in:
yosa-odoo
2024-04-09 11:19:44 +00:00
parent b3fbbb5713
commit 4a1ae0e58e
+1 -1
View File
@@ -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')