Skip to content

Commit

Permalink
[MIG] default_warehouse_from_sale_team: Migration to 18.0
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
IrvingReyes authored and luisg123v committed Feb 17, 2025
1 parent b086e5e commit 09c556a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion default_warehouse_from_sale_team/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ welcomed feedback
`here <https://github.com/Vauxoo/addons-vauxoo/issues/new?body=module:%20
default_warehouse_from_sale_team
%0Aversion:%20
15.0
18.0
%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_

Credits
Expand Down
3 changes: 1 addition & 2 deletions default_warehouse_from_sale_team/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
"website": "http://www.vauxoo.com",
"license": "LGPL-3",
"category": "Inventory/Inventory",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"depends": [
"sale_stock",
"purchase_requisition",
],
"test": [],
"data": [
"views/crm_team_views.xml",
"views/ir_sequence_views.xml",
Expand Down
22 changes: 18 additions & 4 deletions default_warehouse_from_sale_team/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-09 01:08+0000\n"
"PO-Revision-Date: 2023-03-09 01:08+0000\n"
"POT-Creation-Date: 2025-02-10 23:25+0000\n"
"PO-Revision-Date: 2025-02-10 23:25+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -103,6 +103,11 @@ msgstr "Equipo por defecto"
msgid "Default Warehouse"
msgstr "Almacén por defecto"

#. module: default_warehouse_from_sale_team
#: model:ir.model.fields,field_description:default_warehouse_from_sale_team.field_account_journal__display_name
msgid "Display Name"
msgstr "Nombre mostrado"

#. module: default_warehouse_from_sale_team
#: model:ir.model.fields,help:default_warehouse_from_sale_team.field_crm_team__default_warehouse_id
msgid ""
Expand All @@ -112,6 +117,11 @@ msgstr ""
"En este campo se puede definir el almacén por defecto para los usuarios "
"relacionados al equipo de ventas."

#. module: default_warehouse_from_sale_team
#: model:ir.model.fields,field_description:default_warehouse_from_sale_team.field_stock_picking__is_editable
msgid "Is Editable"
msgstr "Es editable"

#. module: default_warehouse_from_sale_team
#: model:ir.model.fields,help:default_warehouse_from_sale_team.field_crm_team__journal_stock_id
msgid ""
Expand All @@ -126,6 +136,11 @@ msgstr ""
msgid "Journal"
msgstr "Diario"

#. module: default_warehouse_from_sale_team
#: model:account.journal,name:default_warehouse_from_sale_team.journal_default_team
msgid "Journal Default Warehouse"
msgstr "Diario Almacén por defecto"

#. module: default_warehouse_from_sale_team
#: model:ir.model,name:default_warehouse_from_sale_team.model_account_move
msgid "Journal Entry"
Expand Down Expand Up @@ -229,7 +244,6 @@ msgstr "Movimiento de existencias"
#. module: default_warehouse_from_sale_team
#. odoo-python
#: code:addons/default_warehouse_from_sale_team/models/res_users.py:0
#, python-format
msgid "The chosen team (%s) is not in the allowed sales teams for this user"
msgstr ""
"El equipo de venta seleccionado (%s) no está entre los equipos permitidos "
Expand Down
2 changes: 1 addition & 1 deletion default_warehouse_from_sale_team/models/ir_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def next_by_code(self, sequence_code, sequence_date=None):
if "sequence_salesteam_id" not in self.env.context:
return super().next_by_code(sequence_code, sequence_date)
salesteam_id = self.env.context["sequence_salesteam_id"]
self.check_access_rights("read")
self.check_access("read")
company_id = self.env.company.id
sequence = self.search(
[
Expand Down
4 changes: 2 additions & 2 deletions default_warehouse_from_sale_team/models/res_users.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError


Expand All @@ -22,7 +22,7 @@ def _check_section_id(self):
user_wrong_team = self.filtered(lambda u: u.sale_team_id - u.sale_team_ids)
if user_wrong_team:
raise ValidationError(
_(
self.env._(
"The chosen team (%s) is not in the allowed sales teams for this user",
user_wrong_team[0].sale_team_id.name,
)
Expand Down
2 changes: 1 addition & 1 deletion default_warehouse_from_sale_team/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class StockPicking(models.Model):
@api.depends_context("uid")
def _compute_is_editable(self):
# Using intersection operator to keep original env
editable_records = self & self._filter_access_rules_python("write")
editable_records = self & self._filtered_access("write")
editable_records.is_editable = True
(self - editable_records).is_editable = False

Expand Down
2 changes: 1 addition & 1 deletion default_warehouse_from_sale_team/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _access_unallowed_current_user_salesteams(self):
return (
warehouses
and not self.env.su
and warehouses.check_access_rights("read", raise_exception=False)
and warehouses.check_access("read", raise_exception=False)
and failed_rules
and not failed_rules - allowed_rules
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml">
<field name="show_reserved" position="after">
<field name="is_editable" invisible="True" />
</field>
<button name="action_confirm" position="attributes">
<attribute name="invisible" add="not is_editable" separator=" or " />
</button>
Expand Down

0 comments on commit 09c556a

Please sign in to comment.