From 05949161aef49639bf39b97b32838d8f82912af9 Mon Sep 17 00:00:00 2001 From: VoicuStefan2001 Date: Fri, 17 Jan 2025 22:31:17 +0200 Subject: [PATCH] [17.0][UPD] record_type confirmation rights --- deltatech_record_type/__manifest__.py | 2 +- deltatech_record_type/i18n/ro.po | 28 ++++++++----------- deltatech_record_type/models/sale.py | 20 ++++--------- .../security/record_type_security.xml | 11 +++++--- 4 files changed, 25 insertions(+), 36 deletions(-) diff --git a/deltatech_record_type/__manifest__.py b/deltatech_record_type/__manifest__.py index da2321cd4..209a5801f 100644 --- a/deltatech_record_type/__manifest__.py +++ b/deltatech_record_type/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Terrabit - Record Type", "summary": "Manage multiple record types", - "version": "17.0.1.1.1", + "version": "17.0.1.1.2", "author": "Terrabit, Voicu Stefan", "website": "https://www.terrabit.ro", "category": "Generic Modules/Other", diff --git a/deltatech_record_type/i18n/ro.po b/deltatech_record_type/i18n/ro.po index 40a6c144f..8d3a0e2a7 100644 --- a/deltatech_record_type/i18n/ro.po +++ b/deltatech_record_type/i18n/ro.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 17.0+e\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-17 13:47+0000\n" -"PO-Revision-Date: 2025-01-17 13:47+0000\n" +"POT-Creation-Date: 2025-01-17 20:25+0000\n" +"PO-Revision-Date: 2025-01-17 20:25+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -26,9 +26,9 @@ msgid "Boolean" msgstr "" #. module: deltatech_record_type -#: model:res.groups,name:deltatech_record_type.group_create_order_without_record_type -msgid "Can Create Orders Without Record Type" -msgstr "Poate crea comenzi fără tip comandă" +#: model:res.groups,name:deltatech_record_type.group_confirm_order_without_record_type +msgid "Can Confirm Orders Without Record Type" +msgstr "Poate confirma comenzi fără tip comandă" #. module: deltatech_record_type #: model:ir.model.fields.selection,name:deltatech_record_type.selection__record_type_default_values__field_type__char @@ -132,7 +132,7 @@ msgstr "Tipuri comandă" #: model:ir.model,name:deltatech_record_type.model_purchase_order #: model:ir.model.fields.selection,name:deltatech_record_type.selection__record_type__model__purchase_order msgid "Purchase Order" -msgstr "Comandă de achiziție" +msgstr "Comandă achiziție" #. module: deltatech_record_type #: model:ir.model,name:deltatech_record_type.model_record_type @@ -154,7 +154,7 @@ msgstr "" #. module: deltatech_record_type #: model:ir.model.fields.selection,name:deltatech_record_type.selection__record_type__model__sale_order msgid "Sale Order" -msgstr "Comandă de vânzare" +msgstr "Comandă vânzare" #. module: deltatech_record_type #: model:ir.model,name:deltatech_record_type.model_record_type_default_values @@ -164,21 +164,15 @@ msgstr "Valori implicite tip comandă de vânzare" #. module: deltatech_record_type #: model:ir.model,name:deltatech_record_type.model_sale_order msgid "Sales Order" -msgstr "Comandă de vânzare" +msgstr "Comandă vânzare" #. module: deltatech_record_type #. odoo-python #: code:addons/deltatech_record_type/models/sale.py:0 #, python-format msgid "" -"You do not have the rights to create an order without specifying an Order " +"You do not have the rights to confirm an order without specifying an Order " "Type." msgstr "" -"Nu aveți drepturi pentru a crea o comandă fără a specifica un Tip comanda" - -#. module: deltatech_record_type -#. odoo-python -#: code:addons/deltatech_record_type/models/sale.py:0 -#, python-format -msgid "You do not have the rights to remove the Order Type from an order." -msgstr "Nu aveți drepturi pentru a elimina tipul de comandă dintr-o comandă" +"Nu aveți drepturi pentru a confirma o comandă fără a specifica un tip de " +"comandă." diff --git a/deltatech_record_type/models/sale.py b/deltatech_record_type/models/sale.py index 5716b6cc4..43eb82d26 100644 --- a/deltatech_record_type/models/sale.py +++ b/deltatech_record_type/models/sale.py @@ -7,22 +7,14 @@ class SaleOrder(models.Model): so_type = fields.Many2one("record.type", string="Order Type", tracking=True) - @api.model_create_multi - def create(self, vals_list): - for vals in vals_list: - if not self.env.user.has_group("deltatech_record_type.group_create_order_without_record_type"): - if not vals.get("so_type"): + def action_confirm(self): + for order in self: + if not self.env.user.has_group("deltatech_record_type.group_confirm_order_without_record_type"): + if not order.so_type: raise exceptions.UserError( - _("You do not have the rights to create an order without specifying an Order Type.") + _("You do not have the rights to confirm an order without specifying an Order Type.") ) - return super().create(vals_list) - - def write(self, vals): - for order in self: - if not self.env.user.has_group("deltatech_record_type.group_create_order_without_record_type"): - if "so_type" not in vals and not order.so_type: - raise exceptions.UserError(_("You do not have the rights to remove the Order Type from an order.")) - return super().write(vals) + return super().action_confirm() @api.onchange("so_type") def _onchange_so_type(self): diff --git a/deltatech_record_type/security/record_type_security.xml b/deltatech_record_type/security/record_type_security.xml index 82600706e..bae6e261e 100644 --- a/deltatech_record_type/security/record_type_security.xml +++ b/deltatech_record_type/security/record_type_security.xml @@ -1,9 +1,12 @@ - - - Can Create Orders Without Record Type + + + Can Confirm Orders Without Record Type - +