Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] [MIG] base_export_manager: Migration to 16.0 #649

Closed
wants to merge 51 commits into from

Conversation

rjpathan
Copy link
Contributor

No description provided.

pedrobaeza and others added 30 commits April 25, 2023 00:26
* Improve UX for base_export_manager.

  - Improve user instructions in README.
  - Require some required fields.
  - Allow to select models from a list.
  - Allow to select up to 3 fields from dynamic lists.
  - Improve translations.
  - More tests.
  - Translate column labels.

  Some methods have been renamed, so version tag is raised to 8.0.2.0.0.

* Make inverse method be called at view time.
* Hardcode constraints in the `create` method instead of using normal ones.

  Depending on the context where the record is created, it gets `resource` or `model_id`. The problem is that Odoo checks constrains before inverses, so constrains would fail always.

  Test added to ensure future versions contemplate all use cases.

* Allow to reorder fields.
* Upgrade base_export_manager to v9
* Rename JS to base_export_manager
* Change osv_memory to transient for model_id domain
* Improve UX for base_export_manager.

  - Improve user instructions in README.
  - Require some required fields.
  - Allow to select models from a list.
  - Allow to select up to 3 fields from dynamic lists.
  - Improve translations.
  - More tests.
  - Translate column labels.

  Some methods have been renamed, so version tag is raised to 8.0.2.0.0.

* Hardcode constraints in the `create` method instead of using normal ones.

  Depending on the context where the record is created, it gets `resource` or `model_id`. The problem is that Odoo checks constrains before inverses, so constrains would fail always.

  Test added to ensure future versions contemplate all use cases.

* Allow to reorder fields.
[FIX][base_export_manager] Fix "Expected singleton" bug.

If you had a field that got translated in more than 1 addon, you'd possibly getto this error:

      File "/opt/odoo/0079_ahk_openerp/oca/base_export_manager/models/ir_exports_line.py", line 105, in _compute_label
        field.name)),
      File "/opt/odoo/common/openerp/v8/openerp/fields.py", line 825, in __get__
        record.ensure_one()
      File "/opt/odoo/common/openerp/v8/openerp/models.py", line 5355, in ensure_one
        raise except_orm("ValueError", "Expected singleton: %s" % self)
    except_orm: ('ValueError', 'Expected singleton: ir.translation(4899, 703976)')

With this patch, now we let Odoo return the translated string by using its
standard method to do so, so we have to care for less.

* Move installation outside a data file.

This makes the whole installation to be able to roll back if something goes
wrong, instead of entering an error loop.

* Include envorionment in its manager.

* Add 4th field

* Move to api.multi, refactoring some stuff.

- Add some comments in complex parts.
- Rename `onchange_name` to `_onchange_name` (guidelines).
- Make `_compute_name`'s try block shorter and easier to understand.

* Allow R/W of name directly in model.

* Update tests to cover new behaviors.
- Remove all possible translation commits
- Aesthetical changes
- Bump version
- Some new standards, such as split readme

Basically, nothing.
Currently translated at 80.0% (20 of 25 strings)

Translation: server-ux-11.0/server-ux-11.0-base_export_manager
Translate-URL: https://translation.odoo-community.org/projects/server-ux-11-0/server-ux-11-0-base_export_manager/da/
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-ux-12.0/server-ux-12.0-base_export_manager
Translate-URL: https://translation.odoo-community.org/projects/server-ux-12-0/server-ux-12-0-base_export_manager/
Currently translated at 100.0% (31 of 31 strings)

Translation: server-ux-12.0/server-ux-12.0-base_export_manager
Translate-URL: https://translation.odoo-community.org/projects/server-ux-12-0/server-ux-12-0-base_export_manager/pt/
Currently translated at 100.0% (31 of 31 strings)

Translation: server-ux-12.0/server-ux-12.0-base_export_manager
Translate-URL: https://translation.odoo-community.org/projects/server-ux-12-0/server-ux-12-0-base_export_manager/zh_CN/
oca-transbot and others added 16 commits April 25, 2023 00:26
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-ux-13.0/server-ux-13.0-base_export_manager
Translate-URL: https://translation.odoo-community.org/projects/server-ux-13-0/server-ux-13-0-base_export_manager/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-ux-13.0/server-ux-13.0-base_export_manager
Translate-URL: https://translation.odoo-community.org/projects/server-ux-13-0/server-ux-13-0-base_export_manager/
Currently translated at 100.0% (31 of 31 strings)

Translation: server-ux-14.0/server-ux-14.0-base_export_manager
Translate-URL: https://translation.odoo-community.org/projects/server-ux-14-0/server-ux-14-0-base_export_manager/es/
If not, we are not assigning the label value for the record and we get
a missing cache value error.
WARNING odoo.fields: Redundant default on ir.exports.line.model1_id
@rjpathan rjpathan force-pushed the 16.0-mig-base_export_manager branch from 7b512d9 to 1f95963 Compare April 25, 2023 04:38
@rjpathan rjpathan mentioned this pull request Apr 25, 2023
26 tasks
@kikopeiro
Copy link
Contributor

Here's what I tried:

  • I changed the configuration (Accesses Rights) for the res.partner.category (all accesses)
  • I still can access the export option over this model
  • Tested with not admin user

Did I miss something? V15 is working fine

What is reproduced is similar to what was discussed in this issue #474.

@rjpathan
Copy link
Contributor Author

rjpathan commented Jun 7, 2023

@kikopeiro sorry for late reply.

Export action button is disabled with a javascript function https://github.com/rjpathan/server-ux/blob/16.0-mig-base_export_manager/base_export_manager/static/src/js/base_export_manager.js
It seems this is not working in v16.

Sorry, I am not sure how to fix this as I don't have proficiency with the javascript.

@hugosantosred
Copy link
Member

hugosantosred commented Jun 8, 2023

@rjpathan I've opened a PR in your branch with the fix. In v16 the ListController is defined in OWL, so is needed to patch that controller in order to set the isExportEnable property

@rjpathan
Copy link
Contributor Author

rjpathan commented Jun 9, 2023

@hugosantosred Thanks for the fix.

@rjpathan rjpathan force-pushed the 16.0-mig-base_export_manager branch from 45d3d2d to b1573b4 Compare June 23, 2023 11:28
@stefan-tecnativa
Copy link
Contributor

You're pre-commit problem is related with the list_controller.js file. Two possible solutions could be:
1- Convert your code to ESM module (ECMAScript Modules)
2- Use requires to import objects from other files: https://github.com/OCA/OCB/blob/15.0/addons/account/static/src/js/account_payment_field.js#L5

Good Luck!

Copy link
Contributor

@kikopeiro kikopeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM (without code review)

@@ -142,8 +142,7 @@ def _inverse_name(self):
if any(parts):
# invalidate_cache -> in order to get actual value of field 'label'
# in function '_check_name'
self.invalidate_cache(ids=one.ids)
one._check_name()
self.env.invalidate_all()
Copy link
Contributor

@stefan-tecnativa stefan-tecnativa Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.browse(one.ids).invalidate_recordset()
one._check_name()

@pedrobaeza
Copy link
Member

Superseded by #702

@pedrobaeza pedrobaeza closed this Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.