This commit avoids a traceback when trying to install hr_timesheet post to "hours" uom deletion. Steps ===== - Install module sale_management - In Settings > Sales > Product Catalog section, activate the option Units of Measure - Go to Units of Measure configuration menu - Remove the unit of measure "Hours" - Install hr_timesheet Issue ===== A traceback appears indicating: "Cannot update missing record 'uom.product_uom_hour'" Cause ===== Since https://github.com/odoo/odoo/commit/ab76c421c279b26195396b61e66b3e8853785226, deletion of system uom is prohibited. An exception exists for uom "Hours" that can be deleted without warning. This exception is removed inside hr_timesheet as this uom is needed in this module. However, it can still be deleted prior to hr_timesheet installation. When it is deleted, the installation of hr_timesheet raises a traceback as the data file hr_timesheet_data tries to access and update this record. Fix === Before updating the record uom "hours" in the data file, a call to a method ensure_iom_hours is made. This method recreate this uom if it does not exist in the database anymore. task-3551315 closes odoo/odoo#141572 X-original-commit: 0d520e5e7c4b8b17ab1865a3010bbce87a71ec62 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
26 lines
794 B
XML
26 lines
794 B
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Set the JS widget -->
|
|
<record id="uom.product_uom_day" model="uom.uom">
|
|
<field name="timesheet_widget">float_toggle</field>
|
|
</record>
|
|
|
|
<function model="account.analytic.line" name="_ensure_uom_hours"/>
|
|
|
|
<record id="uom.product_uom_hour" model="uom.uom">
|
|
<field name="timesheet_widget">float_time</field>
|
|
</record>
|
|
|
|
<!-- Force Analytic account creation for projects allowing timesheet (default is True) -->
|
|
<function
|
|
model="project.project"
|
|
name="_init_data_analytic_account"
|
|
eval="[]"/>
|
|
|
|
<record id="internal_project_default_stage" model="project.task.type">
|
|
<field name="sequence">1</field>
|
|
<field name="name">Internal</field>
|
|
</record>
|
|
|
|
</odoo>
|