Browse Source

[IMP][8.0] base_custom_info: Actions and menus. Refactor strings Info to Property

pull/313/head
Carlos Incaser 9 years ago
committed by Jairo Llopis
parent
commit
8724d54fb0
  1. 1
      base_custom_info/__openerp__.py
  2. 10
      base_custom_info/models/custom_info_template.py
  3. 81
      base_custom_info/views/custom_info_template_view.xml

1
base_custom_info/__openerp__.py

@ -12,6 +12,7 @@
'base', 'base',
], ],
'data': [ 'data': [
'views/custom_info_template_view.xml'
], ],
'author': 'Antiun Ingeniería S.L., ' 'author': 'Antiun Ingeniería S.L., '
'Incaser Informatica S.L., ', 'Incaser Informatica S.L., ',

10
base_custom_info/models/custom_info_template.py

@ -14,7 +14,7 @@ class CustomInfoTemplate(models.Model):
info_ids = fields.One2many( info_ids = fields.One2many(
comodel_name='custom.info.template.line', comodel_name='custom.info.template.line',
inverse_name='template_id', inverse_name='template_id',
string='Info')
string='Properties')
class CustomInfoTemplateLine(models.Model): class CustomInfoTemplateLine(models.Model):
@ -27,7 +27,7 @@ class CustomInfoTemplateLine(models.Model):
info_value_ids = fields.One2many( info_value_ids = fields.One2many(
comodel_name="custom.info.value", comodel_name="custom.info.value",
inverse_name="custom_info_name_id", inverse_name="custom_info_name_id",
string="Info Values")
string="Property Values")
class CustomInfoValue(models.Model): class CustomInfoValue(models.Model):
@ -38,7 +38,7 @@ class CustomInfoValue(models.Model):
res_id = fields.Integer(select=True) res_id = fields.Integer(select=True)
custom_info_name_id = fields.Many2one( custom_info_name_id = fields.Many2one(
comodel_name='custom.info.template.line', comodel_name='custom.info.template.line',
string='Info Name')
string='Property Name')
value = fields.Char() value = fields.Char()
@ -47,13 +47,13 @@ class CustomInfo(models.AbstractModel):
custom_info_template_id = fields.Many2one( custom_info_template_id = fields.Many2one(
comodel_name='custom.info.template', comodel_name='custom.info.template',
string='Info Template')
string='Property Template')
custom_info_ids = fields.One2many( custom_info_ids = fields.One2many(
comodel_name='custom.info.value', comodel_name='custom.info.value',
inverse_name='res_id', inverse_name='res_id',
domain=lambda self: [('model', '=', self._name)], domain=lambda self: [('model', '=', self._name)],
auto_join=True, auto_join=True,
string='Custom Info')
string='Custom Properties')
@api.onchange('custom_info_template_id') @api.onchange('custom_info_template_id')
def _onchange_custom_info_template_id(self): def _onchange_custom_info_template_id(self):

81
base_custom_info/views/custom_info_template_view.xml

@ -2,15 +2,29 @@
<openerp> <openerp>
<data> <data>
<!--base.custom.info.template-->
<record id="base_custom_info_template_tree" model="ir.ui.view">
<field name="name">base.custom.info.template.tree</field>
<field name="model">custom.info.template</field>
<field name="arch" type="xml">
<tree string="Custom Info Templates">
<field name="name"/>
<field name="model_id"/>
<field name="info_ids"/>
</tree>
</field>
</record>
<record id="base_custom_info_template_form" model="ir.ui.view"> <record id="base_custom_info_template_form" model="ir.ui.view">
<field name="name">base.custom.info.template.form</field> <field name="name">base.custom.info.template.form</field>
<field name="model">base.custom.info.template</field>
<field name="model">custom.info.template</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Custom Info Template"> <form string="Custom Info Template">
<sheet> <sheet>
<group> <group>
<field name="name"/> <field name="name"/>
<field name="model"/>
<field name="model_id"/>
</group> </group>
<group> <group>
<field name="info_ids"> <field name="info_ids">
@ -24,21 +38,46 @@
</field> </field>
</record> </record>
<record id="base_custom_info_template_tree" model="ir.ui.view">
<field name="name">base.custom.info.template.tree</field>
<field name="model">base.custom.info.template</field>
<record id="custom_info_template_action" model="ir.actions.act_window">
<field name="name">Templates</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">custom.info.template</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/> <!-- Force empty -->
<field name="domain" eval="False"/> <!-- Force empty -->
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new custom info template.
</p><p>
You must define a custom info template for every different
product properties group.
</p>
</field>
</record>
<menuitem id="menu_base_custom_info" name="Custom Info"
parent="base.menu_administration" sequence="45"/>
<menuitem id="menu_base_custom_info_template" action="custom_info_template_action"
parent="menu_base_custom_info" sequence="5"/>
<!--base.custom.info.template.line-->
<record id="base_custom_info_template_line_tree" model="ir.ui.view">
<field name="name">base.custom.info.template.line.tree</field>
<field name="model">custom.info.template.line</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Custom Info Templates"> <tree string="Custom Info Templates">
<field name="name"/> <field name="name"/>
<field name="model_id"/>
<field name="info_ids"/>
<field name="template_id"/>
</tree> </tree>
</field> </field>
</record> </record>
<record id="base_custom_info_template_line_form" model="ir.ui.view"> <record id="base_custom_info_template_line_form" model="ir.ui.view">
<field name="name">base.custom.info.template.line.form</field> <field name="name">base.custom.info.template.line.form</field>
<field name="model">base.custom.info.template.line</field>
<field name="model">custom.info.template.line</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Custom Info Template Lines"> <form string="Custom Info Template Lines">
<sheet> <sheet>
@ -54,9 +93,22 @@
</field> </field>
</record> </record>
<record id="custom_info_template_line_action" model="ir.actions.act_window">
<field name="name">Properties</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">custom.info.template.line</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
</record>
<menuitem id="menu_base_custom_info_template_line" action="custom_info_template_line_action"
parent="menu_base_custom_info" sequence="10"/>
<!--base.custom.info.value-->
<record id="base_custom_info_value_tree" model="ir.ui.view"> <record id="base_custom_info_value_tree" model="ir.ui.view">
<field name="name">base.custom.info.value.tree</field> <field name="name">base.custom.info.value.tree</field>
<field name="model">base.custom.info.value</field>
<field name="model">custom.info.value</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Custom Info Values"> <tree string="Custom Info Values">
<field name="custom_info_name_id"/> <field name="custom_info_name_id"/>
@ -67,5 +119,16 @@
</field> </field>
</record> </record>
<record id="custom_info_value_action" model="ir.actions.act_window">
<field name="name">Values</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">custom.info.value</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
</record>
<menuitem id="menu_base_custom_info_value" action="custom_info_value_action"
parent="menu_base_custom_info" sequence="15"/>
</data> </data>
</openerp> </openerp>
Loading…
Cancel
Save