Hi !
I've created a simple module on Odoo v8, with two objects:
class repas(osv.osv):
_name = 'repas'
_description = 'Repas de chocapic'
_columns = {
'name': fields.char('Nom'),
'quantity' : fields.integer(u'Quantité'),
'bol_id': fields.many2one('bol',u'Bol utilisé'),
}
_defaults = {
'quantity': 0,
}class bol(osv.osv):
_name = 'bol'
_columns = {
'name': fields.char('Nom de mon bol'),
'repas_ids': fields.one2many('repas','bol_id','Repas'),
}
With this view:
<record id="bol_form_view" model="ir.ui.view">
<field name="name">bol.form</field>
<field name="model">bol</field>
<field name="arch" type="xml">
<form string="Bol">
<sheet>
<group>
<field name="name"/>
</group>
<group>
<field name="repas_ids"/>
</group>
</sheet>
</form>
</field>
</record>
When I create a "bol", I can't select an existing "repas" and I must create one, but I've a one2many relation on this !
Anyone have this problem too ? Or a solution ?
Thank you