forked from OCA/purchase-workflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1371 from OCA/15.0
Syncing from upstream OCA/purchase-workflow (15.0)
- Loading branch information
Showing
16 changed files
with
471 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-12-22 19:34+0000\n" | ||
"PO-Revision-Date: 2024-02-14 16:41+0000\n" | ||
"Last-Translator: mymage <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
|
@@ -100,7 +100,7 @@ msgstr "" | |
#: model:ir.model.fields,field_description:purchase_request_tier_validation.field_purchase_request__validated | ||
#: model_terms:ir.ui.view,arch_db:purchase_request_tier_validation.view_purchase_request_filter | ||
msgid "Validated" | ||
msgstr "Approvato" | ||
msgstr "Approvata" | ||
|
||
#. module: purchase_request_tier_validation | ||
#: model:ir.model.fields,field_description:purchase_request_tier_validation.field_purchase_request__validated_message | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,16 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: \n" | ||
"PO-Revision-Date: 2023-07-24 20:25+0200\n" | ||
"Last-Translator: \n" | ||
"POT-Creation-Date: 2024-02-13 13:34+0000\n" | ||
"PO-Revision-Date: 2024-02-14 19:35+0000\n" | ||
"Last-Translator: Ivorra78 <[email protected]>\n" | ||
"Language-Team: \n" | ||
"Language: es_ES\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 3.0.1\n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: purchase_security | ||
#: model_terms:ir.ui.view,arch_db:purchase_security.purchase_team_form | ||
|
@@ -31,6 +31,11 @@ msgstr "" | |
msgid "Avatar" | ||
msgstr "Avatar" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model,name:purchase_security.model_res_partner | ||
msgid "Contact" | ||
msgstr "Contacto" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model.fields,field_description:purchase_security.field_purchase_team__create_uid | ||
msgid "Created by" | ||
|
@@ -98,6 +103,29 @@ msgstr "Equipos de compra" | |
msgid "Purchase Users" | ||
msgstr "Usuarios de compra" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model.fields,field_description:purchase_security.field_res_partner__purchase_user_id | ||
#: model:ir.model.fields,field_description:purchase_security.field_res_users__purchase_user_id | ||
#: model_terms:ir.ui.view,arch_db:purchase_security.view_res_partner_filter | ||
msgid "Purchase representative" | ||
msgstr "Representante de compra" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model.fields,field_description:purchase_security.field_res_partner__purchase_team_id | ||
#: model:ir.model.fields,field_description:purchase_security.field_res_users__purchase_team_id | ||
msgid "Purchase team" | ||
msgstr "Equipo de compra" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model.fields,field_description:purchase_security.field_res_users__purchase_team_ids | ||
msgid "Purchases Teams" | ||
msgstr "Equipos de compras" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model,name:purchase_security.model_ir_rule | ||
msgid "Record Rule" | ||
msgstr "Regla de Registro" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model.fields,field_description:purchase_security.field_purchase_team__sequence | ||
msgid "Sequence" | ||
|
@@ -118,6 +146,11 @@ msgstr "Usuario (pedidos propios)" | |
msgid "User (team orders)" | ||
msgstr "Usuario (pedidos del equipo)" | ||
|
||
#. module: purchase_security | ||
#: model:ir.model,name:purchase_security.model_res_users | ||
msgid "Users" | ||
msgstr "Usuarios" | ||
|
||
#. module: purchase_security | ||
#: model_terms:ir.ui.view,arch_db:purchase_security.purchase_team_form | ||
msgid "e.g. Europe" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
from . import ir_rule | ||
from . import purchase_order | ||
from . import purchase_team | ||
from . import res_partner | ||
from . import res_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from odoo import api, models, tools | ||
from odoo.osv import expression | ||
from odoo.tools import config | ||
|
||
|
||
class IrRule(models.Model): | ||
_inherit = "ir.rule" | ||
|
||
@api.model | ||
@tools.conditional( | ||
"xml" not in config["dev_mode"], | ||
tools.ormcache( | ||
"self.env.uid", | ||
"self.env.su", | ||
"model_name", | ||
"mode", | ||
"tuple(self._compute_domain_context_values())", | ||
), | ||
) | ||
def _compute_domain(self, model_name, mode="read"): | ||
"""Inject extra domain for restricting partners when the user | ||
has the group 'Purchase / User (own orders).""" | ||
res = super()._compute_domain(model_name, mode=mode) | ||
user = self.env.user | ||
group1 = "purchase_security.group_purchase_own_orders" | ||
group2 = "purchase_security.group_purchase_group_orders" | ||
group3 = "purchase.group_purchase_manager" | ||
if model_name == "res.partner" and not self.env.su: | ||
if user.has_group(group1) and not user.has_group(group3): | ||
extra_domain = [ | ||
"|", | ||
("message_partner_ids", "in", user.partner_id.ids), | ||
"|", | ||
("id", "=", user.partner_id.id), | ||
] | ||
if user.has_group(group2): | ||
extra_domain += [ | ||
"|", | ||
("purchase_team_id", "=", user.purchase_team_ids[:1].id), | ||
("purchase_team_id", "=", False), | ||
] | ||
else: | ||
extra_domain += [ | ||
"|", | ||
("purchase_user_id", "=", user.id), | ||
"&", | ||
("purchase_user_id", "=", False), | ||
"|", | ||
("purchase_team_id", "=", False), | ||
("purchase_team_id", "=", user.purchase_team_ids[:1].id), | ||
] | ||
extra_domain = expression.normalize_domain(extra_domain) | ||
res = expression.AND([extra_domain] + [res]) | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
purchase_user_id = fields.Many2one( | ||
comodel_name="res.users", | ||
domain="[('share', '=', False)]", | ||
string="Purchase representative", | ||
index=True, | ||
) | ||
purchase_team_id = fields.Many2one( | ||
comodel_name="purchase.team", | ||
string="Purchase team", | ||
index=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResUsers(models.Model): | ||
_inherit = "res.users" | ||
|
||
purchase_team_ids = fields.Many2many( | ||
comodel_name="purchase.team", | ||
relation="purchase_team_res_users_rel", | ||
column1="res_users_id", | ||
column2="purchase_team_id", | ||
string="Purchases Teams", | ||
check_company=True, | ||
copy=False, | ||
readonly=True, | ||
) |
Oops, something went wrong.