我有3個對象:Odoo域濾波many2one
class PurchaseRequest(models.Model):
_name = 'purchase.request'
purchase_request_line = fields.One2many('purchase.request.line', 'purchase_request_id', copy=True)
supply_conditions_status = fields.One2many('supply.conditions', 'purchase_id', string='Order',copy=True)
和
class SupplyConditions(models.Model):
_name = 'supply.conditions'
name = fields.Many2one('purchase.request.line', string='Product')
和
class PurchaseRequestLine(models.Model):
_name = 'purchase.request.line
purchase_request_id = fields.Many2one('purchase.request', 'Purchase request')
使用域我想只過濾這些名稱字段(many2one場)值它被寫入並保存在purchase.request表單purchase_request_line字段中。因爲現在我可以看到這是保存在數據庫中的所有值...
<openerp>
<data>
<record model="ir.ui.view" id="view_purchase_request_doc">
<field name="name">purchase.request.doc</field>
<field name="model">purchase.request</field>
<field name="arch" type="xml">
<form string="Purchase Request">
<field name="state" widget="statusbar" statusbar_visible="draft,to_approve_first,approved,rejected,canceled" statusbar_colors="{"approved":"green"}"/>
</header>
<sheet>
<field name="purchase_request_line" attrs="{'readonly': [('state','not in', ('draft'))]}">
<tree string="Purchase Order Lines" editable="bottom">
<field name="name"/>
<field name="quantity"/>
</tree>
</field>
<notebook>
<page string="Conditions" attrs="{'invisible': [('state','in', ('draft', 'to_approve_first'))]}">
<field name="supply_conditions_status">
<tree string="Purchase Order Lines">
<field name="name" domain="[('???', '???', '???')]"/>
<field name="name" options="{'no_create': True}" domain="[('name', '=', 'product_id')]"/>
我會試着想象這裏:
我想要在購買須知產品名稱many2one字段我可以過濾並只看到2個項目:item1和item2。
我dnt理解你的問題。 Plz詳細說明...... – user3162878
我更新了我的問題,請檢查一下 – fueggit