diff --git a/modules/account/account.xml b/modules/account/account.xml
index 22c55e18e8..e0c4ae44da 100644
--- a/modules/account/account.xml
+++ b/modules/account/account.xml
@@ -214,21 +214,25 @@ this repository contains the full copyright notices and license terms. -->
-
+ account.account.type
+ amount
-
+ account.account.type
+ amount
-
+ account.account.type
+ amount_cmp
-
+ account.account.type
+ amount_cmp
@@ -511,41 +515,49 @@ this repository contains the full copyright notices and license terms. -->
-
+ account.account
+ balance
-
+ account.account
+ balance
-
+ account.account
+ credit
-
+ account.account
+ credit
-
+ account.account
+ debit
-
+ account.account
+ debit
-
+ account.account
+ amount_second_currency
-
+ account.account
+ amount_second_currency
diff --git a/modules/account/company.xml b/modules/account/company.xml
index cd99ed7157..edbff913ff 100644
--- a/modules/account/company.xml
+++ b/modules/account/company.xml
@@ -16,41 +16,49 @@ this repository contains the full copyright notices and license terms. -->
-
+ company.company
+ receivable
-
+ company.company
+ receivable
-
+ company.company
+ payable
-
+ company.company
+ payable
-
+ company.company
+ receivable_today
-
+ company.company
+ receivable_today
-
+ company.company
+ payable_today
-
+ company.company
+ payable_today
diff --git a/modules/account/party.xml b/modules/account/party.xml
index 312b5e0a13..4142c4c04f 100644
--- a/modules/account/party.xml
+++ b/modules/account/party.xml
@@ -16,60 +16,70 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ accounts
-
+ party.party
+ accounts
-
+ party.party
+ account_payable
-
+ party.party
+ account_payable
-
+ party.party
+ account_receivable
-
+ party.party
+ account_receivable
-
+ party.party
+ customer_tax_rule
-
+ party.party
+ customer_tax_rule
-
+ party.party
+ supplier_tax_rule
-
+ party.party
+ supplier_tax_rule
diff --git a/modules/account_credit_limit/account.xml b/modules/account_credit_limit/account.xml
index baacd40ccc..410ecba9ed 100644
--- a/modules/account_credit_limit/account.xml
+++ b/modules/account_credit_limit/account.xml
@@ -20,15 +20,15 @@ this repository contains the full copyright notices and license terms. -->
-
+ account.configuration
+ default_credit_limit_amount
-
+ account.configuration
+ default_credit_limit_amount
diff --git a/modules/account_credit_limit/party.xml b/modules/account_credit_limit/party.xml
index f7ff13dbd8..8696c7494b 100644
--- a/modules/account_credit_limit/party.xml
+++ b/modules/account_credit_limit/party.xml
@@ -11,15 +11,15 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ credit_limit_amount
-
+ party.party
+ credit_limit_amount
diff --git a/modules/account_payment_braintree/account.xml b/modules/account_payment_braintree/account.xml
index 3abad87842..bf9cef9c75 100644
--- a/modules/account_payment_braintree/account.xml
+++ b/modules/account_payment_braintree/account.xml
@@ -73,7 +73,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ account.payment.braintree.account
+ private_key
@@ -81,7 +82,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ account.payment.braintree.account
+ private_key
diff --git a/modules/account_payment_stripe/payment.xml b/modules/account_payment_stripe/payment.xml
index 5c13ad8121..b23cffddc8 100644
--- a/modules/account_payment_stripe/payment.xml
+++ b/modules/account_payment_stripe/payment.xml
@@ -185,8 +185,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ account.payment.stripe.account
+ secret_key
@@ -194,8 +194,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ account.payment.stripe.account
+ secret_key
diff --git a/modules/account_product/product.xml b/modules/account_product/product.xml
index da08d26588..dadd782060 100644
--- a/modules/account_product/product.xml
+++ b/modules/account_product/product.xml
@@ -50,12 +50,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ product.template
+ account_category
-
+ product.template
+ account_category
diff --git a/modules/account_stock_eu/stock.xml b/modules/account_stock_eu/stock.xml
index 66dc6da0b2..15f8964a3c 100644
--- a/modules/account_stock_eu/stock.xml
+++ b/modules/account_stock_eu/stock.xml
@@ -10,108 +10,126 @@ this repository contains the full copyright notices and license terms. -->
-
+ stock.move
+ intrastat_type
-
+ stock.move
+ intrastat_type
-
+ stock.move
+ intrastat_warehouse_country
-
+ stock.move
+ intrastat_warehouse_country
-
+ stock.move
+ intrastat_country
-
+ stock.move
+ intrastat_country
-
+ stock.move
+ intrastat_subdivision
-
+ stock.move
+ intrastat_subdivision
-
+ stock.move
+ intrastat_tariff_code
-
+ stock.move
+ intrastat_tariff_code
-
+ stock.move
+ intrastat_transaction
-
+ stock.move
+ intrastat_transaction
-
+ stock.move
+ intrastat_additional_unit
-
+ stock.move
+ intrastat_additional_unit
-
+ stock.move
+ intrastat_country_of_origin
-
+ stock.move
+ intrastat_country_of_origin
-
+ stock.move
+ intrastat_vat
-
+ stock.move
+ intrastat_vat
@@ -126,24 +144,28 @@ this repository contains the full copyright notices and license terms. -->
-
+ stock.move
+ intrastat_transport
-
+ stock.move
+ intrastat_transport
-
+ stock.move
+ intrastat_incoterm
-
+ stock.move
+ intrastat_incoterm
diff --git a/modules/account_tax_cash/party.xml b/modules/account_tax_cash/party.xml
index 7744c5dc45..fb07691c3e 100644
--- a/modules/account_tax_cash/party.xml
+++ b/modules/account_tax_cash/party.xml
@@ -10,12 +10,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ supplier_tax_group_on_cash_basis
-
+ party.party
+ supplier_tax_group_on_cash_basis
diff --git a/modules/bank/party.xml b/modules/bank/party.xml
index fdcfd5d681..67aa31ee26 100644
--- a/modules/bank/party.xml
+++ b/modules/bank/party.xml
@@ -10,7 +10,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ bank_accounts
@@ -18,7 +19,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ bank_accounts
diff --git a/modules/currency_rs/currency.xml b/modules/currency_rs/currency.xml
index 27adb7f4bc..a108c3bd1a 100644
--- a/modules/currency_rs/currency.xml
+++ b/modules/currency_rs/currency.xml
@@ -10,7 +10,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ currency.cron
+ rs_password
@@ -18,7 +19,8 @@ this repository contains the full copyright notices and license terms. -->
-
+ currency.cron
+ rs_password
diff --git a/modules/purchase/party.xml b/modules/purchase/party.xml
index 96f7cd8ed0..bbe0aa47a0 100644
--- a/modules/purchase/party.xml
+++ b/modules/purchase/party.xml
@@ -10,12 +10,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ supplier_currency
-
+ party.party
+ supplier_currency
diff --git a/modules/purchase/purchase.xml b/modules/purchase/purchase.xml
index 418088bc25..44caaf9762 100644
--- a/modules/purchase/purchase.xml
+++ b/modules/purchase/purchase.xml
@@ -286,12 +286,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ purchase.purchase
+ invoices_ignored
-
+ purchase.purchase
+ invoices_ignored
@@ -499,12 +501,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ purchase.line
+ moves_ignored
-
+ purchase.line
+ moves_ignored
diff --git a/modules/sale/party.xml b/modules/sale/party.xml
index 87cfb22ddd..eaf6d4bfc4 100644
--- a/modules/sale/party.xml
+++ b/modules/sale/party.xml
@@ -22,36 +22,42 @@ this repository contains the full copyright notices and license terms. -->
icon="tryton-list"/>
-
+ party.party
+ sale_invoice_method
-
+ party.party
+ sale_invoice_method
-
+ party.party
+ sale_shipment_method
-
+ party.party
+ sale_shipment_method
-
+ party.party
+ customer_currency
-
+ party.party
+ customer_currency
diff --git a/modules/sale/sale.xml b/modules/sale/sale.xml
index 4003131b1b..569493703d 100644
--- a/modules/sale/sale.xml
+++ b/modules/sale/sale.xml
@@ -272,12 +272,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ sale.sale
+ invoices_ignored
-
+ sale.sale
+ invoices_ignored
@@ -429,12 +431,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ sale.line
+ moves_ignored
-
+ sale.line
+ moves_ignored
diff --git a/modules/sale_invoice_date/party.xml b/modules/sale_invoice_date/party.xml
index eb27aadfd3..8d1724cb5e 100644
--- a/modules/sale_invoice_date/party.xml
+++ b/modules/sale_invoice_date/party.xml
@@ -10,12 +10,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ sale_invoice_term
-
+ party.party
+ sale_invoice_term
diff --git a/modules/sale_price_list/party.xml b/modules/sale_price_list/party.xml
index 173fe57028..b43129aace 100644
--- a/modules/sale_price_list/party.xml
+++ b/modules/sale_price_list/party.xml
@@ -11,24 +11,28 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ sale_price_lists
-
+ party.party
+ sale_price_lists
-
+ party.party
+ sale_price_list
-
+ party.party
+ sale_price_list
diff --git a/modules/sale_shipment_cost/party.xml b/modules/sale_shipment_cost/party.xml
index 3e17f554da..e2a83849f8 100644
--- a/modules/sale_shipment_cost/party.xml
+++ b/modules/sale_shipment_cost/party.xml
@@ -10,12 +10,14 @@ this repository contains the full copyright notices and license terms. -->
-
+ party.party
+ sale_shipment_cost_method
-
+ party.party
+ sale_shipment_cost_method
diff --git a/modules/timesheet_cost/company.xml b/modules/timesheet_cost/company.xml
index ca2018685b..c1755fcd50 100644
--- a/modules/timesheet_cost/company.xml
+++ b/modules/timesheet_cost/company.xml
@@ -38,15 +38,15 @@ this repository contains the full copyright notices and license terms. -->
-
+ company.employee
+ cost_price
-
+ company.employee
+ cost_price
diff --git a/modules/timesheet_cost/timesheet.xml b/modules/timesheet_cost/timesheet.xml
index c8b33c898c..8dac0e6733 100644
--- a/modules/timesheet_cost/timesheet.xml
+++ b/modules/timesheet_cost/timesheet.xml
@@ -5,15 +5,15 @@ this repository contains the full copyright notices and license terms. -->
-
+ timesheet.line
+ cost_price
-
+ timesheet.line
+ cost_price
diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG
index 388d273fb4..d37c6cc29b 100644
--- a/trytond/CHANGELOG
+++ b/trytond/CHANGELOG
@@ -1,3 +1,4 @@
+* Store model and field name on ir.model.field.access
* Store model name on ir.model.access
* Store model name on ir.model.field
* Add fmany2one field
diff --git a/trytond/trytond/ir/model.py b/trytond/trytond/ir/model.py
index 9de0ead356..f8ec1876a4 100644
--- a/trytond/trytond/ir/model.py
+++ b/trytond/trytond/ir/model.py
@@ -740,11 +740,21 @@ class ModelAccess(
ModelView._fields_view_get_cache.clear()
-class ModelFieldAccess(DeactivableMixin, ModelSQL, ModelView):
+class ModelFieldAccess(
+ fields.fmany2one(
+ 'model_ref', 'model', 'ir.model,model', "Model",
+ required=True, ondelete='CASCADE'),
+ fields.fmany2one(
+ 'field_ref', 'field,model', 'ir.model.field,name,model', "Field",
+ required=True, ondelete='CASCADE',
+ domain=[
+ ('model', '=', Eval('model')),
+ ]),
+ DeactivableMixin, ModelSQL, ModelView):
"Model Field Access"
__name__ = 'ir.model.field.access'
- field = fields.Many2One('ir.model.field', 'Field', required=True,
- ondelete='CASCADE')
+ model = fields.Char("Model", required=True)
+ field = fields.Char("Field", required=True)
group = fields.Many2One('res.group', 'Group', ondelete='CASCADE')
perm_read = fields.Boolean('Read Access')
perm_write = fields.Boolean('Write Access')
@@ -756,7 +766,32 @@ class ModelFieldAccess(DeactivableMixin, ModelSQL, ModelView):
@classmethod
def __setup__(cls):
super().__setup__()
- cls.__access__.add('field')
+ cls.__access__.add('field_ref')
+
+ @classmethod
+ def __register__(cls, module):
+ pool = Pool()
+ Field = pool.get('ir.model.field')
+ transaction = Transaction()
+ cursor = transaction.connection.cursor()
+ table_h = cls.__table_handler__(module)
+ table = cls.__table__()
+ field = Field.__table__()
+
+ # Migration from 7.0: field as char
+ if (table_h.column_exist('field')
+ and table_h.column_is_type('field', 'INTEGER')):
+ table_h.column_rename('field', '_temp_field')
+ table_h.add_column('model', 'VARCHAR')
+ table_h.add_column('field', 'VARCHAR')
+ cursor.execute(*table.update(
+ [table.model, table.field],
+ [field.model, field.name],
+ from_=[field],
+ where=table._temp_field == field.id))
+ table_h.drop_column('_temp_field')
+
+ super().__register__(module)
@classmethod
def check_xml_record(cls, field_accesses, values):
@@ -779,11 +814,11 @@ class ModelFieldAccess(DeactivableMixin, ModelSQL, ModelView):
return True
def get_rec_name(self, name):
- return self.field.rec_name
+ return self.field_ref.rec_name
@classmethod
def search_rec_name(cls, name, clause):
- return [('field',) + tuple(clause[1:])]
+ return [('field_ref.rec_name', *clause[1:])]
@classmethod
def get_access(cls, models):
@@ -794,10 +829,8 @@ class ModelFieldAccess(DeactivableMixin, ModelSQL, ModelView):
lambda: defaultdict(lambda: True)))
pool = Pool()
- ModelField = pool.get('ir.model.field')
User = pool.get('res.user')
field_access = cls.__table__()
- model_field = ModelField.__table__()
groups = User.get_groups()
@@ -813,11 +846,9 @@ class ModelFieldAccess(DeactivableMixin, ModelSQL, ModelView):
default = {}
accesses = dict((m, default) for m in models)
cursor = Transaction().connection.cursor()
- cursor.execute(*field_access.join(model_field,
- condition=field_access.field == model_field.id
- ).select(
- model_field.model,
- model_field.name,
+ cursor.execute(*field_access.select(
+ field_access.model,
+ field_access.field,
Max(Case(
(field_access.perm_read == Literal(True), 1),
else_=0)),
@@ -830,11 +861,11 @@ class ModelFieldAccess(DeactivableMixin, ModelSQL, ModelView):
Max(Case(
(field_access.perm_delete == Literal(True), 1),
else_=0)),
- where=model_field.model.in_(models)
+ where=field_access.model.in_(models)
& (field_access.active == Literal(True))
& (field_access.group.in_(groups or [-1])
| (field_access.group == Null)),
- group_by=[model_field.model, model_field.name]))
+ 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():
diff --git a/trytond/trytond/ir/model.xml b/trytond/trytond/ir/model.xml
index 91e77abdc3..743b00f721 100644
--- a/trytond/trytond/ir/model.xml
+++ b/trytond/trytond/ir/model.xml
@@ -154,7 +154,7 @@ this repository contains the full copyright notices and license terms. -->
Access
ir.model.field.access