odoo fields

1、domain 筛选 
add = fields.Many2one(
'product.attribute.value',
string='ADD',
domain=lambda self: [('attribute_id.name', '=', 'add')]
)
2、此方法需要修改代码,在单据状态变化的时候,自动推送消息。
threshold_qty_available = fields.Integer(
string='Quantity Threshold',
default=False,
help='set to 0 means no restrict for on hand quantity',
track_visibility='onchange'
)
3、Selection
frl = fields.Selection(
string='F/R/L',
selection=[('frame', 'Frame'),
('right', 'Right Lens'), ('left', 'Left Lens'),
('right_coating', 'Right Coating'), ('left_coating', 'Left Coating'),
('right_tint', 'Right Tint'), ('left_tint', 'Left Tint'),
('accessory', 'Accessory'),
('unknown', 'Unknown')],
default='unknown'
)
4、comodel_name
sale_order_line_id = fields.Many2one(
readonly=True,
copy=False,
comodel_name='sale.order.line',
ondelete='set null',
)
posted @ 2018-01-15 11:18  我本坏蛋  阅读(159)  评论(0编辑  收藏  举报