[IMP] sale_timesheet: remove duplicate field definition
The field `project_time_mode_id` on res.company is already defined in project module. This came from the good old days where timesheet was not totally depending on project. In sale_timesheet, the field was redefined, and a hack with xml id was done. It is time to remove this crap.
This commit is contained in:
@@ -16,7 +16,6 @@ have real delivered quantities in sales orders.
|
||||
'website': 'https://www.odoo.com/page/warehouse',
|
||||
'depends': ['sale_management', 'hr_timesheet'],
|
||||
'data': [
|
||||
'data/sale_timesheet_data.xml',
|
||||
'views/account_invoice_views.xml',
|
||||
'views/sale_order_views.xml',
|
||||
'views/product_views.xml',
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<!-- sale_timesheet and project define the same field without depending on each, which causes the field to be deleted when the module that created it
|
||||
is deleted. To avoid this, we create xmlids manually for this field in both modules to prevent accidental deletion. To fix in saas-7 by moving the field definition-->
|
||||
<record id="duplicate_field_xmlid" model="ir.model.data">
|
||||
<field name="res_id" search="[('model','=','res.company'),('name','=','project_time_mode_id')]" model="ir.model.fields"/>
|
||||
<field name="model">ir.model.fields</field>
|
||||
<field name="module">sale_timesheet</field>
|
||||
<field name="name">project_time_mode_id_duplicate_xmlid</field>
|
||||
<field name="noupdate">True</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
</odoo>
|
||||
@@ -6,5 +6,4 @@ from . import account_invoice
|
||||
from . import hr
|
||||
from . import product
|
||||
from . import project
|
||||
from . import res_company
|
||||
from . import sale_order
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, api, fields
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
@api.model
|
||||
def _get_default_uom_id(self):
|
||||
return self.env.ref("product.product_uom_hour", raise_if_not_found=False)
|
||||
|
||||
project_time_mode_id = fields.Many2one('product.uom', 'Timesheet UoM', default=_get_default_uom_id)
|
||||
Reference in New Issue
Block a user