DEF init (SELF,CR):
Tools.sql.drop_view_if_exists (CR,' Custrom_product_infomation_report ')
Cr.execute ("""
Create or Replace viewcustrom_product_infomation_report as (
Select t0.id,t0.hpartner_id as hpartner_id, T0.khwl_code as khwl_code,t1.product_tmpl_id as PRODUCTN,
T3.pname,t3.material,t3.spec,
T4.id as Name_uom, T5.price as Custo_price,t0.product_meno as Product_meno, T0.meno as Meno,t5.date_from,t5.date_to
From Product_custo_info t0
Left JOIN product_product T1 on t0.product_tmpl_id=t1.product_tmpl_id
Left JOIN product_template T3 on t3.id=t1.product_tmpl_id
Left JOIN Res_partner T2 on t2.id=t0.hpartner_id
Left JOIN product_uom T4 on T3.uom_id=t4.id
Left join Partner_product_price T5 on T5.ppp_line_id=t0.id
SQL statement when compared to the previous time:
Select * FROM (select T1.id,t0.product_meno,
t0.hpartner_id, T0.khwl_code, T0.name_uom,t0.custo_price
, T0.product_meno,t0.meno,t2.pname, t0.date_from,t0.date_to
From cust_product_info_report t0 ,
left JOIN product_product t1 on t1.product_tmpl_id=t0.productn < Br>left JOIN product_template t2 on t1.product_tmpl_id=t2.id
where (now ( ) >=t0.date_from and now () <=t0.date_to) or (T0.date_from was null and t0.date_to is null) or
(T0.date_from is null and (now () <=t0.date_to)) or (T0.date_to is null and ( Now () >=t0.date_from)
)
as p where hpartner _id= ' 16404 '
order by PName
Python init method vs. SQL statement current time