如何获得父ID

时间:2017-11-05 10:27:41

标签: openerp

我想在模型'facturation.lot'中为filtring恢复contrat_parent_id。

模特:

class Contrat(models.Model):
    _name = 'facturation.contrat'

    code = fields.Char(string='Numéro Contrat', required=True)
    contrat_parent_id = fields.Many2one('facturation.contrat', string='Numéro Contrat Client')


class Lot(models.Model):
    _name = 'facturation.lot'
    _description = 'Lots'

    contrat_id = fields.Many2one('facturation.contrat', ondelete='cascade')
    articlecontrat_ids = fields.Many2many('facturation.articleouvrage',string='Article Lot')

class ArticleOuvrage(models.Model):
    _name = 'facturation.articleouvrage'
    _description = 'Ligne Articles'

    article_id = fields.Many2one('facturation.article',string='Article')
    ouvrage_id = fields.Many2one('facturation.ouvrage',string="Ouvrage")

查看:

<record id="lot_view_form" model="ir.ui.view">
   <field name="name">facturation.lot.form</field>
   <field name="model">facturation.lot</field>
   <field name="arch" type="xml">
       <form>
           <sheet>
               <field name="lib_lot" string="Lot"/>
               <field name="contrat_id" options="{'no_create':True}"></field>
               <notebook>
                   <page string="Composants" >
                       <field name="articlecontrat_ids" domain="[('ouvrage_id.contrat_id.id','=',1)]" options="{'no_create':True}" >
                           <tree>

我想在模型'facturation.lot'中为filtring恢复contrat_parent_id。 感谢

0 个答案:

没有答案