How we can list out all the open state invoices in a form (sales) in odoo12?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- Project
- MRP
此问题已终结
1
回复
2585
查看
Hi,
Not sure how you go to display the form if the form is coming from a menu you can give domain for the menu action if the python the form is returned from the python code you can give a domain in the return.
If menu action:
<record id="view_open_invoice" model="ir.actions.act_window">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity</field>
<field eval="False" name="view_id"/>
<field name="domain">[('state','=','open')]</field>
</record>
If you are returning the form from python:
return {
'name': _('Invoices'),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
'domain': [('state', '=', 'open')],
}
If you are returning it from a button click, call a python function from the button by giving the type as object and return the above lines.
Thanks