From 93548ccf9641c6c730bc6bd1af69a22c152de9e7 Mon Sep 17 00:00:00 2001 From: Carlos Incaser Date: Wed, 9 Dec 2015 19:42:19 +0100 Subject: [PATCH] [ADD][8.0] base_custom_info: Views --- .../models/custom_info_template.py | 19 +++--- .../views/custom_info_template_view.xml | 65 +++++++++++++++++++ 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/base_custom_info/models/custom_info_template.py b/base_custom_info/models/custom_info_template.py index 69a30b822..37fb7fc45 100644 --- a/base_custom_info/models/custom_info_template.py +++ b/base_custom_info/models/custom_info_template.py @@ -10,9 +10,7 @@ class CustomInfoTemplate(models.Model): _name = "custom.info.template" name = fields.Char() - model_id = fields.Many2one( - comodel_name='ir.model', - default=lambda self: self._name) #TODO:Fix integer + model_id = fields.Many2one(comodel_name='ir.model', string='Data Model') info_ids = fields.One2many( comodel_name='custom.info.template.line', inverse_name='template_id', @@ -24,7 +22,12 @@ class CustomInfoTemplateLine(models.Model): name = fields.Char() template_id = fields.Many2one( - comodel_name='custom.info.template') + comodel_name='custom.info.template', + string='Template') + info_value_ids = fields.One2many( + comodel_name="custom.info.value", + inverse_name="custom_info_name_id", + string="Info Values") class CustomInfoValue(models.Model): @@ -34,7 +37,8 @@ class CustomInfoValue(models.Model): model = fields.Char(select=True) res_id = fields.Integer(select=True) custom_info_name_id = fields.Many2one( - comodel_name='custom.info.template.line') + comodel_name='custom.info.template.line', + string='Info Name') value = fields.Char() @@ -49,7 +53,7 @@ class CustomInfo(models.AbstractModel): inverse_name='res_id', domain=lambda self: [('model', '=', self._name)], auto_join=True, - string='Info') + string='Custom Info') @api.onchange('custom_info_template_id') def _onchange_custom_info_template_id(self): @@ -61,6 +65,5 @@ class CustomInfo(models.AbstractModel): if info_name not in info_list: self.custom_info_ids |= self.custom_info_ids.new({ 'model': self._name, - # 'res_id': self.id, 'custom_info_name_id': info_name.id, - }) \ No newline at end of file + }) diff --git a/base_custom_info/views/custom_info_template_view.xml b/base_custom_info/views/custom_info_template_view.xml index b3570a73d..660577421 100644 --- a/base_custom_info/views/custom_info_template_view.xml +++ b/base_custom_info/views/custom_info_template_view.xml @@ -2,5 +2,70 @@ + + base.custom.info.template.form + base.custom.info.template + +
+ + + + + + + + + + + + + +
+
+
+ + + base.custom.info.template.tree + base.custom.info.template + + + + + + + + + + + base.custom.info.template.line.form + base.custom.info.template.line + +
+ + + + + + + + + +
+
+
+ + + base.custom.info.value.tree + base.custom.info.value + + + + + + + + + +