|
@@ -30,23 +30,23 @@ class my_partner_model(osv.osv):
|
|
|
cr.execute("""
|
|
|
CREATE OR REPLACE VIEW my_partner_model AS (
|
|
|
SELECT a.id AS id,
|
|
|
- c.partner_id AS partner_id,
|
|
|
- a.name,
|
|
|
- a.street AS street,
|
|
|
- a.email AS email,
|
|
|
- a.mobile AS mobile,
|
|
|
- a.phone AS phone,
|
|
|
- c.price_total AS total_facturado,
|
|
|
- c.user_id as user_id,
|
|
|
- c.date AS date,
|
|
|
- C.company_id as company_id
|
|
|
- FROM res_partner a
|
|
|
- LEFT JOIN(select s.partner_id AS partner_id, sum(l.qty * l.price_unit) as price_total, MAX(l.create_date) AS date, s.user_id AS user_id, s.company_id as company_id
|
|
|
- from pos_order_line as l
|
|
|
- left join pos_order s on s.id=l.order_id
|
|
|
- group by s.partner_id, s.user_id,s.company_id) c on c.partner_id=a.id
|
|
|
- WHERE a.customer= True and c.price_total>0
|
|
|
- ORDER BY c.date
|
|
|
+ c.partner_id AS partner_id,
|
|
|
+ a.name,
|
|
|
+ a.street AS street,
|
|
|
+ a.email AS email,
|
|
|
+ a.mobile AS mobile,
|
|
|
+ a.phone AS phone,
|
|
|
+ c.price_total AS total_facturado,
|
|
|
+ p.user_id as user_id,
|
|
|
+ c.date AS date,
|
|
|
+ c.company_id as company_id
|
|
|
+ FROM res_partner a
|
|
|
+ left join pos_order p on p.partner_id=a.id
|
|
|
+ LEFT JOIN(select s.partner_id AS partner_id, sum(l.qty * l.price_unit) as price_total, MAX(l.create_date) AS date, s.company_id as company_id
|
|
|
+ from pos_order_line as l
|
|
|
+ left join pos_order s on s.id=l.order_id
|
|
|
+ group by s.partner_id,s.company_id) c on c.partner_id=a.id
|
|
|
+ WHERE a.customer= True and c.price_total>0
|
|
|
)
|
|
|
""")
|
|
|
my_partner_model()
|