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

I have extended the res.partner model and added a custom field to it (say "redeemable_points").

Now, I have created a page(tab "Redeemed-Sale Orders") in res.partner view which shows only sales orders with redeemable_points > 0 in it.

My query is, how can I set a domain for a XML field to select sales orders with redeemable_points is not equal to 0?


Below is my xml view :

<page string="Redeemed-Sales Orders" col="4" name="Redeemed Sales Orders">

      <field name="sale_order_ids" domain="[('redeemable_points', '!=', 0)]"> <!-- This domain is not working -->  

             <tree decoration-info="state == 'draft'"  string="Redeem  Logs">

                  <field name="partner_id" groups="base.group_user"  string="Customer" />

                  <field name="name"/>

                  <field name="user_id"/>

                  <field name="invoice_status"/>

                   <field name="redeemable_points" string="Total Redeem Points" sum="Total Reward Points"/>

              </tree>

        </field>

  </page>


can anyone please help me on this?

頭像
捨棄
最佳答案

first you have to make the redeemable field to store state, else the field will kept empty on db.

<field name="redeemable_points" string="Total Redeem Points" sum="Total Reward Points" store="1"/>
then try the domain

頭像
捨棄
作者 最佳答案

Hi Krupesh, 

Thanks for your reply, but still it is not working. 

Tried both ways. Any other alternative for this? 

頭像
捨棄
最佳答案

try this 
<field name="sale_order_ids" domain="[('redeemable_points', '!=', False)]"> 

or you can new field in sale order is_redeemable when redeemable case in sale order it will tick.

and you can apply new domain for that

<field name="sale_order_ids" domain="[('is_reddemable', '=', True)]">


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
11月 24
19862
1
9月 23
2729
3
5月 23
5383
7
4月 23
48665
1
12月 22
7566