[FIX] hr_expense: set 'name' and 'expense_line_ids' during report creation

Steps to reproduce
- Install Accounting
- Create user and employee, "user_acc", with Accounting-Accounting and no Expense rights
- Take the expense in "To Submit" state for the employee different than user_acc and create report
- Save the report.

Bug - We get the error that required field 'name' is not set and expense lines disappear.

task - 3099142

closes odoo/odoo#107903

X-original-commit: c5765be58dcdb3f6d766e6ce409a6e0f8a82e45b
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
sofiagvaladze
2022-12-14 09:34:55 +01:00
parent ed2a9c3a78
commit 7a6b903830
+3 -2
View File
@@ -717,7 +717,7 @@
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="e.g. Trip to NY" attrs="{'readonly': [('is_editable', '=', False)]}"/>
<field name="name" placeholder="e.g. Trip to NY" attrs="{'readonly': [('is_editable', '=', False)]}" force_save="1"/>
</h1>
</div>
<group>
@@ -745,7 +745,8 @@
domain="[('state', '=', 'draft'), ('employee_id', '=', employee_id), ('company_id', '=', company_id)]"
options="{'reload_on_button': True}"
context="{'form_view_ref' : 'hr_expense.hr_expense_view_form_without_header', 'default_company_id': company_id, 'default_employee_id': employee_id}"
attrs="{'readonly': [('is_editable', '=', False)]}">
attrs="{'readonly': [('is_editable', '=', False)]}"
force_save="1">
<tree decoration-danger="is_refused" editable="bottom" class="o_expense_line_list">
<field name="date" optional="show"/>
<field name="product_id"/>