I'm passing value from model A to model view trough context parameter in the xml view, but when I save the record created on model B the value passed through context isn't saved, here's my code:
Model A view.xml [extract]
<notebook>
<page string="Etiquetas">
<field name="tag_ids" context="{'feature_id':feature_id}"/>
</page>
</notebook>
Model A
from openerp import models,fields,api
from openerp.exceptions import ValidationError
class version(models.Model):
_name = "version"
_rec_name = "description"
description = fields.Char(size=4,string="Descripción")
feature_id = fields.Many2one('feature', string="Característica")
father_feature_id = fields.Many2one(related="feature_id.father_id",store=True)
tag_ids = fields.One2many('tag','version_id',string="Etiquetas", ondelete="cascade")
Model B
from openerp import models,fields,api
from openerp.osv.fields import related
class tag(models.Model):
_name = "tag"
_rec_name = "label"
_order = "sequence"
label = fields.Char(required=True,size=50,string="Etiqueta")
version_id = fields.Many2one('version',required=True,string="Versión")
feature_id = fields.Many2one('feature',string="Característica",store=True)
alternative_id = fields.Many2one('alternative',required=True,string="Alternativa",domain="[('feature_id','=',feature_id)]")
father_feature_rel = fields.Many2one(related="feature_id.father_id")
father_id = fields.Many2one('tag',string="Padre",domain="[('feature_id','=',father_feature_rel)]")
sequence = fields.Integer(default=0,string="Secuencia")
I've tried to filter using a related field in Model B but doesn't work because the context passed isn't saved into model.