[IMP] Account: Invoice analysis report improved
bzr revid: mra@mra-laptop-20100814032558-ze1d30hpkczh5duj
This commit is contained in:
parent
040a9e861e
commit
451388d0b9
|
@ -31,10 +31,10 @@ class account_invoice_report(osv.osv):
|
|||
'date': fields.date('Date', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'product_qty':fields.float('Qty', readonly=True),
|
||||
'uom_name': fields.char('Default UoM', size=128, readonly=True),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Term', readonly=True),
|
||||
|
@ -43,11 +43,12 @@ class account_invoice_report(osv.osv):
|
|||
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
|
||||
'categ_id': fields.many2one('product.category','Category of Product', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
|
||||
'price_total':fields.float('Total Price', readonly=True),
|
||||
'price_average':fields.float('Average Price', readonly=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'Salesman', readonly=True),
|
||||
'price_total': fields.float('Total Without Tax', readonly=True),
|
||||
'price_total_tax': fields.float('Total With Tax', readonly=True),
|
||||
'price_average': fields.float('Average Price', readonly=True),
|
||||
'nbr':fields.integer('# of Lines', readonly=True),
|
||||
'type': fields.selection([
|
||||
('out_invoice','Customer Invoice'),
|
||||
|
@ -68,8 +69,8 @@ class account_invoice_report(osv.osv):
|
|||
'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address Name', readonly=True),
|
||||
'account_id': fields.many2one('account.account', 'Account',readonly=True),
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
|
||||
'residual':fields.float('Total Residual', readonly=True),
|
||||
'delay_to_pay':fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
|
||||
'residual': fields.float('Total Residual', readonly=True),
|
||||
'delay_to_pay': fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
|
||||
}
|
||||
_order = 'date desc'
|
||||
def init(self, cr):
|
||||
|
@ -110,6 +111,11 @@ class account_invoice_report(osv.osv):
|
|||
else
|
||||
ail.quantity*ail.price_unit
|
||||
end) as price_total,
|
||||
sum(case when ai.type in ('out_refund','in_invoice') then
|
||||
ai.amount_total * -1
|
||||
else
|
||||
ai.amount_total
|
||||
end) as price_total_tax,
|
||||
sum(ail.quantity*ail.price_unit)/sum(ail.quantity*u.factor)*count(ail.product_id)::decimal(16,2) as price_average,
|
||||
sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2)
|
||||
from account_move_line as aml
|
||||
|
@ -150,7 +156,11 @@ class account_invoice_report(osv.osv):
|
|||
ai.address_invoice_id,
|
||||
ai.account_id,
|
||||
ai.partner_bank_id,
|
||||
ai.residual
|
||||
ai.residual,
|
||||
ai.amount_total
|
||||
)
|
||||
""")
|
||||
|
||||
account_invoice_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -30,7 +30,8 @@
|
|||
<field name="product_qty" sum="Qty"/>
|
||||
<!-- <field name="reconciled" sum="# Reconciled"/> -->
|
||||
<field name="price_average" sum="Average Price"/>
|
||||
<field name="price_total" sum="Total Price"/>
|
||||
<field name="price_total" sum="Total Without Tax"/>
|
||||
<field name="price_total_tax" sum="Total With Tax"/>
|
||||
<field name="residual" sum="Total Residual" invisible="context.get('residual_invisible',False)"/>
|
||||
<field name="delay_to_pay" sum="Avg. Delay To Pay" invisible="context.get('residual_invisible',False)"/>
|
||||
</tree>
|
||||
|
@ -75,7 +76,7 @@
|
|||
help = "Draft Invoices"/>
|
||||
<filter string="Pro-forma"
|
||||
icon="terp-check"
|
||||
domain="[('state','=','proforma'),('state','=','proforma2')]"
|
||||
domain="['|', ('state','=','proforma'),('state','=','proforma2')]"
|
||||
help = "Pro-forma Invoices"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-check" string="Customer"
|
||||
|
|
Loading…
Reference in New Issue