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 version 16.0 #702

Merged
merged 35 commits into from
Aug 9, 2023

Conversation

stefan-tecnativa
Copy link
Contributor

cc @Tecnativa TT43220

This Pr superseeds: #649

@CarlosRoca13 @chienandalu please review!

Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

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

Functionally looks good to me. Some minor code comments:

(also, some commits can be squashed)

base_export_manager/models/ir_exports_line.py Outdated Show resolved Hide resolved
base_export_manager/models/ir_exports_line.py Outdated Show resolved Hide resolved
@pedrobaeza
Copy link
Member

Did you see #563 ?

@chienandalu
Copy link
Member

This superseeds a more complete PR. Anyway, it has a better approach to the invalidate_recordset approach is maybe more clear and self explanatory

@pedrobaeza
Copy link
Member

Then it's fair to credit the author of the first PR ever. What about rebasing this one over the other?

@chienandalu
Copy link
Member

Ok, it shouldn't be that hard to cherry-pick and resolve a pair of conflicts.

@stefan-tecnativa
Copy link
Contributor Author

Ok, it shouldn't be that hard to cherry-pick and resolve a pair of conflicts.

I see the situation, what I do then? Rebase this PR with the other one? Or I cherry-pick the migration commit of the other PR, resolve the conflicts and, eventually, squash this PR's migration commit maintaining the authorship?

@pedrobaeza
Copy link
Member

Save your current work, cherry pick the migration commit of the other PR, and put your relevant changes on it, doing another commit.

@chienandalu
Copy link
Member

Well, cherry pick both migration commits indeed, as you've got two contributors to keep credit to

@stefan-tecnativa
Copy link
Contributor Author

@chienandalu it's the history okay now? I will now review your comments

pedrobaeza and others added 19 commits August 4, 2023 10:11
* 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/
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/
@@ -29,52 +29,48 @@
<field name="model">ir.exports</field>
<field name="arch" type="xml">
<form string="Export Profile">
<sheet>
Copy link
Member

Choose a reason for hiding this comment

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

You're dismissing the changes of the previous commit here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the advice, now it should be correct

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 :+1 (without code review)

Thanks!

@pedrobaeza
Copy link
Member

/ocabot migration base_export_manager

@OCA-git-bot OCA-git-bot added this to the 16.0 milestone Aug 8, 2023
@OCA-git-bot OCA-git-bot mentioned this pull request Jul 13, 2023
26 tasks
@pedrobaeza
Copy link
Member

Please include #704

Steps to reproduce:

- Create an export profile in any model.
- Login with a user without setting permissions.
- Go to export popup on that model.
- Try to select the saved export profile.

You'll get an access error.

Using sudo for computed/related stuff linked to ir.model,  we avoid
the problem.

TT44721
Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

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

👍

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-702-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit b3009bf into OCA:16.0 Aug 9, 2023
4 of 6 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 856f9fa. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza deleted the 16.0-mig-base_export_manager branch August 9, 2023 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.