From 80b61a9f63b652c99c2d7941aa344302b09a0057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 25 Feb 2024 13:45:21 +0100 Subject: [PATCH] Store model on ir.rule.group --- modules/account/account.xml | 15 ++- modules/account/fiscalyear.xml | 2 +- modules/account/move.xml | 9 +- modules/account/move_template.xml | 3 +- modules/account/period.xml | 2 +- modules/account/tax.xml | 6 +- modules/account_asset/asset.xml | 2 +- modules/account_budget/account.xml | 2 +- modules/account_dunning/dunning.xml | 2 +- modules/account_invoice/account.xml | 3 +- modules/account_invoice/invoice.xml | 6 +- modules/account_invoice_defer/account.xml | 2 +- modules/account_payment/party.xml | 2 +- modules/account_payment/payment.xml | 6 +- modules/account_payment_sepa/payment.xml | 5 +- modules/account_product/product.xml | 4 +- modules/account_receivable_rule/account.xml | 2 +- modules/account_rule/account.xml | 2 +- modules/account_statement/journal.xml | 2 +- modules/account_statement/statement.xml | 2 +- modules/account_statement_rule/account.xml | 2 +- modules/account_stock_eu/account_stock_eu.xml | 2 +- modules/account_stock_landed_cost/account.xml | 2 +- .../account_stock_shipment_cost/account.xml | 2 +- modules/analytic_account/account.xml | 6 +- modules/analytic_account/line.xml | 3 +- modules/analytic_account/rule.xml | 3 +- modules/analytic_budget/analytic_account.xml | 2 +- modules/attendance/attendance.xml | 20 ++-- modules/commission/commission.xml | 3 +- modules/commission/commission_reporting.xml | 6 +- modules/company/ir.xml | 4 +- modules/company/tests/test_module.py | 4 +- modules/document_incoming/document.xml | 2 +- modules/document_incoming_ocr/document.xml | 2 +- modules/incoterm/party.xml | 2 +- modules/product_price_list/price_list.xml | 2 +- modules/production/production.xml | 2 +- modules/production_work/work.xml | 7 +- modules/project/work.xml | 2 +- modules/purchase/purchase.xml | 4 +- modules/purchase/purchase_reporting.xml | 12 +-- modules/purchase_amendment/purchase.xml | 2 +- .../purchase_blanket_agreement/purchase.xml | 2 +- modules/purchase_request/purchase_request.xml | 2 +- .../purchase_request_quotation/purchase.xml | 3 +- modules/purchase_requisition/purchase.xml | 8 +- modules/quality/quality.xml | 4 +- modules/sale/sale.xml | 2 +- modules/sale/sale_reporting.xml | 26 +++--- modules/sale_amendment/sale.xml | 2 +- modules/sale_blanket_agreement/sale.xml | 2 +- modules/sale_complaint/complaint.xml | 2 +- modules/sale_extra/sale.xml | 2 +- modules/sale_gift_card/sale.xml | 2 +- modules/sale_opportunity/opportunity.xml | 2 +- .../opportunity_reporting.xml | 12 +-- modules/sale_point/sale.xml | 12 +-- modules/sale_promotion/sale.xml | 2 +- modules/sale_subscription/subscription.xml | 2 +- modules/sale_supply_drop_shipment/stock.xml | 3 +- modules/stock/inventory.xml | 2 +- modules/stock/move.xml | 2 +- modules/stock/period.xml | 2 +- modules/stock/product.xml | 6 +- modules/stock/shipment.xml | 10 +- modules/stock/stock_reporting_margin.xml | 12 +-- modules/stock_forecast/forecast.xml | 2 +- modules/stock_location_move/stock.xml | 4 +- modules/stock_lot/stock.xml | 2 +- modules/stock_package/stock.xml | 2 +- .../stock_quantity_early_planning/stock.xml | 2 +- modules/stock_quantity_issue/stock.xml | 2 +- modules/stock_supply/order_point.xml | 2 +- modules/timesheet/line.xml | 24 ++--- modules/timesheet/work.xml | 2 +- modules/web_shop/web.xml | 2 +- trytond/CHANGELOG | 1 + trytond/trytond/ir/rule.py | 50 +++++++--- trytond/trytond/ir/view/rule_group_form.xml | 4 +- trytond/trytond/ir/view/rule_group_list.xml | 2 +- trytond/trytond/res/ir.xml | 8 +- trytond/trytond/res/user.xml | 8 +- trytond/trytond/tests/test_rule.py | 92 +++++-------------- 84 files changed, 230 insertions(+), 278 deletions(-) diff --git a/modules/account/account.xml b/modules/account/account.xml index e0c4ae44da..e7c2e1118b 100644 --- a/modules/account/account.xml +++ b/modules/account/account.xml @@ -239,8 +239,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.account.type @@ -564,7 +563,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.account @@ -668,8 +667,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.general_ledger.account @@ -755,7 +753,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.general_ledger.account.party @@ -798,8 +796,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.general_ledger.line @@ -938,7 +935,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.aged_balance diff --git a/modules/account/fiscalyear.xml b/modules/account/fiscalyear.xml index bd8ab58cf7..7ee6e0480f 100644 --- a/modules/account/fiscalyear.xml +++ b/modules/account/fiscalyear.xml @@ -85,7 +85,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.fiscalyear diff --git a/modules/account/move.xml b/modules/account/move.xml index 043d0fd937..885255f6ff 100644 --- a/modules/account/move.xml +++ b/modules/account/move.xml @@ -41,8 +41,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.move @@ -112,8 +111,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.move.reconciliation @@ -409,8 +407,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.move.reconcile.write_off diff --git a/modules/account/move_template.xml b/modules/account/move_template.xml index e7f7aaed5e..991743d0bc 100644 --- a/modules/account/move_template.xml +++ b/modules/account/move_template.xml @@ -40,8 +40,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.move.template diff --git a/modules/account/period.xml b/modules/account/period.xml index 0ea496f533..72245a4efc 100644 --- a/modules/account/period.xml +++ b/modules/account/period.xml @@ -83,7 +83,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.period diff --git a/modules/account/tax.xml b/modules/account/tax.xml index 0043628652..f46ea5a74e 100644 --- a/modules/account/tax.xml +++ b/modules/account/tax.xml @@ -203,7 +203,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.tax.code @@ -329,7 +329,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.tax @@ -493,7 +493,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.tax.rule diff --git a/modules/account_asset/asset.xml b/modules/account_asset/asset.xml index 50c4f4e708..3031eb465c 100644 --- a/modules/account_asset/asset.xml +++ b/modules/account_asset/asset.xml @@ -98,7 +98,7 @@ User in companies - + account.asset diff --git a/modules/account_budget/account.xml b/modules/account_budget/account.xml index 8cdb5a9635..827b7a3eed 100644 --- a/modules/account_budget/account.xml +++ b/modules/account_budget/account.xml @@ -96,7 +96,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.budget diff --git a/modules/account_dunning/dunning.xml b/modules/account_dunning/dunning.xml index 2a5f1da503..640583fe42 100644 --- a/modules/account_dunning/dunning.xml +++ b/modules/account_dunning/dunning.xml @@ -217,7 +217,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.dunning diff --git a/modules/account_invoice/account.xml b/modules/account_invoice/account.xml index 6423b0a712..98eec1a343 100644 --- a/modules/account_invoice/account.xml +++ b/modules/account_invoice/account.xml @@ -94,8 +94,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.fiscalyear.invoice_sequence diff --git a/modules/account_invoice/invoice.xml b/modules/account_invoice/invoice.xml index 8ffca21fe7..51164dcbbd 100644 --- a/modules/account_invoice/invoice.xml +++ b/modules/account_invoice/invoice.xml @@ -417,7 +417,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.invoice.payment.method @@ -462,7 +462,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.invoice @@ -474,7 +474,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.invoice.line diff --git a/modules/account_invoice_defer/account.xml b/modules/account_invoice_defer/account.xml index d327826116..3245e3d7ec 100644 --- a/modules/account_invoice_defer/account.xml +++ b/modules/account_invoice_defer/account.xml @@ -121,7 +121,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.invoice.deferred diff --git a/modules/account_payment/party.xml b/modules/account_payment/party.xml index fa5eb97e7c..1f84f7c72b 100644 --- a/modules/account_payment/party.xml +++ b/modules/account_payment/party.xml @@ -23,7 +23,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + party.party.reception_direct_debit diff --git a/modules/account_payment/payment.xml b/modules/account_payment/payment.xml index 137f87385b..ddf3a91d76 100644 --- a/modules/account_payment/payment.xml +++ b/modules/account_payment/payment.xml @@ -69,7 +69,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.payment.journal @@ -150,7 +150,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.payment.group @@ -376,7 +376,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.payment diff --git a/modules/account_payment_sepa/payment.xml b/modules/account_payment_sepa/payment.xml index 8aff4a661c..071b0f7de8 100644 --- a/modules/account_payment_sepa/payment.xml +++ b/modules/account_payment_sepa/payment.xml @@ -97,7 +97,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.payment.sepa.mandate @@ -237,8 +237,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.payment.sepa.message diff --git a/modules/account_product/product.xml b/modules/account_product/product.xml index dadd782060..07cfdbd7bb 100644 --- a/modules/account_product/product.xml +++ b/modules/account_product/product.xml @@ -12,7 +12,7 @@ this repository contains the full copyright notices and license terms. --> Not accounting category - + product.category @@ -24,7 +24,7 @@ this repository contains the full copyright notices and license terms. --> Any category - + product.category diff --git a/modules/account_receivable_rule/account.xml b/modules/account_receivable_rule/account.xml index 323c882d96..cfcff921f1 100644 --- a/modules/account_receivable_rule/account.xml +++ b/modules/account_receivable_rule/account.xml @@ -64,7 +64,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.account.receivable.rule diff --git a/modules/account_rule/account.xml b/modules/account_rule/account.xml index d0b7a654cf..4eb97c09eb 100644 --- a/modules/account_rule/account.xml +++ b/modules/account_rule/account.xml @@ -54,7 +54,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.account.rule diff --git a/modules/account_statement/journal.xml b/modules/account_statement/journal.xml index c87e4898f1..1b5023255d 100644 --- a/modules/account_statement/journal.xml +++ b/modules/account_statement/journal.xml @@ -52,7 +52,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.statement.journal diff --git a/modules/account_statement/statement.xml b/modules/account_statement/statement.xml index 68bb67c799..036e6fa95a 100644 --- a/modules/account_statement/statement.xml +++ b/modules/account_statement/statement.xml @@ -84,7 +84,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.statement diff --git a/modules/account_statement_rule/account.xml b/modules/account_statement_rule/account.xml index d09729ec18..48208027e9 100644 --- a/modules/account_statement_rule/account.xml +++ b/modules/account_statement_rule/account.xml @@ -56,7 +56,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.statement.rule diff --git a/modules/account_stock_eu/account_stock_eu.xml b/modules/account_stock_eu/account_stock_eu.xml index c28763e330..6752eafd63 100644 --- a/modules/account_stock_eu/account_stock_eu.xml +++ b/modules/account_stock_eu/account_stock_eu.xml @@ -114,7 +114,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.stock.eu.intrastat.declaration diff --git a/modules/account_stock_landed_cost/account.xml b/modules/account_stock_landed_cost/account.xml index 1a5917b2d7..f29d317698 100644 --- a/modules/account_stock_landed_cost/account.xml +++ b/modules/account_stock_landed_cost/account.xml @@ -146,7 +146,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.landed_cost diff --git a/modules/account_stock_shipment_cost/account.xml b/modules/account_stock_shipment_cost/account.xml index 5dfbe31483..7675a8bffc 100644 --- a/modules/account_stock_shipment_cost/account.xml +++ b/modules/account_stock_shipment_cost/account.xml @@ -149,7 +149,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + account.shipment_cost diff --git a/modules/analytic_account/account.xml b/modules/analytic_account/account.xml index 789142291b..c3b5f5aa0c 100644 --- a/modules/analytic_account/account.xml +++ b/modules/analytic_account/account.xml @@ -109,8 +109,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + analytic_account.account @@ -183,8 +182,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + analytic.account.entry diff --git a/modules/analytic_account/line.xml b/modules/analytic_account/line.xml index ebfe4709f5..44c4f4691b 100644 --- a/modules/analytic_account/line.xml +++ b/modules/analytic_account/line.xml @@ -30,8 +30,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + analytic_account.line diff --git a/modules/analytic_account/rule.xml b/modules/analytic_account/rule.xml index 03ecc73126..1082653c6a 100644 --- a/modules/analytic_account/rule.xml +++ b/modules/analytic_account/rule.xml @@ -37,8 +37,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + analytic_account.rule diff --git a/modules/analytic_budget/analytic_account.xml b/modules/analytic_budget/analytic_account.xml index 6d9234f2ff..6cdb5dd629 100644 --- a/modules/analytic_budget/analytic_account.xml +++ b/modules/analytic_budget/analytic_account.xml @@ -79,7 +79,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + analytic_account.budget diff --git a/modules/attendance/attendance.xml b/modules/attendance/attendance.xml index f266ed8e4e..378daa6c68 100644 --- a/modules/attendance/attendance.xml +++ b/modules/attendance/attendance.xml @@ -67,7 +67,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + attendance.line @@ -87,7 +87,7 @@ this repository contains the full copyright notices and license terms. --> Own attendance - + attendance.line @@ -101,7 +101,7 @@ this repository contains the full copyright notices and license terms. --> Any attendance - + attendance.line @@ -144,7 +144,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + attendance.period @@ -197,7 +197,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + attendance.sheet.line @@ -209,7 +209,7 @@ this repository contains the full copyright notices and license terms. --> Own attendance sheet line - + attendance.sheet.line @@ -223,7 +223,7 @@ this repository contains the full copyright notices and license terms. --> Any attendance sheet line - + attendance.sheet.line @@ -261,7 +261,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + attendance.sheet @@ -273,7 +273,7 @@ this repository contains the full copyright notices and license terms. --> Own attendance sheet - + attendance.sheet @@ -287,7 +287,7 @@ this repository contains the full copyright notices and license terms. --> Any attendance sheet - + attendance.sheet diff --git a/modules/commission/commission.xml b/modules/commission/commission.xml index 4378396ce1..a930a95c39 100644 --- a/modules/commission/commission.xml +++ b/modules/commission/commission.xml @@ -83,8 +83,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + commission.agent diff --git a/modules/commission/commission_reporting.xml b/modules/commission/commission_reporting.xml index 058cbf16b0..a5b398a891 100644 --- a/modules/commission/commission_reporting.xml +++ b/modules/commission/commission_reporting.xml @@ -68,8 +68,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + commission.reporting.agent @@ -146,8 +145,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + commission.reporting.agent.time_series diff --git a/modules/company/ir.xml b/modules/company/ir.xml index 98119f2f0b..58c03e9cda 100644 --- a/modules/company/ir.xml +++ b/modules/company/ir.xml @@ -28,7 +28,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + ir.sequence @@ -44,7 +44,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + ir.sequence.strict diff --git a/modules/company/tests/test_module.py b/modules/company/tests/test_module.py index 7b2a5909d0..f6be9ad7a4 100644 --- a/modules/company/tests/test_module.py +++ b/modules/company/tests/test_module.py @@ -131,14 +131,14 @@ class CompanyTestMixin: for fname, models in to_check.items(): rules = Rule.search([ ('rule_group', 'where', [ - ('model.model', 'in', list(models)), + ('model', 'in', list(models)), ('global_p', '=', True), ('perm_read', '=', True), ]), ('domain', '=', PYSONEncoder(sort_keys=True).encode( [(fname, 'in', Eval('companies', []))])), ]) - with_rules = {r.rule_group.model.model for r in rules} + with_rules = {r.rule_group.model for r in rules} self.assertGreaterEqual(with_rules, models, msg='Models %(models)s are missing a global rule ' 'for field "%(field)s"' % { diff --git a/modules/document_incoming/document.xml b/modules/document_incoming/document.xml index 1ffca17d3a..d3901094c2 100644 --- a/modules/document_incoming/document.xml +++ b/modules/document_incoming/document.xml @@ -166,7 +166,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + document.incoming diff --git a/modules/document_incoming_ocr/document.xml b/modules/document_incoming_ocr/document.xml index 505c166d8e..791025ca7d 100644 --- a/modules/document_incoming_ocr/document.xml +++ b/modules/document_incoming_ocr/document.xml @@ -74,7 +74,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + document.incoming.ocr.service diff --git a/modules/incoterm/party.xml b/modules/incoterm/party.xml index d34f476cb8..041ed9b0cd 100644 --- a/modules/incoterm/party.xml +++ b/modules/incoterm/party.xml @@ -32,7 +32,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + party.incoterm diff --git a/modules/product_price_list/price_list.xml b/modules/product_price_list/price_list.xml index d7ec619b2e..4795b514d8 100644 --- a/modules/product_price_list/price_list.xml +++ b/modules/product_price_list/price_list.xml @@ -56,7 +56,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + product.price_list diff --git a/modules/production/production.xml b/modules/production/production.xml index 642f544e33..57c5d3e6f9 100644 --- a/modules/production/production.xml +++ b/modules/production/production.xml @@ -206,7 +206,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + production diff --git a/modules/production_work/work.xml b/modules/production_work/work.xml index 76d7242485..ba42c7ca8c 100644 --- a/modules/production_work/work.xml +++ b/modules/production_work/work.xml @@ -94,8 +94,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + production.work.center @@ -261,7 +260,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + production.work @@ -319,7 +318,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + production.work.cycle diff --git a/modules/project/work.xml b/modules/project/work.xml index 3b518d7418..a96d8cba23 100644 --- a/modules/project/work.xml +++ b/modules/project/work.xml @@ -35,7 +35,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + project.work diff --git a/modules/purchase/purchase.xml b/modules/purchase/purchase.xml index f6fb39a14b..a7f129aed4 100644 --- a/modules/purchase/purchase.xml +++ b/modules/purchase/purchase.xml @@ -567,7 +567,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.product_supplier @@ -652,7 +652,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.purchase diff --git a/modules/purchase/purchase_reporting.xml b/modules/purchase/purchase_reporting.xml index 53a3fb948c..65a8ac56d7 100644 --- a/modules/purchase/purchase_reporting.xml +++ b/modules/purchase/purchase_reporting.xml @@ -52,7 +52,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.reporting.main @@ -125,7 +125,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.reporting.main.time_series @@ -199,7 +199,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.reporting.supplier @@ -276,7 +276,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.reporting.supplier.time_series @@ -351,7 +351,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.reporting.product @@ -427,7 +427,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.reporting.product.time_series diff --git a/modules/purchase_amendment/purchase.xml b/modules/purchase_amendment/purchase.xml index c4e395ed13..eb53be59e4 100644 --- a/modules/purchase_amendment/purchase.xml +++ b/modules/purchase_amendment/purchase.xml @@ -86,7 +86,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.amendment diff --git a/modules/purchase_blanket_agreement/purchase.xml b/modules/purchase_blanket_agreement/purchase.xml index 59ba9710b1..60bb30ff7b 100644 --- a/modules/purchase_blanket_agreement/purchase.xml +++ b/modules/purchase_blanket_agreement/purchase.xml @@ -146,7 +146,7 @@ this repository contains the full copyright notices and license terms. --> Purchases Blanket Agreement - + purchase.blanket_agreement diff --git a/modules/purchase_request/purchase_request.xml b/modules/purchase_request/purchase_request.xml index 952d02f84b..1bc61c86e4 100644 --- a/modules/purchase_request/purchase_request.xml +++ b/modules/purchase_request/purchase_request.xml @@ -131,7 +131,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.request diff --git a/modules/purchase_request_quotation/purchase.xml b/modules/purchase_request_quotation/purchase.xml index 077022b15d..53cf72333d 100644 --- a/modules/purchase_request_quotation/purchase.xml +++ b/modules/purchase_request_quotation/purchase.xml @@ -118,8 +118,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + purchase.request.quotation diff --git a/modules/purchase_requisition/purchase.xml b/modules/purchase_requisition/purchase.xml index e5e8287ba9..0c02c1f2de 100644 --- a/modules/purchase_requisition/purchase.xml +++ b/modules/purchase_requisition/purchase.xml @@ -224,7 +224,7 @@ this repository contains the full copyright notices and license terms. User in companies - + purchase.requisition @@ -237,8 +237,7 @@ this repository contains the full copyright notices and license terms. Own requisition - + purchase.requisition @@ -258,8 +257,7 @@ this repository contains the full copyright notices and license terms. Any requisition - + purchase.requisition User in companies - + quality.control @@ -274,7 +274,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + quality.inspection diff --git a/modules/sale/sale.xml b/modules/sale/sale.xml index 702253e58e..b53541603b 100644 --- a/modules/sale/sale.xml +++ b/modules/sale/sale.xml @@ -287,7 +287,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.sale diff --git a/modules/sale/sale_reporting.xml b/modules/sale/sale_reporting.xml index cebbf84ed9..47afdbf4b5 100644 --- a/modules/sale/sale_reporting.xml +++ b/modules/sale/sale_reporting.xml @@ -60,7 +60,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.main @@ -133,7 +133,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.main.time_series @@ -219,7 +219,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.customer @@ -296,7 +296,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.customer.time_series @@ -377,7 +377,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.customer.category @@ -454,7 +454,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.customer.category.time_series @@ -540,7 +540,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.product @@ -616,7 +616,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.product.time_series @@ -697,7 +697,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.product.category @@ -774,7 +774,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.product.category.time_series @@ -858,7 +858,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.country.tree @@ -929,7 +929,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.country.time_series @@ -1001,7 +1001,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.reporting.country.subdivision.time_series diff --git a/modules/sale_amendment/sale.xml b/modules/sale_amendment/sale.xml index 5b197d0fad..0c544c7cd9 100644 --- a/modules/sale_amendment/sale.xml +++ b/modules/sale_amendment/sale.xml @@ -86,7 +86,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.amendment diff --git a/modules/sale_blanket_agreement/sale.xml b/modules/sale_blanket_agreement/sale.xml index 4460ac85c1..c1b31cb7f0 100644 --- a/modules/sale_blanket_agreement/sale.xml +++ b/modules/sale_blanket_agreement/sale.xml @@ -146,7 +146,7 @@ this repository contains the full copyright notices and license terms. --> Sales Blanket Agreement - + sale.blanket_agreement diff --git a/modules/sale_complaint/complaint.xml b/modules/sale_complaint/complaint.xml index d7a6b4b8c4..ba495b830d 100644 --- a/modules/sale_complaint/complaint.xml +++ b/modules/sale_complaint/complaint.xml @@ -179,7 +179,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.complaint diff --git a/modules/sale_extra/sale.xml b/modules/sale_extra/sale.xml index 535ee03022..8eeee4f6fb 100644 --- a/modules/sale_extra/sale.xml +++ b/modules/sale_extra/sale.xml @@ -57,7 +57,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.extra diff --git a/modules/sale_gift_card/sale.xml b/modules/sale_gift_card/sale.xml index 8d362ec18a..62788a2ec3 100644 --- a/modules/sale_gift_card/sale.xml +++ b/modules/sale_gift_card/sale.xml @@ -95,7 +95,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.gift_card diff --git a/modules/sale_opportunity/opportunity.xml b/modules/sale_opportunity/opportunity.xml index 39ce051b8b..44119d4065 100644 --- a/modules/sale_opportunity/opportunity.xml +++ b/modules/sale_opportunity/opportunity.xml @@ -187,7 +187,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.opportunity diff --git a/modules/sale_opportunity/opportunity_reporting.xml b/modules/sale_opportunity/opportunity_reporting.xml index acbc573da6..b669805e6a 100644 --- a/modules/sale_opportunity/opportunity_reporting.xml +++ b/modules/sale_opportunity/opportunity_reporting.xml @@ -54,7 +54,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.opportunity.reporting.main @@ -130,7 +130,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.opportunity.reporting.main.time_series @@ -195,7 +195,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.opportunity.reporting.conversion @@ -271,7 +271,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.opportunity.reporting.conversion.time_series @@ -354,7 +354,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.opportunity.reporting.conversion.employee @@ -432,7 +432,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.opportunity.reporting.conversion.employee.time_series diff --git a/modules/sale_point/sale.xml b/modules/sale_point/sale.xml index ffae0b0282..3bd43b24a8 100644 --- a/modules/sale_point/sale.xml +++ b/modules/sale_point/sale.xml @@ -91,7 +91,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.point @@ -208,7 +208,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.point.sale @@ -321,7 +321,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.point.sale @@ -381,7 +381,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.point.payment.method @@ -455,7 +455,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.point.cash.transfer @@ -516,7 +516,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.point.cash.transfer.type diff --git a/modules/sale_promotion/sale.xml b/modules/sale_promotion/sale.xml index e762bf9434..fd187e5068 100644 --- a/modules/sale_promotion/sale.xml +++ b/modules/sale_promotion/sale.xml @@ -55,7 +55,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.promotion diff --git a/modules/sale_subscription/subscription.xml b/modules/sale_subscription/subscription.xml index 7964de80b8..effbf4cb90 100644 --- a/modules/sale_subscription/subscription.xml +++ b/modules/sale_subscription/subscription.xml @@ -95,7 +95,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + sale.subscription diff --git a/modules/sale_supply_drop_shipment/stock.xml b/modules/sale_supply_drop_shipment/stock.xml index 126f61c9d1..48c4221f39 100644 --- a/modules/sale_supply_drop_shipment/stock.xml +++ b/modules/sale_supply_drop_shipment/stock.xml @@ -177,8 +177,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.shipment.drop diff --git a/modules/stock/inventory.xml b/modules/stock/inventory.xml index 91e5181e7e..c237d3abaf 100644 --- a/modules/stock/inventory.xml +++ b/modules/stock/inventory.xml @@ -86,7 +86,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.inventory diff --git a/modules/stock/move.xml b/modules/stock/move.xml index 721b24e1da..e3ca9cb334 100644 --- a/modules/stock/move.xml +++ b/modules/stock/move.xml @@ -96,7 +96,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.move diff --git a/modules/stock/period.xml b/modules/stock/period.xml index 0496ad7a58..afe7a4d686 100644 --- a/modules/stock/period.xml +++ b/modules/stock/period.xml @@ -36,7 +36,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.period diff --git a/modules/stock/product.xml b/modules/stock/product.xml index 10fabfe779..e6772bf53d 100644 --- a/modules/stock/product.xml +++ b/modules/stock/product.xml @@ -79,7 +79,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + product.cost_price.revision @@ -283,7 +283,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.product_quantities_warehouse @@ -384,7 +384,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.product_quantities_warehouse.move diff --git a/modules/stock/shipment.xml b/modules/stock/shipment.xml index 66ed2c4675..4052f2cafe 100644 --- a/modules/stock/shipment.xml +++ b/modules/stock/shipment.xml @@ -862,7 +862,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.shipment.in @@ -874,7 +874,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.shipment.in.return @@ -886,7 +886,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.shipment.out @@ -898,7 +898,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.shipment.out.return @@ -910,7 +910,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.shipment.internal diff --git a/modules/stock/stock_reporting_margin.xml b/modules/stock/stock_reporting_margin.xml index 732574a47f..eb28a98fe2 100644 --- a/modules/stock/stock_reporting_margin.xml +++ b/modules/stock/stock_reporting_margin.xml @@ -79,7 +79,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.reporting.margin.main @@ -163,7 +163,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.reporting.margin.main.time_series @@ -252,7 +252,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.reporting.margin.product @@ -341,7 +341,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.reporting.margin.product.time_series @@ -474,7 +474,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.reporting.margin.category @@ -562,7 +562,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.reporting.margin.category.time_series diff --git a/modules/stock_forecast/forecast.xml b/modules/stock_forecast/forecast.xml index f439b5d422..fd0b44dcdc 100644 --- a/modules/stock_forecast/forecast.xml +++ b/modules/stock_forecast/forecast.xml @@ -88,7 +88,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.forecast diff --git a/modules/stock_location_move/stock.xml b/modules/stock_location_move/stock.xml index 9ef015fb9b..1eb45a7d37 100644 --- a/modules/stock_location_move/stock.xml +++ b/modules/stock_location_move/stock.xml @@ -23,7 +23,7 @@ this repository contains the full copyright notices and license terms. --> Movable location - + stock.location @@ -43,7 +43,7 @@ this repository contains the full copyright notices and license terms. --> Any location - + stock.location diff --git a/modules/stock_lot/stock.xml b/modules/stock_lot/stock.xml index 68511afcfe..e43ecdf69a 100644 --- a/modules/stock_lot/stock.xml +++ b/modules/stock_lot/stock.xml @@ -154,7 +154,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.lot.trace diff --git a/modules/stock_package/stock.xml b/modules/stock_package/stock.xml index cb71812ced..ca6a2a7949 100644 --- a/modules/stock_package/stock.xml +++ b/modules/stock_package/stock.xml @@ -49,7 +49,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.package diff --git a/modules/stock_quantity_early_planning/stock.xml b/modules/stock_quantity_early_planning/stock.xml index 7a26e75a1b..ebf4aa8e64 100644 --- a/modules/stock_quantity_early_planning/stock.xml +++ b/modules/stock_quantity_early_planning/stock.xml @@ -74,7 +74,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.quantity.early_plan diff --git a/modules/stock_quantity_issue/stock.xml b/modules/stock_quantity_issue/stock.xml index 899b493383..be4f3e0719 100644 --- a/modules/stock_quantity_issue/stock.xml +++ b/modules/stock_quantity_issue/stock.xml @@ -74,7 +74,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.quantity.issue diff --git a/modules/stock_supply/order_point.xml b/modules/stock_supply/order_point.xml index d6bfac5166..a68755b7ee 100644 --- a/modules/stock_supply/order_point.xml +++ b/modules/stock_supply/order_point.xml @@ -72,7 +72,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + stock.order_point diff --git a/modules/timesheet/line.xml b/modules/timesheet/line.xml index 31855da6db..da6ec855ce 100644 --- a/modules/timesheet/line.xml +++ b/modules/timesheet/line.xml @@ -62,7 +62,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + timesheet.line @@ -74,7 +74,7 @@ this repository contains the full copyright notices and license terms. --> Own timesheet line - + timesheet.line @@ -87,7 +87,7 @@ this repository contains the full copyright notices and license terms. --> Any timesheet line - + timesheet.line @@ -148,7 +148,7 @@ this repository contains the full copyright notices and license terms. --> Own hours - + timesheet.hours_employee @@ -160,7 +160,7 @@ this repository contains the full copyright notices and license terms. --> Supervised employee's hours - + timesheet.hours_employee @@ -173,7 +173,7 @@ this repository contains the full copyright notices and license terms. --> Any employee hours - + timesheet.hours_employee @@ -212,7 +212,7 @@ this repository contains the full copyright notices and license terms. --> Own hours - + timesheet.hours_employee_weekly @@ -224,7 +224,7 @@ this repository contains the full copyright notices and license terms. --> Supervised employee's hours - + timesheet.hours_employee_weekly @@ -237,7 +237,7 @@ this repository contains the full copyright notices and license terms. --> Any employee hours - + timesheet.hours_employee_weekly @@ -270,7 +270,7 @@ this repository contains the full copyright notices and license terms. --> Own hours - + timesheet.hours_employee_monthly @@ -282,7 +282,7 @@ this repository contains the full copyright notices and license terms. --> Supervised employee's hours - + timesheet.hours_employee_monthly @@ -295,7 +295,7 @@ this repository contains the full copyright notices and license terms. --> Any employee hours - + timesheet.hours_employee_monthly diff --git a/modules/timesheet/work.xml b/modules/timesheet/work.xml index 43a9ebd114..2e876d9729 100644 --- a/modules/timesheet/work.xml +++ b/modules/timesheet/work.xml @@ -104,7 +104,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + timesheet.work diff --git a/modules/web_shop/web.xml b/modules/web_shop/web.xml index 85333538b5..7c67fcf74a 100644 --- a/modules/web_shop/web.xml +++ b/modules/web_shop/web.xml @@ -38,7 +38,7 @@ this repository contains the full copyright notices and license terms. --> User in companies - + web.shop diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index 463417c0f6..03c50504e7 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Store model on ir.rule.group * Store model on ir.model.button * Store model and field name on ir.model.field.access * Store model name on ir.model.access diff --git a/trytond/trytond/ir/rule.py b/trytond/trytond/ir/rule.py index 96723d4cc4..cbce7e4272 100644 --- a/trytond/trytond/ir/rule.py +++ b/trytond/trytond/ir/rule.py @@ -17,14 +17,17 @@ class DomainError(ValidationError): pass -class RuleGroup(ModelSQL, ModelView): +class RuleGroup( + fields.fmany2one( + 'model_ref', 'model', 'ir.model,model', "Model", + required=True, ondelete='CASCADE'), + ModelSQL, ModelView): "Rule group" __name__ = 'ir.rule.group' name = fields.Char( "Name", translate=True, required=True, help="Displayed to users when access error is raised for this rule.") - model = fields.Many2One('ir.model', 'Model', - required=True, ondelete='CASCADE') + model = fields.Char("Model", required=True) global_p = fields.Boolean('Global', help="Make the rule global \nso every users must follow this rule.") default_p = fields.Boolean('Default', @@ -55,6 +58,29 @@ class RuleGroup(ModelSQL, ModelView): Index(t, (t.model, Index.Equality())), }) + @classmethod + def __register__(cls, module): + pool = Pool() + Model = pool.get('ir.model') + transaction = Transaction() + cursor = transaction.connection.cursor() + table_h = cls.__table_handler__(module) + table = cls.__table__() + model = Model.__table__() + + # Migration from 7.0: model as char + if (table_h.column_exist('model') + and table_h.column_is_type('model', 'INTEGER')): + table_h.column_rename('model', '_temp_model') + table_h.add_column('model', 'VARCHAR') + cursor.execute(*table.update( + [table.model], [model.model], + from_=[model], + where=table._temp_model == model.id)) + table_h.drop_column('_temp_model') + + super().__register__(module) + @staticmethod def default_global_p(): return True @@ -130,7 +156,7 @@ class Rule(ModelSQL, ModelView): if field_names and 'domain' not in field_names: return for rule in rules: - ctx = cls._get_context(rule.rule_group.model.model) + ctx = cls._get_context(rule.rule_group.model) try: value = PYSONDecoder(ctx).decode(rule.domain) except Exception: @@ -166,13 +192,11 @@ class Rule(ModelSQL, ModelView): "Return dictionary of non-global and global rules" pool = Pool() RuleGroup = pool.get('ir.rule.group') - Model = pool.get('ir.model') RuleGroup_Group = pool.get('ir.rule.group-res.group') User = pool.get('res.user') rule_table = cls.__table__() rule_group = RuleGroup.__table__() rule_group_group = RuleGroup_Group.__table__() - model = Model.__table__() transaction = Transaction() assert mode in cls.modes @@ -204,12 +228,10 @@ class Rule(ModelSQL, ModelView): return {}, {} cursor.execute(*rule_table.join(rule_group, condition=rule_group.id == rule_table.rule_group - ).join(model, - condition=rule_group.model == model.id ).join(rule_group_group, 'LEFT', condition=rule_group_group.rule_group == rule_group.id ).select(rule_table.id, - where=(model.model.in_(model_names)) + where=(rule_group.model.in_(model_names)) & (getattr(rule_group, 'perm_%s' % mode) == Literal(True)) & (rule_group_group.group.in_(groups or [-1]) | (rule_group.default_p == Literal(True)) @@ -218,12 +240,10 @@ class Rule(ModelSQL, ModelView): ids = [x for x, in cursor] # Test if there is no rule_group that have no rule - cursor.execute(*rule_group.join(model, - condition=rule_group.model == model.id - ).join(rule_group_group, 'LEFT', + cursor.execute(*rule_group.join(rule_group_group, 'LEFT', condition=rule_group_group.rule_group == rule_group.id ).select(rule_group.id, - where=(model.model.in_(model_names)) + 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]))) no_rules = cursor.fetchone() @@ -235,11 +255,11 @@ class Rule(ModelSQL, ModelView): rules = cls.browse(ids) for rule in rules: decoder = PYSONDecoder( - cls._get_context(rule.rule_group.model.model)) + cls._get_context(rule.rule_group.model)) assert rule.domain, ('Rule domain empty,' 'check if migration was done') dom = decoder.decode(rule.domain) - target_model = rule.rule_group.model.model + target_model = rule.rule_group.model if target_model in model2field: target_dom = ['OR'] for field in model2field[target_model]: diff --git a/trytond/trytond/ir/view/rule_group_form.xml b/trytond/trytond/ir/view/rule_group_form.xml index 7162215af9..cff058f063 100644 --- a/trytond/trytond/ir/view/rule_group_form.xml +++ b/trytond/trytond/ir/view/rule_group_form.xml @@ -2,8 +2,8 @@
-