This question has been flagged
1 Reply
3533 Views

hay guys .... iam trying to pass a value from e context in my pop up view like is showed above..

class dotcom_movimento_custo_reflexao(osv.osv):

_name='dotcom.contabilidade.movimento.custo.fluxo'
_columns={
    'conta_origem_id':fields.many2one('dotcom.contabilidade.lancamentos.diarios','Conta Origem'),
    'plano_centro_id':fields.many2one('dotcom.contabilidade.centros.custos','Plano de C. Custo'),
    'centro_id':fields.many2one('dotcom.contabilidade.conta.centro.custos','C. Custo'),
    'valor':fields.float('Valor',required=True),
    'valor_reduzido':fields.float('Valor',required=True),
    'movimento_reflexao_id':fields.many2one('dotcom.contabilidade.movimentos','Movimentos'),
    'lancamento_custo_id':fields.many2one('dotcom.contabilidade.lancamento.movimento.custo','Lancamento'),
    'natureza':fields.selection([('debito','D'),('credito','C')],'Natureza',readonly=False),
    'percentagem':fields.float('Percentagem (%)'),
    'state':fields.selection([('pai','pai'),('filho','filho')]),
    'parente_sup':fields.many2one('dotcom.contabilidade.movimento.custo.fluxo','Parente'),
    'acerto':fields.selection([('all','MP/MS'),('mp','MP'),('ms','MS')],'Conversão Moeda',help='*MP - Moeda Principal\n*MS - Moeda Secundária'),
}

_default={
    'state': 'filho',
    'conta_origem_id': lambda self, cr, uid, c: c.get('conta_origem_id', False),
    'valor': lambda self, cr, uid, c: c.get('valor', False),
    'movimento_reflexao_id': lambda self, cr, uid, c: c.get('movimento_reflexao_id', False),
}
_rec_name='natureza'
<form string="Lancamentos"> <group col="6"> <field name="conta_id"/> <field name="valor_origem"/> <field name="plano_centro_id" invisible="1"/> <field name="natureza"/> <field colspan="6" name="lancamentos_reflexao_custo_ids" widget="one2many_list" nolabel="1" domain="['movimento_reflexao_id', '=', active_id]" context="{'movimento_reflexao_id': active_id}"> <tree editable="bottom"> <field name="conta_origem_id" invisible="1"/> <field name="plano_centro_id" on_change="on_change_plano(plano_centro_id)"/> <field name="centro_id"/> <field name="percentagem"/> <field name="valor" ref="valor_origem"/> <field name="natureza"/> <field name="parente_sup" invisible="1"/> </tree> </field> <label string="" colspan="3"/> <newline/> <label string="" colspan="5"/> <button string="Guardar" name="actualizar" type="object"/> </group> </form>

but my context become empty.....how can i solve this.???

Avatar
Discard
Best Answer

Please have respect for the other members here.

On the site : Free Formatter it took me 10 secs to do this:

 <?xml version="1.0" encoding="UTF-8"?>
 <form string="Lancamentos">
    <group col="6">
       <field name="conta_id" />
       <field name="valor_origem" />
       <field name="plano_centro_id" invisible="1" />
       <field name="natureza" />
       <field colspan="6" name="lancamentos_reflexao_custo_ids" widget="one2many_list" nolabel="1" domain="['movimento_reflexao_id', '=', active_id]" context="{'movimento_reflexao_id': active_id}">
          <tree editable="bottom">
             <field name="conta_origem_id" invisible="1" />
             <field name="plano_centro_id" on_change="on_change_plano(plano_centro_id)" />
             <field name="centro_id" />
             <field name="percentagem" />
             <field name="valor" ref="valor_origem" />
             <field name="natureza" />
             <field name="parente_sup" invisible="1" />
          </tree>
       </field>
       <label string="" colspan="3" />
       <newline />
       <label string="" colspan="5" />
       <button string="Guardar" name="actualizar" type="object" />
    </group>
 </form>
Avatar
Discard