From 31ff6c68f4b49d5c12e2487d369a338c51f8997b Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Tue, 6 Oct 2015 14:33:20 +0200 Subject: [PATCH] [FIX] project, sale_timesheet: common field between non-dependent modules workaround The project and sale_timesheet modules both define a project_time_mode_id field on res.company but they are not dependent on each other. This causes problem because the first module that creates the field "wins" the xmlid and will delete the field on uninstall, regardless of the other module (which will then stop working until you do an update that will recreate the field). To work around this in a stable version, we manually create xmlids for the field in each module; on uninstall the field will not be deleted if an xmlid still refers it (which will be the case if the other module is installed). Inheriting fields from modules that are not dependent in a direct way (ancestor-child) is not supported, so normally you should use modularity to define the field in a parent module. Since 9.0 is a stable version, we need a small workaround. --- addons/project/project_data.xml | 12 +++++++++++- addons/sale_timesheet/__openerp__.py | 3 ++- .../sale_timesheet/data/sale_timesheet_data.xml | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 addons/sale_timesheet/data/sale_timesheet_data.xml diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 8ffc7ad91c1..c1d87077064 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -21,6 +21,17 @@ + + + + + ir.model.fields + project + project_time_mode_id_duplicate_xmlid + True + + @@ -319,6 +330,5 @@ - diff --git a/addons/sale_timesheet/__openerp__.py b/addons/sale_timesheet/__openerp__.py index 50c28f31857..042d3539326 100644 --- a/addons/sale_timesheet/__openerp__.py +++ b/addons/sale_timesheet/__openerp__.py @@ -17,7 +17,8 @@ have real delivered quantities in sales orders. 'author': 'OpenERP SA', 'website': 'https://www.odoo.com/page/warehouse', 'depends': ['sale', 'hr_timesheet'], - 'data': ['views/sale_timesheet_view.xml'], + 'data': ['views/sale_timesheet_view.xml', + 'data/sale_timesheet_data.xml'], 'demo': ['data/sale_timesheet_demo.xml'], 'installable': True, 'auto_install': True, diff --git a/addons/sale_timesheet/data/sale_timesheet_data.xml b/addons/sale_timesheet/data/sale_timesheet_data.xml new file mode 100644 index 00000000000..f0d5148a754 --- /dev/null +++ b/addons/sale_timesheet/data/sale_timesheet_data.xml @@ -0,0 +1,16 @@ + + + + + + + + ir.model.fields + sale_timesheet + project_time_mode_id_duplicate_xmlid + True + + + +