Odoo Help

0

Filter Customers based on confirmed sales orders

Op
Maarten Van Speybroeck
op 03-01-18 11:38 202 weergaven

On Odoo 10

I am trying to create a custom filter for the sales>customers overview, which should only show customers who have actually bought something at least once. I am trying with

[[u'customer', u'=', 1], [u'parent_id', u'=', False], [u'is_company', u'=', 1], [u'sale_order_count', u'>', 0]]
Also tried using the field  "total_invoiced > 0", but every attempt gives back all customers. What am I doing wrong here?

1

Niyas Raphy

--Niyas Raphy--
--Niyas Raphy--

Odoo Techno Functionalist @ Cybrosys Techno Solutions

Graduation : B-Tech in Computer Science & Engineering from Calicut University (2012 - 2016)


Feel free to contact :  niyasraphyk@gmail.com

Niyas Raphy
Op 03-01-18 23:51

Hi,

I think you can do it using the sale_order_count . I have just checked it from the user interface its working fine.

Filters - > Add custom filter -> , set sale order not equal to 0

Adding filter,

Then the customers having at least one sale will be displayed

Thanks

0
Dishan Madushanka
Op 03-01-18 23:41

Hi!! Maarten,

This is my code and try like this,in my code only filtered last 30 days customers.get some idea from this.
Thanks.

<filter string="Last 30 Days" name="prev_month" domain="[('date_order','&gt;=',(context_today()-relativedelta(months=1)).strftime('%Y-%m-01')),('date_order','&lt;',time.strftime('%Y-%m-01'))]"/>
0

Thanks, Niyas. But it does not really do what I would expect. In your filter "customers" is also active, which means that only customers without a parent company are visible (so no contacts linked to the customer company). When the sales orders are directed to a contact rather than its company, the filter "sales_order_ids != 0 does not work anymore because sales order count is apparently not transferred from contact to parent company.

Because all our sales orders are addressed to contacts, your proposed filter gives zero results with me. When I remove the filter "customers" however, it works and list all the contacts (but not the parent companies to which the contacts belong). When I group by company then, it gives the results I was looking for.

Strange though that sales order count is not transferred to the actual customer (company), but is only linked to the contact.

Over deze community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Vraag hulpmiddelen

2 volger(s)

Statistieken

Gevraagd: 03-01-18 11:38
Gezien: 202 tijden
Laatst bijgewerkt: 04-01-18 08:10