Skip to Content
Menu
This question has been flagged
1 Reply
2207 Views

How we can list out all the open state invoices in a form (sales) in odoo12?

Avatar
Discard
Best Answer

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

Avatar
Discard