I'm beginning to play around more with OE and just trying to explore making a simple(so I would think) module, but I have seemed get stuck on displaying the grid(view field).
In the "Almost Complete" you can see in the grid I'm missing VALUE for the parametric
My other question, when I select "Component Type" could I get the grid(Parametrics) pre-populate with a set of Parametric Type's that are assigned to say Resistor in this example?
Almost Complete: (remove the {}) http://i{.}imgur{.}com{/}UxQCIfi.png
Here is my code:
tilparts.py:
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class tilparts_componenttype(osv.osv):
_name = 'tilparts.componenttype'
_rec_name='component_type'
_columns = {
'component_type': fields.char('Component Type',size=32),
}
tilparts_componenttype()
class tilparts_part(osv.osv):
_name = 'tilparts.part'
_rec_name='partno'
_columns = {
'partno': fields.char('Part Number',size=48),
'componenttype_ids': fields.many2one('tilparts.componenttype','Component Type',select=True),
'parameter_ids': fields.one2many('tilparts.parameter','parametrics_id',string='Parametrics',select=True),
}
tilparts_part()
class tilparts_parameter(osv.osv):
_name = 'tilparts.parameter'
_rec_name='parametrics_id'
_columns = {
'parametrics_id': fields.many2one('tilparts.parametrics','Parametric Type', ondelete='cascade'),
'value': fields.char('Value',size=16),
}
tilparts_parameter()
class tilparts_parametrics(osv.osv):
_name = 'tilparts.parametrics'
_rec_name='parametric_type'
_columns = {
'parametric_type': fields.char('Parametric Type',size=16,required=False,ondelete='cascade'),
'componenttype_ids': fields.many2one('tilparts.componenttype','Component Type',required=False,ondelete='cascade'),
}
tilparts_parametrics()
tilparts_view.xml
<?xml version="1.0" ?>
<openerp>
<data>
<record model="ir.ui.view" id="part_form">
<field name="name">part.form</field>
<field name="model">tilparts.part</field>
<field name="arch" type="xml">
<form string="Part" version="7.0">
<sheet>
<group>
<group>
<field name="partno"/>
</group>
<group>
<field name="componenttype_ids"/>
</group>
</group>
<notebook colspan="6">
<page string="Parametrics">
<field name="parameter_ids"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="part_tree">
<field name="name">part.tree</field>
<field name="model">tilparts.part</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Part" >
<field name="partno"/>
<field name="componenttype_ids"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_part">
<field name="name">Parts</field>
<field name="res_model">tilparts.part</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="tilparts" name="TIL Parts"/>
<menuitem name="TiL Parts" id="section_main_menu_tilparts" parent="tilparts" />
<menuitem name="Parts" id="choice_part" parent="section_main_menu_tilparts" action="action_part"/>
</data>
</openerp>
This project was scrapped so nothing was completed