Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
26024 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Hi Krupesh, 

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

Tried both ways. Any other alternative for this? 

Awatar
Odrzuć
Najlepsza odpowiedź

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)]">


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lis 24
19613
1
wrz 23
2487
3
maj 23
5170
7
kwi 23
48441
1
gru 22
7381