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

[18.0][MIG] purchase_security: Migration to version 18.0 #2553

Open
wants to merge 38 commits into
base: 18.0
Choose a base branch
from

Conversation

Ricardo-MC
Copy link

No description provided.

joao-p-marques and others added 30 commits February 12, 2025 15:24
Create "Purchase (own orders)" group.
Restrict access to POs to those in the group.
Add tests.

TT26488
Currently translated at 100.0% (1 of 1 strings)

Translation: purchase-workflow-13.0/purchase-workflow-13.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_security/it/
When a Purchase User (own orders) create or edit an order, if changes
Representative user to another and save it, an access error is raised.
With this change, those users cannot change the default Representative,
then orders are initially assigned to them, and no errors were fired.
With this improvement, order lines are also restricted for Own Reponsible Users,
and this addon becomes more compatible with e.g. purchase_order_line_menu.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: purchase-workflow-16.0/purchase-workflow-16.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_security/
Currently translated at 100.0% (3 of 3 strings)

Translation: purchase-workflow-16.0/purchase-workflow-16.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_security/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: purchase-workflow-16.0/purchase-workflow-16.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_security/it/
- Fine-tune security rules.
- Put sequence on teams.
- Edit teams on tree.
- Convert purchase order team in computed writable.
- Use new_test_user in tests + useless lines for shorten code.
- Extra tests

[FIX] purchase_security: Fine-tune security rules

- PO lines domain was not adjusted
- Team rule doesn't need the second operand
Similar to sales_team_security, partners are restricted according to purchase permissions:
- User (own orders): If you are a follower of the partner or there is no user or you are the partner's user.
- User (team orders): If you are a follower of the partner or there is no user or you are a user of your purchasing team.
- Administrator: Without the restrictions of the other groups.

Add 'Purchase representative' (purchase_user_id) field to partners.
Add 'Purchase team' (purchase_team_id) field to partners.

TT47237
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: purchase-workflow-16.0/purchase-workflow-16.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_security/
Currently translated at 100.0% (27 of 27 strings)

Translation: purchase-workflow-16.0/purchase-workflow-16.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_security/it/
Deriman-Alonso and others added 7 commits February 12, 2025 15:24
[IMP] purchase_security/views/purchase_order_views.xml

Co-authored-by: Carlos Lopez <[email protected]>

[IMP] : pre-commit auto fixes
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: purchase-workflow-17.0/purchase-workflow-17.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-17-0/purchase-workflow-17-0-purchase_security/
Currently translated at 100.0% (26 of 26 strings)

Translation: purchase-workflow-17.0/purchase-workflow-17.0-purchase_security
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-17-0/purchase-workflow-17-0-purchase_security/es/
Specify `@api.onchange` on `onchange_partner_id()`, because without it, the native onchange isn't triggered (I don't know why) and some fields like `fiscal_position_id` and `payment_term_id` are never updated.

Others modules of purchase-workflow inherit `onchange_partner_id()` and set its onchange like this:
```@api.onchange("partner_id")```
Since the native one is:
@api.onchange('partner_id', 'company_id')
I honestly don't know why (excepted for "purchase_order_type", which divide them between two methods).

This issue is reproducible on runboat, but you need to use the "baseonly" database. If you install some modules like "purchase_partner_incoterm", it will work again.

I'm open to any better way to solve this issue
@Ricardo-MC Ricardo-MC mentioned this pull request Feb 12, 2025
33 tasks
@Ricardo-MC Ricardo-MC force-pushed the 18.0-mig-purchase_security branch from 65d59f8 to 5b2559f Compare February 12, 2025 21:12
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.