Replace the administration group by a flag on the user

This commit is contained in:
Nicolas Évrard committed 2026-09-13 17:28:32 +02:00
1 parent 1e778036ce
commit 305301a53e
128 files changed
+1045 -1362

No files matched your search

+17
View File
@@ -24,6 +24,14 @@ a database from another series.
Before
~~~~~~
* Remove hard-coded admin user and add root user:
.. code-block:: SQL
DELETE FROM "ir_model_data" WHERE module = 'res' AND fs_id = 'user_admin';
INSERT INTO ir_model_data (fs_id, model, module, db_id, noupdate, field_names) VALUES
('user_root', 'res.user', 'res', 0, False, '["login", "name", "active", "administrator"]');
* If the ``trytond-worker`` is configured, stop it and finish all dequeued
tasks:
@@ -36,6 +44,15 @@ Before
After
~~~~~
* Set the administrator flag on the ``admin`` user:
.. code-block:: SQL
UPDATE "res_user" SET administrator = true WHERE login IN ('root', 'admin');
.. note::
Include in the clause all the users' login that are administrators.
* If ``account`` module is activated, update the reconciliation date using
maturity date:
-8
View File
@@ -10,14 +10,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Accounting Administration</field>
<field name="parent" ref="group_account"/>
</record>
<record model="res.user-res.group" id="user_admin_group_account">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_account"/>
</record>
<record model="res.user-res.group" id="user_admin_group_account_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_account_admin"/>
</record>
<record model="ir.ui.icon" id="account_icon">
<field name="name">tryton-account</field>
-10
View File
@@ -75,11 +75,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_account_move">
<field name="name">Account Move</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_move_group_admin">
<field name="sequence_type" ref="sequence_type_account_move"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_move_group_account_admin">
<field name="sequence_type" ref="sequence_type_account_move"/>
@@ -154,11 +149,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_account_move_reconciliation">
<field name="name">Account Move Reconciliation</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_move_reconciliation_group_admin">
<field name="sequence_type" ref="sequence_type_account_move_reconciliation"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_move_reconciliation_group_account_admin">
<field name="sequence_type" ref="sequence_type_account_move_reconciliation"/>
-5
View File
@@ -80,11 +80,6 @@
<record model="ir.sequence.type" id="sequence_type_asset">
<field name="name">Asset</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_asset_group_admin">
<field name="sequence_type" ref="sequence_type_asset"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_asset_group_account_admin">
<field name="sequence_type" ref="sequence_type_asset"/>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_budget">
<field name="name">Account Budget</field>
</record>
<record model="res.user-res.group" id="user_admin_group_budget">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_budget"/>
</record>
<menuitem
name="Budgets"
parent="account.menu_account"
-5
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_credit_limit">
<field name="name">Account Credit Limit</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_credit_limit">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_credit_limit"/>
</record>
<record model="ir.ui.view" id="configuration_view_form">
<field name="model">account.configuration</field>
+2 -1
View File
@@ -74,7 +74,8 @@ class Party(metaclass=PoolMeta):
if user_id == 0:
return True
user = User(user_id)
return origin and group in user.groups
return origin and (group in user.groups
or User.is_administrator(user_id))
for model in self._credit_limit_to_lock():
Model = pool.get(model)
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_dunning">
<field name="name">Dunning</field>
</record>
<record model="res.user-res.group" id="user_admin_group_dunning">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_dunning"/>
</record>
<menuitem
name="Dunnings"
-5
View File
@@ -392,11 +392,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_account_invoice">
<field name="name">Invoice</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_invoice_group_admin">
<field name="sequence_type" ref="sequence_type_account_invoice"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_invoice_group_account_admin">
<field name="sequence_type" ref="sequence_type_account_invoice"/>
-20
View File
@@ -11,19 +11,9 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_payment">
<field name="name">Payment</field>
</record>
<record model="res.user-res.group" id="user_admin_group_payment">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_payment"/>
</record>
<record model="res.group" id="group_payment_approval">
<field name="name">Payment Approval</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_payment_approval">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_payment_approval"/>
</record>
<menuitem
name="Payments"
@@ -194,12 +184,6 @@ this repository contains the full copyright notices and license terms. -->
id="sequence_type_account_payment_group">
<field name="name">Account Payment Group</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_payment_group_group_admin">
<field name="sequence_type"
ref="sequence_type_account_payment_group"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_payment_group_group_account_admin">
<field name="sequence_type"
@@ -547,10 +531,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_account_payment">
<field name="name">Account Payment Group</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_account_payment_group_admin">
<field name="sequence_type" ref="sequence_type_account_payment"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_account_payment_group_account_admin">
<field name="sequence_type" ref="sequence_type_account_payment"/>
<field name="group" ref="account.group_account_admin"/>
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_account_payment_check">
<field name="name">Account Payment Check</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_account_payment_check_group_admin">
<field name="sequence_type" ref="sequence_type_account_payment_check"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_account_payment_check_group_account_admin">
<field name="sequence_type" ref="sequence_type_account_payment_check"/>
<field name="group" ref="account.group_account_admin"/>
-5
View File
@@ -160,11 +160,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">SEPA Mandate</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_mandate_group_admin">
<field name="sequence_type" ref="sequence_type_mandate"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_mandate_group_account_admin">
<field name="sequence_type" ref="sequence_type_mandate"/>
-4
View File
@@ -7,10 +7,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Account Product Administration</field>
<field name="parent" ref="product.group_product_admin"/>
</record>
<record model="res.user-res.group" id="user_admin_group_account_product_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_account_product_admin"/>
</record>
<record model="ir.ui.view" id="create_chart_properties_view_form">
<field name="model">account.create_chart.properties</field>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_statement">
<field name="name">Statement</field>
</record>
<record model="res.user-res.group" id="user_admin_group_statement">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_statement"/>
</record>
<menuitem
name="Statements"
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_landed_cost">
<field name="name">Landed Cost</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_landed_code_group_admin">
<field name="sequence_type" ref="sequence_type_landed_cost"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_landed_code_group_account_admin">
<field name="sequence_type" ref="sequence_type_landed_cost"/>
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_shipment_cost">
<field name="name">Shipment Cost</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_shipment_cost_group_admin">
<field name="sequence_type" ref="sequence_type_shipment_cost"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_shipment_cost_group_account_admin">
<field name="sequence_type" ref="sequence_type_shipment_cost"/>
<field name="group" ref="account.group_account_admin"/>
@@ -6,10 +6,5 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_analytic_admin">
<field name="name">Analytic Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_analytic_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_analytic_admin"/>
</record>
</data>
</tryton>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_attendance_admin">
<field name="name">Attendance Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_group_attendance_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_attendance_admin"/>
</record>
<record model="ir.ui.icon" id="attendance_icon">
<field name="name">tryton-attendance</field>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_bank_admin">
<field name="name">Bank Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_group_bank_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_bank_admin"/>
</record>
<record model="ir.ui.icon" id="bank_icon">
<field name="name">tryton-bank</field>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_carrier_admin">
<field name="name">Carrier Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_group_carrier_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_carrier_admin"/>
</record>
<record model="ir.ui.icon" id="carrier_icon">
<field name="name">tryton-carrier</field>
-8
View File
@@ -10,14 +10,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Commission Administration</field>
<field name="parent" ref="group_commission"/>
</record>
<record model="res.user-res.group" id="user_admin_group_commission">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_commission"/>
</record>
<record model="res.user-res.group" id="user_admin_group_commission_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_commission_admin"/>
</record>
<record model="ir.ui.icon" id="commission_icon">
<field name="name">tryton-commission</field>
-9
View File
@@ -6,18 +6,9 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_company_admin">
<field name="name">Company Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_company_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_company_admin"/>
</record>
<record model="res.group" id="group_employee_admin">
<field name="name">Employee Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_employee_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_employee_admin"/>
</record>
<record model="ir.ui.icon" id="company_icon">
<field name="name">tryton-company</field>
-45
View File
@@ -14,11 +14,6 @@ this repository contains the full copyright notices and license terms. -->
sequence="30"
id="menu_country"
icon="tryton-country"/>
<record model="ir.ui.menu-res.group"
id="menu_country_group_admin">
<field name="menu" ref="menu_country"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.ui.view" id="organization_view_form">
<field name="model">country.organization</field>
@@ -59,14 +54,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_organization_admin">
<field name="model">country.organization</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="organization_member_view_form">
<field name="model">country.organization.member</field>
@@ -149,14 +136,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_region_admin">
<field name="model">country.region</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="country_view_form">
<field name="model">country.country</field>
@@ -209,14 +188,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_country_admin">
<field name="model">country.country</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="subdivision_view_form">
<field name="model">country.subdivision</field>
@@ -236,14 +207,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_subdivision_admin">
<field name="model">country.subdivision</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="postal_code_view_form">
<field name="model">country.postal_code</field>
@@ -285,13 +248,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_postal_code_admin">
<field name="model">country.postal_code</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_currency_admin">
<field name="name">Currency Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_group_currency_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_currency_admin"/>
</record>
<record model="ir.ui.icon" id="currency_icon">
<field name="name">tryton-currency</field>
-5
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_customs_admin">
<field name="name">Customs Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_customs_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_customs_admin"/>
</record>
<record model="ir.ui.icon" id="customs_icon">
<field name="name">tryton-customs</field>
-9
View File
@@ -6,19 +6,10 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_document_incoming">
<field name="name">Document Incoming</field>
</record>
<record model="res.user-res.group" id="user_admin_group_document_incoming">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_document_incoming"/>
</record>
<record model="res.group" id="group_document_incoming_admin">
<field name="name">Document Incoming Administrator</field>
<field name="parent" ref="group_document_incoming"/>
</record>
<record model="res.user-res.group" id="user_admin_group_document_incoming_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_document_incoming_admin"/>
</record>
<record model="ir.ui.icon" id="document_incoming_icon">
<field name="name">tryton-document-incoming</field>
-36
View File
@@ -8,11 +8,6 @@ this repository contains the full copyright notices and license terms. -->
parent="ir.menu_administration"
sequence="20"
id="menu_peppol"/>
<record model="ir.ui.menu-res.group"
id="menu_peppol_group_admin">
<field name="menu" ref="menu_peppol"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.ui.view" id="edocument_peppol_view_form">
<field name="model">edocument.peppol</field>
@@ -80,14 +75,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_edocument_peppol_admin">
<field name="model">edocument.peppol</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.field.access" id="access_edocument_peppol_data">
<field name="model">edocument.peppol</field>
@@ -95,13 +82,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_read" eval="False"/>
<field name="perm_write" eval="False"/>
</record>
<record model="ir.model.field.access" id="access_edocument_peppol_data_admin">
<field name="model">edocument.peppol</field>
<field name="field">data</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
</record>
<record model="ir.rule.group" id="rule_group_edocument_peppol_companies">
<field name="name">User in companies</field>
@@ -142,10 +122,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">retry</field>
<field name="string">Retry</field>
</record>
<record model="ir.model.button-res.group" id="edocument_peppol_retry_button_group_admin">
<field name="button" ref="edocument_peppol_retry_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.button-res.group" id="edocument_peppol_retry_button_group_account">
<field name="button" ref="edocument_peppol_retry_button"/>
<field name="group" ref="account.group_account"/>
@@ -156,10 +132,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">cancel</field>
<field name="string">Cancel</field>
</record>
<record model="ir.model.button-res.group" id="edocument_peppol_cancel_button_group_admin">
<field name="button" ref="edocument_peppol_cancel_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.button-res.group" id="edocument_peppol_cancel_button_group_account_admin">
<field name="button" ref="edocument_peppol_cancel_button"/>
<field name="group" ref="account.group_account_admin"/>
@@ -205,14 +177,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_edocument_peppol_service_admin">
<field name="model">edocument.peppol.service</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.rule.group" id="rule_group_edocument_peppol_service_companies">
<field name="name">User in companies</field>
-16
View File
@@ -55,14 +55,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_inbound_email_inbox_group_admin">
<field name="model">inbound.email.inbox</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="inbound_email_view_form">
<field name="model">inbound.email</field>
@@ -104,14 +96,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_inbound_email_group_admin">
<field name="model">inbound.email</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.button" id="inbound_email_process_button">
<field name="model">inbound.email</field>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_marketing">
<field name="name">Marketing</field>
</record>
<record model="res.user-res.group" id="user_admin_group_marketing">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_marketing"/>
</record>
<record model="ir.ui.icon" id="marketing_icon">
<field name="name">tryton-marketing</field>
@@ -45,13 +45,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_email_admin">
<field name="model">notification.email</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
-10
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_party_admin">
<field name="name">Party Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_party_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_party_admin"/>
</record>
<record model="ir.ui.icon" id="party_icon">
<field name="name">tryton-party</field>
@@ -93,11 +88,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_party">
<field name="name">Party</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_party_group_admin">
<field name="sequence_type" ref="sequence_type_party"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_party_group_party_admin">
<field name="sequence_type" ref="sequence_type_party"/>
-4
View File
@@ -83,10 +83,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_category">
<field name="name">Category</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_category_group_admin">
<field name="sequence_type" ref="sequence_type_category"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_category_group_product_admin">
<field name="sequence_type" ref="sequence_type_category"/>
<field name="group" ref="group_product_admin"/>
-14
View File
@@ -7,10 +7,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_product_admin">
<field name="name">Product Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_group_product_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_product_admin"/>
</record>
<record model="ir.ui.icon" id="product_icon">
<field name="name">tryton-product</field>
@@ -240,11 +236,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_product">
<field name="name">Variant</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_product_group_admin">
<field name="sequence_type" ref="sequence_type_product"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_product_group_product_admin">
<field name="sequence_type" ref="sequence_type_product"/>
@@ -253,11 +244,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_template">
<field name="name">Product</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_template_group_admin">
<field name="sequence_type" ref="sequence_type_template"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_template_group_template_admin">
<field name="sequence_type" ref="sequence_type_template"/>
-4
View File
@@ -139,10 +139,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_bom">
<field name="name">BOM</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_bom_group_admin">
<field name="sequence_type" ref="sequence_type_bom"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_bom_group_production_admin">
<field name="sequence_type" ref="sequence_type_bom"/>
<field name="group" ref="group_production_admin"/>
-16
View File
@@ -6,21 +6,10 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_production">
<field name="name">Production</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_production">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_production"/>
</record>
<record model="res.group" id="group_production_admin">
<field name="name">Production Administration</field>
<field name="parent" ref="group_production"/>
</record>
<record model="res.user-res.group"
id="user_admin_group_production_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_production_admin"/>
</record>
<record model="ir.ui.icon" id="production_icon">
<field name="name">tryton-production</field>
@@ -172,11 +161,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_production">
<field name="name">Production</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_production_group_admin">
<field name="sequence_type" ref="sequence_type_production"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_production_group_production_admin">
<field name="sequence_type" ref="sequence_type_production"/>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_project_admin">
<field name="name">Project Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_group_project_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_project_admin"/>
</record>
<record model="ir.ui.icon" id="project_icon">
<field name="name">tryton-project</field>
-4
View File
@@ -44,10 +44,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_work">
<field name="name">Project Work Effort</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_work_group_admin">
<field name="sequence_type" ref="sequence_type_work"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_work_group_project_admin">
<field name="sequence_type" ref="sequence_type_work"/>
<field name="group" ref="group_project_admin"/>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_project_invoice">
<field name="name">Project Invoice</field>
</record>
<record model="res.user-res.group" id="user_admin_group_project_invoice">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_project_invoice"/>
</record>
<record model="ir.ui.view" id="work_view_list">
<field name="model">project.work</field>
-13
View File
@@ -10,14 +10,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Purchase Administrator</field>
<field name="parent" ref="group_purchase"/>
</record>
<record model="res.user-res.group" id="user_admin_group_purchase">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_purchase"/>
</record>
<record model="res.user-res.group" id="user_admin_group_purchase_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_purchase_admin"/>
</record>
<record model="ir.ui.icon" id="purchase_icon">
<field name="name">tryton-purchase</field>
@@ -369,11 +361,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_purchase">
<field name="name">Purchase</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_purchase_group_admin">
<field name="sequence_type" ref="sequence_type_purchase"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_purchase_group_purchase_admin">
<field name="sequence_type" ref="sequence_type_purchase"/>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_purchase_amendment">
<field name="name">Purchase Amendment</field>
</record>
<record model="res.user-res.group" id="user_admin_group_purchase_amendment">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_purchase_amendment"/>
</record>
<record model="ir.ui.view" id="purchase_view_form">
<field name="model">purchase.purchase</field>
@@ -7,10 +7,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Purchase Blanket Agreement</field>
<field name="parent" ref="purchase.group_purchase"/>
</record>
<record model="res.user-res.group" id="user_admin_group_purchase_blanket_agreement">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_purchase_blanket_agreement"/>
</record>
<record model="ir.ui.view" id="purchase_configuration_view_form">
<field name="model">purchase.configuration</field>
@@ -21,10 +17,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_blanket_agreement">
<field name="name">Purchase Blanket Agreement</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_blanket_agreement_group_admin">
<field name="sequence_type" ref="sequence_type_blanket_agreement"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_group_purchase_admin">
<field name="sequence_type" ref="sequence_type_blanket_agreement"/>
<field name="group" ref="purchase.group_purchase_admin"/>
@@ -8,12 +8,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Purchase Request</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_purchase_request">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_purchase_request"/>
</record>
<record model="ir.ui.view" id="purchase_request_view_form">
<field name="model">purchase.request</field>
<field name="type">form</field>
@@ -206,12 +206,6 @@ this repository contains the full copyright notices and license terms. -->
id="sequence_type_purchase_request_quotation">
<field name="name">Purchase Request Quotation</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_purchase_request_quotation_group_admin">
<field name="sequence_type"
ref="sequence_type_purchase_request_quotation"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_purchase_request_quotation_group_purchase_admin">
<field name="sequence_type"
-16
View File
@@ -7,19 +7,9 @@ this repository contains the full copyright notices and license terms.
<record model="res.group" id="group_purchase_requisition_approval">
<field name="name">Purchase Requisition Approval</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_purchase_requisition_approval">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_purchase_requisition_approval"/>
</record>
<record model="res.group" id="group_purchase_requisition">
<field name="name">Purchase Requisition</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_purchase_requisition">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_purchase_requisition"/>
</record>
<record model="ir.ui.menu-res.group"
id="menu_purchase_group_purchase_requisition">
@@ -155,12 +145,6 @@ this repository contains the full copyright notices and license terms.
id="sequence_type_purchase_requisition">
<field name="name">Purchase Requisition</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_purchase_requisition_group_admin">
<field name="sequence_type"
ref="sequence_type_purchase_requisition"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_purchase_requisition_group_purchase_admin">
<field name="sequence_type"
-17
View File
@@ -6,19 +6,10 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_quality">
<field name="name">Quality</field>
</record>
<record model="res.user-res.group" id="user_admin_group_quality">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_quality"/>
</record>
<record model="res.group" id="group_quality_admin">
<field name="name">Quality Administration</field>
<field name="parent" ref="group_quality"/>
</record>
<record model="res.user-res.group" id="user_admin_group_quality_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_quality_admin"/>
</record>
<record model="ir.ui.icon" id="quality_icon">
<field name="name">tryton-quality</field>
@@ -87,10 +78,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_quality_inspection">
<field name="name">Quality Inspection</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_quality_inspection_group_admin">
<field name="sequence_type" ref="sequence_type_quality_inspection"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_quality_inspection_group_quality_admin">
<field name="sequence_type" ref="sequence_type_quality_inspection"/>
<field name="group" ref="group_quality_admin"/>
@@ -99,10 +86,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_quality_alert">
<field name="name">Quality Alert</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_quality_alert_group_admin">
<field name="sequence_type" ref="sequence_type_quality_alert"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_quality_alert_group_quality_admin">
<field name="sequence_type" ref="sequence_type_quality_alert"/>
<field name="group" ref="group_quality_admin"/>
-13
View File
@@ -10,14 +10,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Sales Administrator</field>
<field name="parent" ref="group_sale"/>
</record>
<record model="res.user-res.group" id="user_admin_group_sale">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_sale"/>
</record>
<record model="res.user-res.group" id="user_admin_group_sale_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_sale_admin"/>
</record>
<record model="ir.ui.icon" id="sale_icon">
<field name="name">tryton-sale</field>
@@ -382,11 +374,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_sale">
<field name="name">Sale</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_group_admin">
<field name="sequence_type" ref="sequence_type_sale"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_group_sale_admin">
<field name="sequence_type" ref="sequence_type_sale"/>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_sale_amendment">
<field name="name">Sale Amendment</field>
</record>
<record model="res.user-res.group" id="user_admin_group_sale_amendment">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_sale_amendment"/>
</record>
<record model="ir.ui.view" id="sale_view_form">
<field name="model">sale.sale</field>
-8
View File
@@ -7,10 +7,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Sale Blanket Agreement</field>
<field name="parent" ref="sale.group_sale"/>
</record>
<record model="res.user-res.group" id="user_admin_group_sale_blanket_agreement">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_sale_blanket_agreement"/>
</record>
<record model="ir.ui.view" id="sale_configuration_view_form">
<field name="model">sale.configuration</field>
@@ -21,10 +17,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_blanket_agreement">
<field name="name">Sale Blanket Agreement</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_blanket_agreement_group_admin">
<field name="sequence_type" ref="sequence_type_blanket_agreement"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_group_sale_admin">
<field name="sequence_type" ref="sequence_type_blanket_agreement"/>
<field name="group" ref="sale.group_sale_admin"/>
-5
View File
@@ -17,11 +17,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_complaint">
<field name="name">Customer Complaint</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_group_admin">
<field name="sequence_type" ref="sequence_type_complaint"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_group_sale_admin">
<field name="sequence_type" ref="sequence_type_complaint"/>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_gift_card_admin">
<field name="name">Gift Card Administration</field>
</record>
<record model="res.user-res.group" id="user_admin_group_gift_card_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_gift_card_admin"/>
</record>
<record model="ir.sequence.type" id="sequence_type_gift_card">
<field name="name">Gift Card</field>
-9
View File
@@ -11,10 +11,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_opportunity">
<field name="name">Sale Opportunity</field>
</record>
<record model="res.user-res.group" id="user_admin_group_opportunity">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_opportunity"/>
</record>
<record model="ir.ui.view" id="opportunity_view_form">
<field name="model">sale.opportunity</field>
@@ -31,11 +27,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_sale_opportunity">
<field name="name">Sale Opportunity</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_opportunity_group_admin">
<field name="sequence_type" ref="sequence_type_sale_opportunity"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_opportunity_group_sale_admin">
<field name="sequence_type" ref="sequence_type_sale_opportunity"/>
-15
View File
@@ -6,32 +6,17 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_sale_point">
<field name="name">POS</field>
</record>
<record model="res.user-res.group" id="user_admin_group_sale_point">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_sale_point"/>
</record>
<record model="ir.ui.menu-res.group" id="menu_sale_group_sale_point">
<field name="menu" ref="sale.menu_sale"/>
<field name="group" ref="group_sale_point"/>
</record>
<record model="res.group" id="group_sale_point_posting">
<field name="name">POS Posting</field>
</record>
<record model="res.user-res.group" id="user_admin_group_sale_point_posting">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_sale_point_posting"/>
</record>
<record model="ir.sequence.type" id="sequence_type_sale">
<field name="name">POS</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_group_admin">
<field name="sequence_type" ref="sequence_type_sale"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_sale_group_sale_admin">
<field name="sequence_type" ref="sequence_type_sale"/>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_rental">
<field name="name">Rental</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_rental_group_admin">
<field name="sequence_type" ref="sequence_type_rental"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_rental_group_sale_admin">
<field name="sequence_type" ref="sequence_type_rental"/>
<field name="group" ref="sale.group_sale_admin"/>
+1 -1
View File
@@ -84,7 +84,7 @@ class Sale(metaclass=PoolMeta):
if user_id == 0:
return True
user = User(user_id)
return group in user.groups
return group in user.groups or User.is_administrator(user_id)
def filter_line(line):
return (line.warehouse
-5
View File
@@ -6,10 +6,5 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_sale_stock_quantity">
<field name="name">Sale Stock Quantity</field>
</record>
<record model="res.user-res.group"
id="user_admin_sale_stock_quantity">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_sale_stock_quantity"/>
</record>
</data>
</tryton>
@@ -12,11 +12,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_subscription">
<field name="name">Subscription</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_subscription_group_admin">
<field name="sequence_type" ref="sequence_type_subscription"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_subscription_group_sale_admin">
<field name="sequence_type" ref="sequence_type_subscription"/>
@@ -17,11 +17,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_shipment_drop">
<field name="name">Drop Shipment</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_drop_group_admin">
<field name="sequence_type" ref="sequence_type_shipment_drop"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_drop_group_stock_admin">
<field name="sequence_type" ref="sequence_type_shipment_drop"/>
-5
View File
@@ -155,11 +155,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_inventory">
<field name="name">Inventory</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_inventory_group_admin">
<field name="sequence_type" ref="sequence_type_inventory"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_inventory_group_stock_admin">
<field name="sequence_type" ref="sequence_type_inventory"/>
-25
View File
@@ -444,11 +444,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_shipment_out">
<field name="name">Customer Shipment</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_out_group_admin">
<field name="sequence_type" ref="sequence_type_shipment_out"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_out_group_stock_admin">
<field name="sequence_type" ref="sequence_type_shipment_out"/>
@@ -463,11 +458,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_shipment_in">
<field name="name">Supplier Shipment</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_in_group_admin">
<field name="sequence_type" ref="sequence_type_shipment_in"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_in_group_stock_admin">
<field name="sequence_type" ref="sequence_type_shipment_in"/>
@@ -482,11 +472,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_shipment_internal">
<field name="name">Internal Shipment</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_internal_group_admin">
<field name="sequence_type" ref="sequence_type_shipment_internal"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_internal_group_stock_admin">
<field name="sequence_type" ref="sequence_type_shipment_internal"/>
@@ -501,11 +486,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_shipment_out_return">
<field name="name">Customer Return Shipment</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_out_return_group_admin">
<field name="sequence_type" ref="sequence_type_shipment_out_return"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_out_return_group_stock_admin">
<field name="sequence_type" ref="sequence_type_shipment_out_return"/>
@@ -521,11 +501,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_shipment_in_return">
<field name="name">Supplier Return Shipment</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_in_return_group_admin">
<field name="sequence_type" ref="sequence_type_shipment_in_return"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_shipment_in_return_group_stock_admin">
<field name="sequence_type" ref="sequence_type_shipment_in_return"/>
-19
View File
@@ -18,25 +18,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Stock Cancellation</field>
<field name="parent" ref="group_stock"/>
</record>
<record model="res.user-res.group"
id="user_admin_group_stock_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_stock_admin"/>
</record>
<record model="res.user-res.group"
id="user_admin_group_stock">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_stock"/>
</record>
<record model="res.user-res.group"
id="user_admin_group_stock_force_assignment">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_stock_force_assignment"/>
</record>
<record model="res.user-res.group" id="user_admin_group_stock_cancellation">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_stock_cancellation"/>
</record>
<record model="ir.ui.icon" id="stock_icon">
<field name="name">tryton-stock</field>
-5
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_stock_forecast">
<field name="name">Stock Forecast</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_stock_forecast">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_stock_forecast"/>
</record>
<record model="ir.action.wizard" id="wizard_forecast_complete">
<field name="name">Complete Forecast</field>
-5
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_stock_location_movable">
<field name="name">Stock Location Movable</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_stock_location_movable">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_stock_location_movable"/>
</record>
<record model="ir.model.access" id="access_location">
<field name="model">stock.location</field>
-4
View File
@@ -6,10 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_stock_lot">
<field name="name">Stock Lot</field>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_stock_lot_group_admin">
<field name="sequence_type" ref="sequence_type_stock_lot"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group" id="sequence_type_stock_lot_group_product_admin">
<field name="sequence_type" ref="sequence_type_stock_lot"/>
<field name="group" ref="product.group_product_admin"/>
-5
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_stock_force_expiration">
<field name="name">Stock Force Expiration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_stock_force_assignment">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_stock_force_expiration"/>
</record>
<record model="ir.ui.view" id="stock_configuration_view_form">
<field name="model">stock.configuration</field>
-5
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_package">
<field name="name">Stock Package</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_package_group_admin">
<field name="sequence_type" ref="sequence_type_package"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_package_group_stock_admin">
<field name="sequence_type" ref="sequence_type_package"/>
-5
View File
@@ -6,11 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="res.group" id="group_timesheet_admin">
<field name="name">Timesheet Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_timesheet_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_timesheet_admin"/>
</record>
<record model="ir.ui.icon" id="timesheet_icon">
<field name="name">tryton-timesheet</field>
+13 -11
View File
@@ -4,7 +4,7 @@ import datetime as dt
from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Bool, Eval, Id, If
from trytond.pyson import Bool, Eval, If
class Role(ModelSQL, ModelView):
@@ -52,7 +52,7 @@ class User(metaclass=PoolMeta):
roles = fields.One2Many(
'res.user.role', 'user', "Roles",
states={
'invisible': Eval('id', -1) == Id('res', 'user_admin'),
'invisible': Eval('administrator', False),
})
@classmethod
@@ -65,6 +65,15 @@ class User(metaclass=PoolMeta):
cls._context_fields.append('roles')
@fields.depends('administrator', 'roles')
def on_change_administrator(self):
try:
super().on_change_administrator()
except AttributeError:
pass
if self.administrator:
self.roles = []
@classmethod
def on_modification(cls, mode, users, field_names=None):
super().on_modification(mode, users, field_names=field_names)
@@ -73,18 +82,13 @@ class User(metaclass=PoolMeta):
@classmethod
def sync_roles(cls, users=None, date=None, clear=False):
pool = Pool()
ModelData = pool.get('ir.model.data')
admin_id = ModelData.get_id('res', 'user_admin')
if date is None:
date = dt.datetime.now()
if users is None:
users = cls.search([])
to_write = []
for user in users:
if user.id == admin_id:
if user.administrator:
continue
if not user.roles and not clear:
continue
@@ -106,9 +110,7 @@ class UserRole(ModelSQL, ModelView):
user = fields.Many2One(
'res.user', "User", ondelete='CASCADE', required=True,
domain=[
If(Eval('user', -1) == Id('res', 'user_admin'),
('id', '=', -1),
()),
('administrator', '=', False),
])
role = fields.Many2One(
'res.role', "Role", ondelete='CASCADE', required=True)
-16
View File
@@ -42,14 +42,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_role_admin">
<field name="model">res.role</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="user_view_form">
<field name="model">res.user</field>
@@ -76,14 +68,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_user_role_admin">
<field name="model">res.user.role</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
<data noupdate="1">
<record model="ir.cron" id="cron_sync_roles">
@@ -57,14 +57,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_product_category_google_admin">
<field name="model">product.category.google</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="product_category_facebook_view_list">
<field name="model">product.category.facebook</field>
@@ -114,13 +106,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_product_category_facebook_admin">
<field name="model">product.category.facebook</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
-8
View File
@@ -43,13 +43,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_stock_shipment_shopify_identifier_admin">
<field name="model">stock.shipment.shopify_identifier</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
-9
View File
@@ -63,15 +63,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_shop_shopify_identifier_admin">
<field name="model">web.shop.shopify_identifier</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.button" id="shop_shopify_identifier_set_to_update_button">
<field name="model">web.shop.shopify_identifier</field>
<field name="name">set_to_update</field>
-8
View File
@@ -41,14 +41,6 @@
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_shortened_url_group_admin">
<field name="model">web.shortened_url</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
-8
View File
@@ -67,14 +67,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_user_admin">
<field name="model">web.user</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_user_party_admin">
<field name="model">web.user</field>
+20 -1
View File
@@ -1,12 +1,31 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from proteus import Model
from proteus import Model, config
from .common import ProteusTestCase
class TestModel(ProteusTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
config.set_trytond()
Group = Model.get('res.group')
User = Model.get('res.user')
ModelAccess = Model.get('ir.model.access')
group = Group(name="Administration")
group.save()
admin, = User.find([('login', '=', 'admin')])
admin.groups.append(group)
admin.save()
access = ModelAccess(model='res.user', perm_read=True, group=group)
access.save()
def test_class_cache(self):
User1 = Model.get('res.user')
User2 = Model.get('res.user')
+1
View File
@@ -1,3 +1,4 @@
* Replace the administration group by a flag on the user
* Make DBTestCase public
* Add function to import XML files
* Add support for router in Pool
-5
View File
@@ -128,11 +128,6 @@ The following snippet gives a first idea of what an XML file looks:
<record model="res.group" id="group_party_admin">
<field name="name">Party Administration</field>
</record>
<record model="res.user-res.group"
id="user_admin_group_party_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_party_admin"/>
</record>
<menuitem
name="Party Management"
+35 -17
View File
@@ -13,7 +13,7 @@ from trytond.pool import Pool
from trytond.sendmail import send_test_email
from trytond.tools import file_open, find_path
from trytond.tools.email_ import EmailNotValidError, validate_email
from trytond.transaction import Transaction, TransactionError, inactive_records
from trytond.transaction import Transaction, TransactionError
__all__ = ['run']
logger = logging.getLogger(__name__)
@@ -76,12 +76,15 @@ def run(options):
})
for db_name in options.database_names:
if options.admin_login:
admin_login = options.admin_login
if options.email is not None:
email = options.email
elif init[db_name]:
while True:
email = input(
'"admin" email for "%s" (empty for none): ' % db_name)
f'email for "{admin_login}" of "{db_name}"'
' (empty for none): ')
if email:
try:
validate_email(email)
@@ -108,14 +111,17 @@ def run(options):
if not password and not options.reset_password:
while True:
password = getpass(
'"admin" password for "%s": ' % db_name)
password2 = getpass('"admin" password confirmation: ')
f'password for "{admin_login}" of "{db_name}": ')
password2 = getpass(
f'password confirmation for "{admin_login}": ')
if password != password2:
sys.stderr.write('"admin" password confirmation '
'doesn\'t match "admin" password.\n')
sys.stderr.write(
f'password confirmation for "{admin_login}" '
f'doesn\'t match "{admin_login}" password.\n')
continue
if not password:
sys.stderr.write('"admin" password is required.\n')
sys.stderr.write(
f'password for "{admin_login}" is required.\n')
continue
break
@@ -130,19 +136,31 @@ def run(options):
configuration = Configuration(1)
if init[db_name]:
configuration.series = __series__
with inactive_records():
admin, = User.search([('login', '=', 'admin')])
if email is not None:
admin.email = email
if init[db_name] or options.password:
configuration.language = main_lang
if (init[db_name]
or options.password
or options.reset_password):
try:
admin, = User.search([
('id', '!=', 0),
('login', '=', admin_login),
('administrator', '=', True),
])
except ValueError:
admin = User()
admin.login = admin_login
admin.administrator = True
else:
if not admin.administrator:
admin.administrator = True
if email is not None:
admin.email = email
if not options.reset_password:
admin.password = password
admin.save()
if options.reset_password:
User.reset_password([admin])
admin.save()
if options.reset_password:
User.reset_password([admin])
if options.hostname is not None:
configuration.hostname = options.hostname or None
if options.export_translations:
+5 -7
View File
@@ -47,13 +47,13 @@ CREATE TABLE ir_model_data (
module VARCHAR NOT NULL,
db_id INTEGER,
noupdate BOOL,
field_names JSONB,
PRIMARY KEY(id),
FOREIGN KEY (model) REFERENCES ir_model(name) ON DELETE CASCADE
);
INSERT INTO ir_model_data (id, fs_id, model, module, db_id, noupdate) VALUES
(1,'user_admin', 'res.user', 'res', 1, False),
(2, 'group_admin', 'res.group', 'res', 1, False);
INSERT INTO ir_model_data (id, fs_id, model, module, db_id, noupdate, field_names) VALUES
(1, 'user_root', 'res.user', 'res', 0, False, '["login", "name", "active", "administrator"]');
CREATE TABLE ir_ui_view (
id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL
@@ -110,13 +110,13 @@ CREATE TABLE res_user (
name VARCHAR,
active BOOLEAN NOT NULL,
login VARCHAR NOT NULL,
administrator BOOLEAN NOT NULL,
PRIMARY KEY(id)
);
ALTER TABLE res_user ADD CONSTRAINT res_user_login_key UNIQUE (login);
INSERT INTO res_user (id, login, name, active) VALUES (0, 'root', 'Root', False);
INSERT INTO res_user (id, login, name, active) VALUES (1, 'admin', 'Administrator', True);
INSERT INTO res_user (id, login, name, active, administrator) VALUES (0, 'root', 'Root', False, True);
CREATE TABLE res_group (
id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 2) NOT NULL
@@ -125,8 +125,6 @@ CREATE TABLE res_group (
PRIMARY KEY(id)
);
INSERT INTO res_group (id, name) VALUES (1, 'Administration');
CREATE TABLE "res_user-res_group" (
id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL
CONSTRAINT "res_user-res_group_id_positive" CHECK(id >= 0),
+7 -9
View File
@@ -35,12 +35,12 @@ CREATE TABLE ir_model_data (
model VARCHAR NOT NULL,
module VARCHAR NOT NULL,
db_id INTEGER,
noupdate BOOLEAN
noupdate BOOLEAN,
field_names TEXT
);
INSERT INTO ir_model_data (id, fs_id, model, module, db_id, noupdate) VALUES
(1, 'user_admin', 'res.user', 'res', 1, False),
(2, 'group_admin', 'res.group', 'res', 1, False);
INSERT INTO ir_model_data (id, fs_id, model, module, db_id, noupdate, field_names) VALUES
(1, 'user_root', 'res.user', 'res', 0, False, '["login", "name", "active", "administrator"]');
CREATE TABLE ir_ui_view (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -89,21 +89,19 @@ CREATE TABLE res_user (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR,
active BOOLEAN NOT NULL,
login VARCHAR NOT NULL
login VARCHAR NOT NULL,
administrator BOOLEAN NOT NULL
);
CREATE UNIQUE INDEX res_user_login_key ON res_user (login);
INSERT INTO res_user (id, login, name, active) VALUES (0, 'root', 'Root', 0);
INSERT INTO res_user (id, login, name, active) VALUES (1, 'admin', 'Administrator', 1);
INSERT INTO res_user (id, login, name, active, administrator) VALUES (0, 'root', 'Root', 0, 1);
CREATE TABLE res_group (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR
);
INSERT INTO res_group (id, name) VALUES (1, 'Administration');
CREATE TABLE "res_user-res_group" (
id INTEGER PRIMARY KEY AUTOINCREMENT,
"user" INTEGER NOT NULL,
+6 -3
View File
@@ -150,12 +150,15 @@ def get_parser_admin():
parser.add_argument("--activate-dependencies", dest="activatedeps",
action="store_true",
help="activate missing dependencies of updated modules")
parser.add_argument(
"--admin-login", dest="admin_login", default="admin",
help="login of an administrator user (default: admin)")
parser.add_argument("--email", dest="email", type=validate_email,
help="set the admin email")
parser.add_argument("-p", "--password", dest="password",
action='store_true', help="set the admin password")
action='store_true', help="set the administrator password")
parser.add_argument("--reset-password", dest='reset_password',
action='store_true', help="reset the admin password")
action='store_true', help="reset the administrator password")
parser.add_argument("--test-email", dest='test_email', type=validate_email,
help="send a test email to the specified address")
parser.add_argument("-m", "--update-modules-list", action="store_true",
@@ -176,7 +179,7 @@ def get_parser_admin():
help="export module translations to locale folder")
parser.epilog = ('The first time a database is initialized '
'or when the password is set, the admin password is read '
'or when the password is set, the administrator password is read '
'from file defined by TRYTONPASSFILE environment variable '
'or interactively asked from the user.\n'
'The config file can be specified in the TRYTOND_CONFIG '
+3 -2
View File
@@ -66,8 +66,9 @@ class MenuitemTagHandler:
values[attr] = attributes.get(attr)
values['icon'] = attributes.get('icon', 'tryton-folder')
if attributes.get('active'):
values['active'] = bool(eval(attributes['active']))
for attr in ['active', 'administration']:
if attr in attributes:
values[attr] = bool(eval(attributes[attr]))
if values.get('parent'):
model, id_ = self.mh.get_id(values['parent'])
+1 -9
View File
@@ -48,14 +48,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_action_admin">
<field name="model">ir.action</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.rule.group" id="rule_group_action">
<field name="name">User in groups</field>
@@ -63,7 +55,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_action1">
<field name="domain" eval="[('groups', 'in', Eval('groups', []))]" pyson="1"/>
<field name="domain" eval="[If(~Eval('is_administrator', False), ('groups', 'in', Eval('groups', [])), ())]" pyson="1"/>
<field name="rule_group" ref="rule_group_action"/>
</record>
<record model="ir.rule" id="rule_action2">
-12
View File
@@ -37,10 +37,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="model">ir.chat.channel</field>
<field name="confirm">This action will make previous entry point unusable. Do you want to continue?</field>
</record>
<record model="ir.model.button-res.group" id="chat_channel_reset_identifier_button_group_admin">
<field name="button" ref="chat_channel_reset_identifier_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.access" id="access_chat_channel">
<field name="model">ir.chat.channel</field>
@@ -49,14 +45,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_chat_channel_admin">
<field name="model">ir.chat.channel</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="chat_follower_view_list">
<field name="model">ir.chat.follower</field>
-12
View File
@@ -47,10 +47,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">run_once</field>
<field name="string">Run Once</field>
</record>
<record model="ir.model.button-res.group" id="cron_run_once_button_group_admin">
<field name="button" ref="cron_run_once_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.access" id="access_cron">
<field name="model">ir.cron</field>
@@ -59,14 +55,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_cron_admin">
<field name="model">ir.cron</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="cron_log_view_list">
<field name="model">ir.cron.log</field>
-8
View File
@@ -103,13 +103,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_email_template_admin">
<field name="model">ir.email.template</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
-8
View File
@@ -81,14 +81,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_error_admin">
<field name="model">ir.error</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
<data noupdate="1">
-8
View File
@@ -43,14 +43,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_export_admin">
<field name="model">ir.export</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="export_line_view_form">
<field name="model">ir.export.line</field>
-12
View File
@@ -633,14 +633,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_lang_admin">
<field name="model">ir.lang</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="lang_config_start_view_form">
<field name="model">ir.lang.config.start</field>
@@ -653,10 +645,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="wiz_name">ir.lang.config</field>
<field name="window" eval="True"/>
</record>
<record model="ir.action-res.group" id="act_lang_config_group_admin">
<field name="action" ref="act_lang_config"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.module.config_wizard.item" id="config_wizard_item_lang">
<field name="action" ref="act_lang_config"/>
-8
View File
@@ -40,14 +40,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_message_group_admin">
<field name="model">ir.message</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
<data grouped="1">
<record model="ir.message" id="msg_ID">
+67 -57
View File
@@ -596,11 +596,13 @@ class ModelAccess(
cursor = Transaction().connection.cursor()
model_access = cls.__table__()
is_administrator = User.is_administrator()
groups = User.get_groups()
access = {}
for model in models:
maccess = cls._get_access_cache.get((groups, model), default=-1)
maccess = cls._get_access_cache.get(
(is_administrator, groups, model), default=-1)
if maccess == -1:
break
access[model] = maccess
@@ -639,38 +641,42 @@ class ModelAccess(
access[model] = default_singleton
else:
access[model] = default
cursor.execute(*model_access.select(
model_access.model,
Max(Case(
(model_access.perm_read == Literal(True), 1),
else_=0)),
Max(Case(
(model_access.perm_write == Literal(True), 1),
else_=0)),
Max(Case(
(model_access.perm_create == Literal(True), 1),
else_=0)),
Max(Case(
(model_access.perm_delete == Literal(True), 1),
else_=0)),
where=model_access.model.in_(all_models)
& (model_access.active == Literal(True))
& (model_access.group.in_(groups or [-1])
| (model_access.group == Null)),
group_by=model_access.model))
raw_access = {
m: {'read': r, 'write': w, 'create': c, 'delete': d}
for m, r, w, c, d in cursor}
for model in models:
access[model] = {
perm: max(
(raw_access[m][perm] for m in model2models[model]
if m in raw_access),
default=access[model][perm])
for perm in ['read', 'write', 'create', 'delete']}
if not is_administrator:
cursor.execute(*model_access.select(
model_access.model,
Max(Case(
(model_access.perm_read == Literal(True), 1),
else_=0)),
Max(Case(
(model_access.perm_write == Literal(True), 1),
else_=0)),
Max(Case(
(model_access.perm_create == Literal(True), 1),
else_=0)),
Max(Case(
(model_access.perm_delete == Literal(True), 1),
else_=0)),
where=model_access.model.in_(all_models)
& (model_access.active == Literal(True))
& (model_access.group.in_(groups or [-1])
| (model_access.group == Null)),
group_by=model_access.model))
raw_access = {
m: {'read': r, 'write': w, 'create': c, 'delete': d}
for m, r, w, c, d in cursor}
for model in models:
access[model] = {
perm: max(
(raw_access[m][perm] for m in model2models[model]
if m in raw_access),
default=access[model][perm])
for perm in ['read', 'write', 'create', 'delete']}
for model, maccess in access.items():
cls._get_access_cache.set((groups, model), maccess)
cls._get_access_cache.set(
(is_administrator, groups, model), maccess)
return access
@classmethod
@@ -829,12 +835,13 @@ class ModelFieldAccess(
pool = Pool()
User = pool.get('res.user')
field_access = cls.__table__()
is_administrator = User.is_administrator()
groups = User.get_groups()
accesses = {}
for model in models:
maccesses = cls._get_access_cache.get((groups, model))
maccesses = cls._get_access_cache.get(
(is_administrator, groups, model))
if maccesses is None:
break
accesses[model] = maccesses
@@ -843,31 +850,34 @@ class ModelFieldAccess(
default = {}
accesses = dict((m, default) for m in models)
cursor = Transaction().connection.cursor()
cursor.execute(*field_access.select(
field_access.model,
field_access.field,
Max(Case(
(field_access.perm_read == Literal(True), 1),
else_=0)),
Max(Case(
(field_access.perm_write == Literal(True), 1),
else_=0)),
Max(Case(
(field_access.perm_create == Literal(True), 1),
else_=0)),
Max(Case(
(field_access.perm_delete == Literal(True), 1),
else_=0)),
where=field_access.model.in_(models)
& (field_access.active == Literal(True))
& (field_access.group.in_(groups or [-1])
| (field_access.group == Null)),
group_by=[field_access.model, field_access.field]))
for m, f, r, w, c, d in cursor:
accesses[m][f] = {'read': r, 'write': w, 'create': c, 'delete': d}
if not is_administrator:
cursor = Transaction().connection.cursor()
cursor.execute(*field_access.select(
field_access.model,
field_access.field,
Max(Case(
(field_access.perm_read == Literal(True), 1),
else_=0)),
Max(Case(
(field_access.perm_write == Literal(True), 1),
else_=0)),
Max(Case(
(field_access.perm_create == Literal(True), 1),
else_=0)),
Max(Case(
(field_access.perm_delete == Literal(True), 1),
else_=0)),
where=field_access.model.in_(models)
& (field_access.active == Literal(True))
& (field_access.group.in_(groups or [-1])
| (field_access.group == Null)),
group_by=[field_access.model, field_access.field]))
for m, f, r, w, c, d in cursor:
accesses[m][f] = {
'read': r, 'write': w, 'create': c, 'delete': d}
for model, maccesses in accesses.items():
cls._get_access_cache.set((groups, model), maccesses)
cls._get_access_cache.set(
(is_administrator, groups, model), maccesses)
return accesses
@classmethod
-8
View File
@@ -47,14 +47,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_model_admin">
<field name="model">ir.model</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="model_fields_view_form">
<field name="model">ir.model.field</field>
-32
View File
@@ -47,50 +47,30 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">activate</field>
<field name="string">Activate</field>
</record>
<record model="ir.model.button-res.group" id="module_activate_button_group_admin">
<field name="button" ref="module_activate_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.button" id="module_deactivate_button">
<field name="model">ir.module</field>
<field name="name">deactivate</field>
<field name="string">Deactivate (beta)</field>
</record>
<record model="ir.model.button-res.group" id="module_deactivate_button_group_admin">
<field name="button" ref="module_deactivate_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.button" id="module_upgrade_button">
<field name="model">ir.module</field>
<field name="name">upgrade</field>
<field name="string">Upgrade</field>
</record>
<record model="ir.model.button-res.group" id="module_upgrade_button_group_admin">
<field name="button" ref="module_upgrade_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.button" id="module_cancel_button">
<field name="model">ir.module</field>
<field name="name">cancel</field>
<field name="string">Cancel</field>
</record>
<record model="ir.model.button-res.group" id="module_cancel_button_group_admin">
<field name="button" ref="module_cancel_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.button" id="module_apply_button">
<field name="model">ir.module</field>
<field name="name">apply</field>
<field name="string">Apply</field>
</record>
<record model="ir.model.button-res.group" id="module_apply_button_group_admin">
<field name="button" ref="module_apply_button"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.model.access" id="access_module">
<field name="model">ir.module</field>
@@ -99,14 +79,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_module_admin">
<field name="model">ir.module</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="module_dependency_view_form">
<field name="model">ir.module.dependency</field>
@@ -175,10 +147,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Perform Pending Activation/Upgrade</field>
<field name="wiz_name">ir.module.activate_upgrade</field>
</record>
<record model="ir.action-res.group" id="act_module_activate_upgrade_group_admin">
<field name="action" ref="act_module_activate_upgrade"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.ui.view" id="module_activate_upgrade_start_view_form">
<field name="model">ir.module.activate_upgrade.start</field>
+2 -1
View File
@@ -57,10 +57,11 @@ class ResourceAccessMixin(ModelStorage):
@classmethod
def check_access(cls, ids, mode='read'):
pool = Pool()
User = pool.get('res.user')
ModelAccess = pool.get('ir.model.access')
Rule = pool.get('ir.rule')
transaction = Transaction()
if transaction.user == 0 or not transaction.check_access:
if not transaction.check_access or User.is_administrator():
return
records = defaultdict(set)
with without_check_access():
+14 -5
View File
@@ -210,7 +210,8 @@ class Rule(ModelSQL, ModelView):
pool = Pool()
User = pool.get('res.user')
return {
'groups': User.get_groups()
'is_administrator': User.is_administrator(),
'groups': User.get_groups(),
}
@classmethod
@@ -218,7 +219,11 @@ class Rule(ModelSQL, ModelView):
pool = Pool()
User = pool.get('res.user')
# _datetime value will be added to the domain
return (Transaction().context.get('_datetime'), User.get_groups())
return (
Transaction().context.get('_datetime'),
User.is_administrator(),
User.get_groups(),
)
@classmethod
def get(cls, model_name, mode='read'):
@@ -234,7 +239,11 @@ class Rule(ModelSQL, ModelView):
assert mode in cls.modes
groups = User.get_groups()
if User.is_administrator():
group_clause = Literal(True)
else:
groups = User.get_groups()
group_clause = rule_group_group.group.in_(groups or [-1])
model_names, model2field = _get_access_models(pool.get(model_name))
model_names = list(model_names)
@@ -247,7 +256,7 @@ class Rule(ModelSQL, ModelView):
).select(rule_table.id,
where=(rule_group.model.in_(model_names))
& (getattr(rule_group, 'perm_%s' % mode) == Literal(True))
& (rule_group_group.group.in_(groups or [-1])
& (group_clause
| (rule_group.default_p == Literal(True))
| (rule_group.global_p == Literal(True))
)))
@@ -259,7 +268,7 @@ class Rule(ModelSQL, ModelView):
).select(rule_group.id,
where=(rule_group.model.in_(model_names))
& ~rule_group.id.in_(rule_table.select(rule_table.rule_group))
& rule_group_group.group.in_(groups or [-1])))
& group_clause))
no_rules = cursor.fetchone()
clause = defaultdict(lambda: ['OR'])
-8
View File
@@ -42,14 +42,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_rule_group_admin">
<field name="model">ir.rule.group</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="rule_view_form">
<field name="model">ir.rule</field>
+2 -10
View File
@@ -50,7 +50,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_read" eval="False"/>
</record>
<record model="ir.rule" id="rule_sequence">
<field name="domain" eval="[('sequence_type.groups', 'in', Eval('groups', []))]" pyson="1"/>
<field name="domain" eval="[If(~Eval('is_administrator', False), ('sequence_type.groups', 'in', Eval('groups', [])), ())]" pyson="1"/>
<field name="rule_group" ref="rule_group_sequence"/>
</record>
@@ -96,7 +96,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_read" eval="False"/>
</record>
<record model="ir.rule" id="rule_sequence_strict">
<field name="domain" eval="[('sequence_type.groups', 'in', Eval('groups', []))]" pyson="1"/>
<field name="domain" eval="[If(~Eval('is_administrator', False), ('sequence_type.groups', 'in', Eval('groups', [])), ())]" pyson="1"/>
<field name="rule_group" ref="rule_group_sequence_strict"/>
</record>
@@ -141,13 +141,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_sequence_type_admin">
<field name="model">ir.sequence.type</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
-16
View File
@@ -57,14 +57,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_translation_admin">
<field name="model">ir.translation</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.action.wizard" id="wizard_translation_report">
<field name="name">Translations</field>
@@ -147,10 +139,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Synchronize Translations</field>
<field name="wiz_name">ir.translation.update</field>
</record>
<record model="ir.action-res.group" id="act_translation_update_group_admin">
<field name="action" ref="act_translation_update"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.action.keyword"
id="act_translation_update_keyword_report">
<field name="keyword">form_action</field>
@@ -185,10 +173,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Export Translations</field>
<field name="wiz_name">ir.translation.export</field>
</record>
<record model="ir.action-res.group" id="act_translation_export_group_admin">
<field name="action" ref="act_translation_export"/>
<field name="group" ref="res.group_admin"/>
</record>
<menuitem
parent="menu_localization"
action="act_translation_export"
-8
View File
@@ -40,14 +40,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_trigger_admin">
<field name="model">ir.trigger</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
<data noupdate="1">
<record model="ir.cron" id="cron_trigger_time">
-8
View File
@@ -42,13 +42,5 @@
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_ui_icon_admin">
<field name="model">ir.ui.icon</field>
<field name="group" ref="res.group_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
+12 -1
View File
@@ -6,6 +6,7 @@ from itertools import groupby
from trytond.model import (
DeactivableMixin, ModelSQL, ModelView, fields, sequence_ordered, tree)
from trytond.pool import Pool
from trytond.pyson import Eval
from trytond.rpc import RPC
from trytond.transaction import Transaction, inactive_records
@@ -112,7 +113,13 @@ class UIMenu(
'ir.ui.menu-res.group', 'menu', 'group', "Groups",
filter=[
('active', '=', True),
])
],
states={
'invisible': Eval('administration', False),
})
administration = fields.Boolean(
"Administrator",
help="Check to restrict access to only administrators.")
favorite = fields.Function(fields.Boolean('Favorite'), 'get_favorite')
favorites = fields.Many2Many(
'ir.ui.menu.favorite', 'menu', 'user', "Favorites")
@@ -129,6 +136,10 @@ class UIMenu(
def default_sequence(cls):
return 50
@classmethod
def default_administration(cls):
return False
@staticmethod
def list_icons():
pool = Pool()
Loaded 100 of 128 files, more files were not shown because too many files have changed in this diff. Show more