跳至内容
菜单
此问题已终结
4 回复
3723 查看

Please help me resolve this problem ..

I use to make invoice_id field in my custom module , it refer to customer invoice that has been paid.

'invoice_id': fields.many2one('account.invoice',string='Invoice',domain=[('state','=','paid'),('type','=','out_invoice')],required=True),

but whenever i create or edit a new item , it always refer to supplier invoice.

what should i do?

 

 

形象
丢弃

did you meant about creating invoice from your Many2one field in custom module?

编写者

yes it is

can you please explain your need , do you want to create invoice from there or just want to see and select customer invoice ?

最佳答案

Hi,

you have to define your field into xml file as like below.

<field name="invoice_id" context="{'form_view_ref':'account.invoice_form'}" />

I hope it will help you to achieve your requirements.

Note : as like 'form_view_ref' you can also give 'tree_view_ref and 'search_view_ref'. So, openerp will open that particular view based on this context.

形象
丢弃
最佳答案

You need to specify the type to default the Invoice's type to 'out_invoice' (Customer Invoice):

<field name="invoice_id" context="{'type': 'out_invoice'}" />

形象
丢弃
编写者 最佳答案

thanks Emipro, it works !

形象
丢弃
最佳答案

Good resposse. Thanks.

形象
丢弃
相关帖文 回复 查看 活动
1
7月 25
704
2
7月 25
801
1
7月 25
1886
3
4月 25
1889
3
4月 25
2903