[FIX] sale_stock: fixed identation
bzr revid: qdp-launchpad@openerp.com-20120919083835-11s1ooomn73bcae0
This commit is contained in:
@@ -60,6 +60,7 @@ class sale_report(osv.osv):
|
||||
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
|
||||
}
|
||||
_order = 'date desc'
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'sale_report')
|
||||
cr.execute("""
|
||||
@@ -79,7 +80,7 @@ class sale_report(osv.osv):
|
||||
s.partner_id as partner_id,
|
||||
s.user_id as user_id,
|
||||
s.shop_id as shop_id,
|
||||
s.company_id as company_id,
|
||||
s.company_id as company_id,
|
||||
extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
|
||||
s.state,
|
||||
t.categ_id as categ_id,
|
||||
@@ -103,7 +104,7 @@ class sale_report(osv.osv):
|
||||
s.partner_id,
|
||||
s.user_id,
|
||||
s.shop_id,
|
||||
s.company_id,
|
||||
s.company_id,
|
||||
s.state,
|
||||
s.pricelist_id,
|
||||
s.project_id
|
||||
|
||||
@@ -21,73 +21,76 @@
|
||||
|
||||
from osv import fields, osv
|
||||
import tools
|
||||
|
||||
class sale_report(osv.osv):
|
||||
_inherit = "sale.report"
|
||||
_columns = {
|
||||
'shipped': fields.boolean('Shipped', readonly=True),
|
||||
'shipped_qty_1': fields.integer('Shipped', readonly=True),
|
||||
'state': fields.selection([
|
||||
('draft', 'Quotation'),
|
||||
('waiting_date', 'Waiting Schedule'),
|
||||
('manual', 'Manual In Progress'),
|
||||
('progress', 'In Progress'),
|
||||
('shipping_except', 'Shipping Exception'),
|
||||
('invoice_except', 'Invoice Exception'),
|
||||
('done', 'Done'),
|
||||
('cancel', 'Cancelled')
|
||||
], 'Order State', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'sale_report')
|
||||
cr.execute("""
|
||||
create or replace view sale_report as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
l.product_id as product_id,
|
||||
t.uom_id as product_uom,
|
||||
sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty,
|
||||
sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total,
|
||||
1 as nbr,
|
||||
s.date_order as date,
|
||||
s.date_confirm as date_confirm,
|
||||
to_char(s.date_order, 'YYYY') as year,
|
||||
to_char(s.date_order, 'MM') as month,
|
||||
to_char(s.date_order, 'YYYY-MM-DD') as day,
|
||||
s.partner_id as partner_id,
|
||||
s.user_id as user_id,
|
||||
s.shop_id as shop_id,
|
||||
s.company_id as company_id,
|
||||
extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
|
||||
s.state,
|
||||
t.categ_id as categ_id,
|
||||
s.shipped,
|
||||
s.shipped::integer as shipped_qty_1,
|
||||
s.pricelist_id as pricelist_id,
|
||||
s.project_id as analytic_account_id
|
||||
from
|
||||
sale_order s
|
||||
left join sale_order_line l on (s.id=l.order_id)
|
||||
left join product_product p on (l.product_id=p.id)
|
||||
left join product_template t on (p.product_tmpl_id=t.id)
|
||||
left join product_uom u on (u.id=l.product_uom)
|
||||
left join product_uom u2 on (u2.id=t.uom_id)
|
||||
group by
|
||||
l.product_id,
|
||||
l.product_uom_qty,
|
||||
l.order_id,
|
||||
t.uom_id,
|
||||
t.categ_id,
|
||||
s.date_order,
|
||||
s.date_confirm,
|
||||
s.partner_id,
|
||||
s.user_id,
|
||||
s.shop_id,
|
||||
s.company_id,
|
||||
s.state,
|
||||
s.shipped,
|
||||
s.pricelist_id,
|
||||
s.project_id
|
||||
)
|
||||
""")
|
||||
_inherit = "sale.report"
|
||||
_columns = {
|
||||
'shipped': fields.boolean('Shipped', readonly=True),
|
||||
'shipped_qty_1': fields.integer('Shipped', readonly=True),
|
||||
'state': fields.selection([
|
||||
('draft', 'Quotation'),
|
||||
('waiting_date', 'Waiting Schedule'),
|
||||
('manual', 'Manual In Progress'),
|
||||
('progress', 'In Progress'),
|
||||
('shipping_except', 'Shipping Exception'),
|
||||
('invoice_except', 'Invoice Exception'),
|
||||
('done', 'Done'),
|
||||
('cancel', 'Cancelled')
|
||||
], 'Order State', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'sale_report')
|
||||
cr.execute("""
|
||||
create or replace view sale_report as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
l.product_id as product_id,
|
||||
t.uom_id as product_uom,
|
||||
sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty,
|
||||
sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total,
|
||||
1 as nbr,
|
||||
s.date_order as date,
|
||||
s.date_confirm as date_confirm,
|
||||
to_char(s.date_order, 'YYYY') as year,
|
||||
to_char(s.date_order, 'MM') as month,
|
||||
to_char(s.date_order, 'YYYY-MM-DD') as day,
|
||||
s.partner_id as partner_id,
|
||||
s.user_id as user_id,
|
||||
s.shop_id as shop_id,
|
||||
s.company_id as company_id,
|
||||
extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
|
||||
s.state,
|
||||
t.categ_id as categ_id,
|
||||
s.shipped,
|
||||
s.shipped::integer as shipped_qty_1,
|
||||
s.pricelist_id as pricelist_id,
|
||||
s.project_id as analytic_account_id
|
||||
from
|
||||
sale_order s
|
||||
left join sale_order_line l on (s.id=l.order_id)
|
||||
left join product_product p on (l.product_id=p.id)
|
||||
left join product_template t on (p.product_tmpl_id=t.id)
|
||||
left join product_uom u on (u.id=l.product_uom)
|
||||
left join product_uom u2 on (u2.id=t.uom_id)
|
||||
group by
|
||||
l.product_id,
|
||||
l.product_uom_qty,
|
||||
l.order_id,
|
||||
t.uom_id,
|
||||
t.categ_id,
|
||||
s.date_order,
|
||||
s.date_confirm,
|
||||
s.partner_id,
|
||||
s.user_id,
|
||||
s.shop_id,
|
||||
s.company_id,
|
||||
s.state,
|
||||
s.shipped,
|
||||
s.pricelist_id,
|
||||
s.project_id
|
||||
)
|
||||
""")
|
||||
sale_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user