跳至內容
選單
此問題已被標幟
4 回覆
3736 瀏覽次數

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
707
2
7月 25
811
1
7月 25
1887
3
4月 25
1893
3
4月 25
2907