Browse Source

[MIG][10.0] Migrate 'res_config_settings_enterprise_remove' (#665)

* [MIG][10.0] Migrate 'res_config_settings_enterprise_remove'

* [FIX] Use inherit to override 'res.config.settings'.

* [FIX] Remove upgrade_radio widget and group title

* [FIX] Improviments in code to remove upgrade fields

* [NEW] Remove enterprise upgrade from 'project config settings'

* [FIX] Add xpath to remove upgrade fields from 'General Settings'
pull/863/head
Michell Stuttgart 8 years ago
committed by Dave Lasley
parent
commit
cbe402e107
  1. 1
      res_config_settings_enterprise_remove/README.rst
  2. 2
      res_config_settings_enterprise_remove/__init__.py
  3. 6
      res_config_settings_enterprise_remove/__manifest__.py
  4. 2
      res_config_settings_enterprise_remove/models/__init__.py
  5. 80
      res_config_settings_enterprise_remove/models/res_config_settings.py

1
res_config_settings_enterprise_remove/README.rst

@ -45,6 +45,7 @@ Contributors
------------
* Brett Wood <bwood@laslabs.com>
* Michell Stuttgart <michellstut@gmail.com>
Maintainer
----------

2
res_config_settings_enterprise_remove/__init__.py

@ -2,4 +2,4 @@
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
from . import models

6
res_config_settings_enterprise_remove/__manifest__.py

@ -5,14 +5,14 @@
{
'name': 'Settings - Remove Enterprise Fields',
'summary': 'Remove fields in all settings views marked as enterprise',
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Maintenance',
'website': "https://laslabs.com",
'author': 'LasLabs, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'application': False,
'installable': False,
'depends': [
'base',
],
'application': False,
'installable': True,
}

2
res_config_settings_enterprise_remove/models/__init__.py

@ -2,4 +2,4 @@
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_config_settings
from . import res_config_settings

80
res_config_settings_enterprise_remove/models/res_config_settings.py

@ -2,22 +2,20 @@
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api
from odoo import api, models
from lxml import etree
from openerp.addons.base.res.res_config import \
res_config_settings
class ResConfigSettings(res_config_settings):
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
@api.model
def fields_view_get(self, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
ret_val = super(ResConfigSettings, self).fields_view_get(
view_id=view_id,
view_type=view_type,
context=context,
toolbar=toolbar,
submenu=submenu,
)
@ -30,21 +28,65 @@ class ResConfigSettings(res_config_settings):
queries += [
"//div[field[@name='module_account_reports' and \
@widget='upgrade_boolean']]",
"//div[field[@name='module_account_deferred_revenue' and \
@widget='upgrade_boolean']]",
"//div[field[@name='module_account_yodlee' and \
@widget='upgrade_boolean']]",
"//div[field[@name='module_account_plaid' and \
@widget='upgrade_boolean']]",
"//div[field[@name='module_account_bank_statement_import_qif' "
"and @widget='upgrade_boolean']]",
"//div[field[@name='module_account_bank_statement_import_ofx' "
"and @widget='upgrade_boolean']]",
"//div[field[@name='module_account_bank_statement_import_csv' "
"and @widget='upgrade_boolean']]",
"//div[field[@name='module_account_sepa' and \
@widget='upgrade_boolean']]",
"//div[field[@name='module_l10n_us_check_printing' and \
@widget='upgrade_boolean']]",
"//div[field[@name='module_account_reports_followup' and \
@widget='upgrade_boolean']]",
"//div[field[@name='module_account_batch_deposit' and \
@widget='upgrade_boolean']]",
@widget='upgrade_boolean']]",
"//div[field[@name='module_account_batch_deposit' and "
"@widget='upgrade_boolean']]",
]
elif page_name == 'sale settings':
queries += [
"//div[field[@name='module_crm_voip' and "
"@widget='upgrade_boolean']]/preceding-sibling::label[1]",
"//div[field[@name='module_crm_voip' and "
"@widget='upgrade_boolean']]",
"//group[@name='config_sign']",
"//div[field[@name='module_sale_contract' and "
"@widget='upgrade_boolean']]/preceding-sibling::label[1]",
"//div[field[@name='module_sale_contract' and "
"@widget='upgrade_boolean']]",
]
queries += [
"//div[div[field[@widget='upgrade_boolean']]] \
/preceding-sibling::label[1]",
"//div[div[field[@widget='upgrade_boolean']]]",
"//div[field[@widget='upgrade_boolean']] \
/preceding-sibling::label[1]",
"//div[field[@widget='upgrade_boolean']]",
"//field[@widget='upgrade_boolean']",
]
elif page_name == 'stock settings':
queries += [
"//group[@name='shipping']",
"//group[5]",
"//div[field[@name='module_stock_barcode' and "
"@widget='upgrade_boolean']]",
]
elif page_name == 'project settings':
queries += [
"//label[@for='id']",
"//field[@name='module_project_forecast']/ancestor::div[2]",
]
elif page_name == 'mrp settings':
queries += [
"//group[3]",
]
elif page_name == 'General Settings':
queries += [
"//label[@for='module_inter_company_rules']",
"//div[@name='inter_company']",
# "//field[@name='module_project_forecast']/ancestor::div[2]",
]
for query in queries:
for item in doc.xpath(query):

Loading…
Cancel
Save