[9.0][IMP] Add res_config_settings_enterprise_remove - #546
Conversation
…ules into a single module.
|
Weren't you able at the end to remove all elements with the widget? |
|
@pedrobaeza here's an example: <group string="Shipping Connectors" name="shipping">
<label for="id" string="Carriers"/>
<div>
<div>
<field name="module_delivery_dhl" widget="upgrade_boolean"/>
<label for="module_delivery_dhl"/>
</div>
<div>
<field name="module_delivery_fedex" widget="upgrade_boolean"/>
<label for="module_delivery_fedex"/>
</div>
<div>
<field name="module_delivery_ups" widget="upgrade_boolean"/>
<label for="module_delivery_ups"/>
</div>
<div>
<field name="module_delivery_usps" widget="upgrade_boolean"/>
<label for="module_delivery_usps"/>
</div>
</div>
</group>Here, first the |
| =================================== | ||
|
|
||
| This module removes enterprise-only features from all account views. | ||
| This module removes enterprise-only features from all settings views. |
There was a problem hiding this comment.
I would add a note such as:
"This module does not remove the possibility to install the Enterprise modules: if necessary, all the code of Enterprise Edition is still available and can be manually installed via the Apps menu."
|
some details: other than that 👍 |
…at enterprise features can still be installed via Apps menu.
|
@BMW95 - Is there not always the same number of parents to an |
|
I think we can remove the parent div safely. |
|
@lasley @pedrobaeza Here's an idea. I didn't realize the return value from super contained a 'name' key which allows sorting by view name. What about if I took all the xpath queries from the single modules, added them to this one, and then filter by view name? That way each view has its own unique queries, and the only extra step is the initial filtering. Some upgrade fields are 2 divs deep, some 1 div, some 1 div with siblings that are not enterprise, some pages have different structures in different areas where the upgrade fields are, etc, so it does complicate things a bit unfortunately in terms of cleanup. |
|
@BMW95 - Bah that sucks (the situation not necessarily your idea which I don't fully understand). Do you have an example of one that had non-enterprise siblings? |
… to reduce amount of xpath queries.
399647c to
0c0643e
Compare
|
Here's a different approach to the problem as per the latest commit. Uses the exact same 6 queries on all pages, The only page that differed so much it needed 4 custom queries was account settings. @lasley link to that page here. Using Should improve quite a bit over the previous logic in terms of efficiency :) |
|
Why does the query need to be so specific though? |
|
@lasley Ah sorry my bad, wrong explanation on my part. The general queries are instead like so for most of the pages: Before those queries are run, depending on the page name, any custom queries I have defined will be run which are more specific, targeting <div>
<div>
<field name="module_account_reports" class="oe_inline" widget="upgrade_boolean"/>
<label for="module_account_reports"/>
</div>
<div name="group_multi_currency">
<field name="group_multi_currency" class="oe_inline"/>
<label for="group_multi_currency"/>
<group attrs="{'invisible': [('group_multi_currency', '<>', True)]}" col="2">
<group>
<field name="currency_exchange_journal_id"/>
</group>
<group>
</group>
</group>
</div>
<div>
<field name="group_analytic_accounting" class="oe_inline"/>
<label for="group_analytic_accounting"/>
</div>
<div>
<field name="module_account_asset" class="oe_inline"/>
<label for="module_account_asset"/>
</div>
<div>
<field name="module_account_budget" class="oe_inline"/>
<label for="module_account_budget"/>
</div>
<div>
<field name="module_account_tax_cash_basis" class="oe_inline"/>
<label for="module_account_tax_cash_basis" />
</div>
</div>The account settings page has about 50% of the fields 2 divs deep, and 50% 1 div deep. However in this snippet, the upgrade_boolean field is 2 divs deep, but I only want to remove its parent div, not grandparent. By default, Hope that clears things up :). |
…o reduce loops, complexity, and eliminate any risky xpath queries.
|
After studying further, refactored again which achieved the following:
Functionally tested, and ensured minimal risk of accidental xml tag removal should any parts of the settings pages change. Ready for final review. |
lasley
left a comment
There was a problem hiding this comment.
Much much cleaner. 👍 code+functional
Syncing from upstream OCA/server-tools (9.0)
Hey folks,
As per the discussion in pull request #499, I have merged all of the enterprise_remove modules into a single one and instead of marking the upgrade_boolean fields as invisible, they are now removed from the view. Overview of the process is as follows:
Because of the nature of this module, I took special care in constructing the xpath queries and functionally testing for issues. However should other modules use xpath queries that target any of those fields, this module could cause issues, so I made note of that in the readme.
Cheers,
Brett
@lasley