Add module Many2One

This commit is contained in:
Cédric Krier
2024-02-25 13:49:05 +01:00
parent a42777834e
commit ff7cd065ad
17 changed files with 57 additions and 27 deletions
+4 -1
View File
@@ -472,6 +472,9 @@ class ActionReport(
fields.fmany2one(
'model_ref', 'model', 'ir.model,model', "Model",
ondelete='CASCADE'),
fields.fmany2one(
'module_ref', 'module', 'ir.module,name', "Module",
readonly=True, ondelete='CASCADE'),
ActionMixin, ModelSQL, ModelView):
"Action report"
__name__ = 'ir.action.report'
@@ -619,7 +622,7 @@ class ActionReport(
@staticmethod
def default_module():
return Transaction().context.get('module') or ''
return Transaction().context.get('module')
def get_is_custom(self, name):
return bool(self.report_content_custom)
+15 -5
View File
@@ -39,7 +39,12 @@ class ConditionError(ValidationError):
pass
class Model(ModelSQL, ModelView):
class Model(
fields.fmany2one(
'module_ref', 'module', 'ir.module,name', "Module",
readonly=True, ondelete='CASCADE',
help="Module in which this model is defined."),
ModelSQL, ModelView):
"Model"
__name__ = 'ir.model'
_order_name = 'model'
@@ -58,8 +63,7 @@ class Model(ModelSQL, ModelView):
'readonly': Bool(Eval('module')),
},
depends=['module'])
module = fields.Char('Module',
help="Module in which this model is defined.", readonly=True)
module = fields.Char("Module", readonly=True)
global_search_p = fields.Boolean('Global Search')
fields = fields.One2Many('ir.model.field', 'model_ref', "Fields")
_get_names_cache = Cache('ir.model.get_names')
@@ -224,6 +228,10 @@ class ModelField(
fields.fmany2one(
'model_ref', 'model', 'ir.model,model', "Model",
required=True, ondelete='CASCADE'),
fields.fmany2one(
'module_ref', 'module', 'ir.module,name', "Module",
readonly=True, ondelete='CASCADE',
help="Module in which this field is defined."),
ModelSQL, ModelView):
"Model field"
__name__ = 'ir.model.field'
@@ -258,8 +266,7 @@ class ModelField(
'readonly': Bool(Eval('module')),
},
depends=['module'])
module = fields.Char('Module',
help="Module in which this field is defined.")
module = fields.Char("Module", readonly=True)
access = fields.Boolean(
"Access",
states={
@@ -1268,6 +1275,9 @@ class ModelData(
fields.fmany2one(
'model_ref', 'model', 'ir.model,model', "Model",
required=True, ondelete='CASCADE'),
fields.fmany2one(
'module_ref', 'module', 'ir.module,name', "Module",
required=True, ondelete='CASCADE'),
ModelSQL, ModelView):
"Model data"
__name__ = 'ir.model.data'
+8 -1
View File
@@ -57,7 +57,14 @@ class TrytonPOFile(polib.POFile):
key=lambda x: (x.msgctxt, x.msgid))
class Translation(ModelSQL, ModelView):
class Translation(
fields.fmany2one(
'module_ref', 'module', 'ir.module,name', "Module",
readonly=True, ondelete='CASCADE'),
fields.fmany2one(
'overriding_module_ref', 'overriding_module', 'ir.module,name',
"Overriding Module", readonly=True),
ModelSQL, ModelView):
"Translation"
__name__ = "ir.translation"
+5 -1
View File
@@ -10,7 +10,11 @@ from trytond.tools import file_open
from trytond.transaction import Transaction
class Icon(sequence_ordered(), ModelSQL, ModelView):
class Icon(
fields.fmany2one(
'module_ref', 'module', 'ir.module,name', "Module",
readonly=True, required=True, ondelete='CASCADE'),
sequence_ordered(), ModelSQL, ModelView):
'Icon'
__name__ = 'ir.ui.icon'
+3
View File
@@ -37,6 +37,9 @@ class View(
states={
'invisible': Eval('type') != 'tree',
}),
fields.fmany2one(
'module_ref', 'module', 'ir.module,name', "Module",
readonly=True, ondelete='CASCADE'),
ModelSQL, ModelView):
"View"
__name__ = 'ir.ui.view'
@@ -13,12 +13,13 @@ this repository contains the full copyright notices and license terms. -->
<xpath expr="//page[@id='general']" position="inside">
<label name="model_ref"/>
<field name="model_ref"/>
<label name="module_ref"/>
<field name="module_ref"/>
<label name="report_name"/>
<field name="report_name"/>
<label name="record_name"/>
<field name="record_name"/>
<newline/>
<label name="report_content"/>
<group col="-1" id="report_content">
+2 -2
View File
@@ -8,8 +8,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="name"/>
<label name="sequence"/>
<field name="sequence"/>
<label name="module"/>
<field name="module"/>
<label name="module_ref"/>
<field name="module_ref"/>
<label name="path"/>
<field name="path"/>
</group>
+1 -1
View File
@@ -3,6 +3,6 @@
this repository contains the full copyright notices and license terms. -->
<tree sequence="sequence">
<field name="name" icon="name" expand="2"/>
<field name="module" optional="0"/>
<field name="module_ref" optional="1"/>
<field name="path" expand="1" optional="1"/>
</tree>
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="module" optional="0"/>
<field name="module_ref"/>
<field name="model_ref" expand="1"/>
<field name="fs_id" expand="1"/>
<field name="db_id" optional="1"/>
+2 -2
View File
@@ -16,6 +16,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="help" colspan="3"/>
<label name="access"/>
<field name="access"/>
<label name="module"/>
<field name="module"/>
<label name="module_ref"/>
<field name="module_ref"/>
</form>
+1 -1
View File
@@ -8,5 +8,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="relation" expand="1" optional="1"/>
<field name="field_description" expand="1" optional="0"/>
<field name="access" optional="1"/>
<field name="module" optional="0"/>
<field name="module_ref" optional="1"/>
</tree>
+2 -2
View File
@@ -6,8 +6,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="name"/>
<label name="model"/>
<field name="model"/>
<label name="module"/>
<field name="module"/>
<label name="module_ref"/>
<field name="module_ref"/>
<label name="global_search_p"/>
<field name="global_search_p"/>
<separator name="info" colspan="6"/>
+1 -1
View File
@@ -6,5 +6,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="model" expand="1"/>
<field name="info" expand="1" optional="1"/>
<field name="global_search_p"/>
<field name="module" optional="0"/>
<field name="module_ref" optional="1"/>
</tree>
+4 -4
View File
@@ -12,10 +12,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="fuzzy"/>
<label name="lang"/>
<field name="lang"/>
<label name="module"/>
<field name="module"/>
<label name="overriding_module"/>
<field name="overriding_module"/>
<label name="module_ref"/>
<field name="module_ref"/>
<label name="overriding_module_ref"/>
<field name="overriding_module_ref"/>
<group col="2" colspan="6" yexpand="1" yfill="1" id="src_value">
<separator name="src"/>
<separator name="value"/>
+2 -1
View File
@@ -9,5 +9,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="lang"/>
<field name="type" optional="1"/>
<field name="res_id" optional="1"/>
<field name="module" optional="0"/>
<field name="module_ref" optional="1"/>
<field name="overriding_module_ref" optional="1"/>
</tree>
+2 -2
View File
@@ -14,8 +14,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="priority"/>
<label name="field_children"/>
<field name="field_children"/>
<label name="module"/>
<field name="module"/>
<label name="module_ref"/>
<field name="module_ref"/>
<label name="name"/>
<field name="name"/>
<separator name="arch" colspan="4"/>
+1
View File
@@ -8,4 +8,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="inherit" expand="1" optional="0"/>
<field name="domain" expand="1" optional="1"/>
<field name="field_children" optional="1"/>
<field name="module_ref" optional="1"/>
</tree>