我试图在sales.order.line的搜索部分显示日期范围,即“date from”和“date to”,但它不会显示它。我在下面附上了我的代码。我错过了什么:
班级代码:
from osv import fields, osv
class sales_invoice_date(osv.osv):
_name='sale.order.line'
_inherit='sale.order.line'
_columns={
'ordered_date': fields.related('order_id', 'date_order', type='date', relation='sale.order', select= 1, string='Date Ordered'),
'due_date_from':fields.function(lambda *a,**k:{}, method=True, type='date',string="Due date from"),
'due_date_to':fields.function(lambda *a,**k:{}, method=True, type='date',string="Due date to"),
}
sales_invoice_date()
查看代码:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_sale_orderlinedate" model="ir.ui.view">
<field name="name">sale.order.line.dateinherit</field>
<field name="model">sale.order.line</field>
<field name="type">tree</field>
<field name="inherit_id" ref="sale.view_order_line_tree"/>
<field name="arch" type="xml">
<field name="order_id" position="after">
<field name="ordered_date" />
</field>
</field>
</record>
<record id="view_sale_orderlinedate2" model="ir.ui.view">
<field name="name">sale.order.line.dateinherit2</field>
<field name="model">sale.order.line</field>
<field name="type">search</field>
<field name="inherit_id" ref="sale.view_sales_order_uninvoiced_line_filter"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="ordered_date" />
<field name="due_date_from" filter_domain="[('date_due','>=',self)]"/>
<field name="due_date_to" filter_domain="[('date_due','<=',self)]"/>
</field>
<field name="salesman_id" position="after">
<field name="due_date_from" filter_domain="[('date_due','>=',self)]"/>
<field name="due_date_to" filter_domain="[('date_due','<=',self)]"/>
</field>
</field>
</record>
</data>
</openerp>