-
Notifications
You must be signed in to change notification settings - Fork 289
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
[MIG] default_warehouse_from_sale_team: Migration to 18.0 T#87470 #1689
[MIG] default_warehouse_from_sale_team: Migration to 18.0 T#87470 #1689
Conversation
80a3404
to
3d888b8
Compare
@rolandojduartem Please review. |
Man, this is PR is going to 17.0, could you change it, please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you fill the commit description, please?
To mention performed changes and provide references.
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0+e\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please regenerate translation file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
`here <https://github.com/Vauxoo/addons-vauxoo/issues/new?body=module:%20 | ||
default_warehouse_from_sale_team | ||
%0Aversion:%20 | ||
15.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
18.0
Check other references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
"sale_stock", | ||
"purchase_requisition", | ||
], | ||
"test": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This key is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@IrvingReyes Please, target 18.0 branch |
cc @imanie383 |
3d888b8
to
0f632d1
Compare
We already tested in a 18.0 version instance: |
Not applied yet:
|
sale_team_warehouse => default_warehouse_from_sale_team * Better test naming. * [IMP] Better module naming.
) This module formerly just add a default_warehouse field to the sales team model that is used to set the `warehouse_id` field in the sale order when the current user has defined a `Default Sale Team` We extend this functionality by: - Improve consistency: Add a constraint that do not let us to add a default sale team if the user do not belongs to the sales team. - Improve usability: Add an automated action/server action to update the user default sales team every time that a sales teams by: - add user's default sale team if empty. - remove default sale team from user if not longer in sale team. - dummy write to update m2m in users to make filtering rules work. - Extend scope: Now both stock picking and stock.picking type models also have default warehouse_id functionality taking into account the user default sale team. - Compatibility fix: in order to be compatible with one of our customers instances we remove the _auto = False for WarehouseDefault api. - New feature for Permissions and Security: Taking advantage of the default_warehouse field in the sales team model now we can filter the records (picking type and picking model) to only show those records that match with the user sale teams default_warehouse. To accomplish this I: - add new groups to manage the records access by user: * Default Warehouse / Limited access to pickings (filtered by sale teams) * Default Warehouse / Limited access to stock pickings (filtered by sale teams) * Default Warehouse / Access to all picking types (filtered by sale teams) * Default Warehouse / Access to all pickings (filtered by sale teams) - add new m2m field in the res.user model used in the new ir.rules. this onw is showed as a readonly field (only informative) to know the warehouse of the user. - add new ir.rule records, one for each default warehouse group. This one will let us to only show the records for the current user sale teams default_warehouse or to do not take into account the sale teams and show all the records to the user. Module version, description and Spanish translations were updated: missing translation template was added. Also the module was modified to follow OCA guideline: - models in one model file per model/module. default_warehouse_from_sale_team: defined 'picking_type_id' default as well from the sale team werahouse default_warehouse_from_sale_team: add test to validate pick type from sale team default_warehouse_from_sale_team: return limit 1 picking type by defualt to avoid 'Expected singleton' when create record default_warehouse_sale_team: add docstring to method default_warehouse_from_sale_team: Allow to management that users can see only the journals that match with the sale team default_warehouse_from_sale_team: deleted file not used apply pylint apply pylint default_warehouse_from_sale_team: propagate SUPERUSER_ID in read (Vauxoo#1042) * [IMP] default_warehouse_from_sale_team: propagate SUPERUSER_ID in read when user create from sale pickings chained in another warehouse without access to read. * [IMP] default_warehouse_from_sale_team: adapt to old and new api read * [IMP] default_warehouse_from_sale_team: adapt read to use has_group to validate in what user required SUPERUSER_ID. default_warehouse_from_sale_team: added rule to allow to see own warehouse by sale team default_warehouse_from_sale_team: Adding test unit for validation in policy from sale (Vauxoo#1064) * [IMP] default_warehouse_from_sale_team: add journal stock from sale team in journal entries of stock valuation * [ADD] validation police from sale order defined in sale team warehouse default_warehouse_from_sale_team: Move fields default_warehouse… (Vauxoo#1066) * [REF] default_warehouse_from_sale_team: Move fields default_warehouse and journal_team_ids to new page Settings warehouse from sale team. * [REF] default_warehouse_from_sale_team: Move field journal_stock_id to new page Settings warehouse from sale team. * [ADD] default_warehouse_from_sale_team: Adapt traslation. * [FIX] default_warehouse_from_sale_team: Fix pylint. default_warehouse_from_sale_team: Change field journal_team_ids to one2many. [ADD] default_warehouse_from_sale_team: Add field section_id in account_invoice model to reference sale teams. default_warehouse_from_sale_team: in order to allow search and see all record from fields remove selection widget to use origianl widget default_warehose_from_sale_team: Modify search of warehouse from the move Adding stock_picking_type.warehouse_id field to generate the policy while taking into consideration, the warehouse default_warehouse_from_sale_team: Modified view_picking_type_form view Adding attribute required in warehouse field default_warehouse_from_sale_team: adapt class to allow get sequence in base to sale tema in models like: * sale.order * purchase.order * purchase.requisition default_warehouse_from_sale_team: change data demo from data to demo addons-vauxoo: add disable message by duplicate methods default_warehouse_from_sale_team: Modified updated dictionary from super Modified updated dictionary from super method because warehouse_id default default_warehouse_from_sale_team: Modified updated dictionary from super Revert modified updated dictionary from super method because warehouse_id default default_warehouse_from_sale_team: add priority to get warehouse from warehouse of picking type of stock move because warehouse_id of stock move can be another different by stock move propagated like re-supply move from another warehouse default_warehouse_from_sale_team: get picking type from picking of move [IMP] default_warehouse_from_sale_team: migration to version11.0 [IMP] default_warehouse_from_sales_team: remove file unnecessary [IMP] default_warehouse_from_sales_team: remove method read unnecessary
…nce (Vauxoo#1290) * [ADD] default_warehouse_from_sale_team: Update get_id method in sequence * [ADD] default_warehouse_from_sale_team: Access Rule
…id (Vauxoo#1294) error by expected singleton
… get from the sale team
By merging the two Spanish language translation files we are solving the issue of duplicated terms on the translations of this module. Also changing some of the messages and translations of this module. And increasing the module version for this major change.
And deleting a term that is not need it.
When a user is created without a default sales team or if a user is being deleted the field `sale_team_id` will be set to False, the constraint will fail since the value False is not on the `sale_team_ids` list.
The method '_search_default_journal' was modified natively on [1], so it was modified in this module too, also, the method 'create' must be applied on batches. References: [1] odoo/odoo@d8d47f9
…lidation fields Closes Vauxoo#1477
…at create The self in the method create inheritance could be not empty, for example, using a recordset.copy(), in that case the self is not empty. Using the self.browse(), we will ensure that the self is empty, and the split create calls are made as expected.
This runs the translations autoformatter [1], which performs the following changes over .po files: - Sort terms alphabetically - Split lines to 78 characters - clear message when translated term is the same as original one This is done to produce a file as if it were re-exported from Odoo. For more info, see [2]. [1] OCA/odoo-pre-commit-hooks#76 [2] Vauxoo/pre-commit-vauxoo#104
Change the method previously used as a default value for the journal_id to retrieve the default journal to the new method defined to search the default journal.
- Adapt the use of name_get as part of [1]. - Change qty_done to quantity and picked = True as part of [2]. [1] odoo/odoo#122085 [2] odoo/odoo#137864
… rule when there is no warehouse parameter, like when is done by stock rules when the move destination location is for a different company https://github.com/Vauxoo/odoo/blob/8af8846c88bd04bcf3fa0bcbe4a720b415f994a4/addons/stock/models/stock_move.py#L830
Implement a hook to fill allowed sales teams in users that are already a member of any team. Since this module implements a feature to restrict which sales teams a user may be a member of, users that already belong to any team are configured to be allowed for those teams, to avoid inconsistencies between allowed and already-configured memberships. In other words, if a user already belongs to a team, it most likely means they should be allowed to belong to it, so allowance is granted.
We allow to bypass record rules related to sales teams when confirming a sale order, so deliveries may be created even if the involved routes belong to other warehouses the current user has no access to. This commit allows to extend those rules.
There was a rule to grant read-only access to pickings. However, the correct way to grant read-only access to a model is to uncheck the "Read" field on the desired rule, which would cause that rule to not be considered when verifying accesses.
Limited users are able to see some pickings in readonly mode, but there were some usability issues that are fixed in this commit: - It was possible to mark as TODo and check availability, because those actions don't require write access to the pickings. This is fixed by hiding involved buttons. - Even though validating a picking does require access, it's also hidden because there's no point on showing a button that can't be used anyway. - Similarly, the Print button is also hidden when the picking is not done yet, because it requires access to mark the picking as printed. - The Return button is also hidden. Even though it doesn't require write access to the current picking, it will require creation access on the new picking. - The Cancel button is not hidden because it requires being inventory administrator, which is not compatible with being a limited user.
… default journal set Use the cached value of the Sales Team field to access its value as a record. This avoids computing its value when it has not been computed yet, which could result in setting the wrong Sales Team on an invoice form creation. This issue occurs because the company is not yet set, and its value is required to determine the correct Sales Team [1]. [1]: https://github.com/odoo/odoo/blob/3884a60e/addons/sale/models/account_move.py#L41
… record exists Add a validation to avoid errors when accessing the cache without a record. The change ensures that the `team_id` value is only retrieved from the cache when a valid `account.move` record exists.
ee61087
to
4447244
Compare
@luisg123v Rebased, please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, just a few last comments regarding commit message:
You provided the same reference for all points, you should point the related commits or PRs, e.g.:
[1]: https://github.com/odoo/odoo/commit/a7450df4
[2]: https://github.com/odoo/odoo/pull/174844
[3]: https://github.com/odoo/odoo/commit/e401171c
On the other hand, this point:
The default_warehouse_from_sale_team.view_picking_form was modified to remove the is_editable field.
Is too technical , has a very long line and doesn't explain too much the why. Maybe something like:
- The field `is_editable` is removed from the picking form view, as
invisible fields are no longer required due to [4].
...
[4]: https://github.com/odoo/odoo/pull/137031
@IrvingReyes please update PR description so it matches the commit description. |
4447244
to
9b0f234
Compare
@luisg123v Thanks, man. Commit message and description updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last comment (I promise):
Reference is duplicated, the two first points use the same reference, so they both could use [1]
.
BTW, update PR description to remove indentation so list items and references are rendered correctly.
The following:
- The check_access_rights method was updated to check_access. [1]
[1]: https://github.com/odoo/odoo/pull/179148
Should be rendered as:
- The check_access_rights method was updated to check_access. 1
- The es.po translation file was updated. - The check_access_rights method was updated to check_access. [1] - The _filter_access_rules_python method was updated to _filtered_access. [1] - String translation calls using _() were replaced with self.env._(). [2] - Version numbers were updated from "17.0" to "18.0". - Tree views were updated to list views in templates. [3] - The field `is_editable` is removed from the picking form view, as invisible fields are no longer required due to [4]. [1]: odoo/odoo#179148 [2]: odoo/odoo#174844 [3]: odoo/odoo#159909 [4]: odoo/odoo#137031
9b0f234
to
1ba7e44
Compare
@luisg123v Changes Applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This PR is related to task#87,470
[MIG] default_warehouse_from_sale_team: Migration to 18.0
check_access_rights
method was updated tocheck_access
. 1_filter_access_rules_python
method was updated to_filtered_access
. 1_()
were replaced withself.env._()
. 2is_editable
is removed from the picking form view, asinvisible fields are no longer required due to 4.