[IMP]:improved the SQL account report with type of invoice.(Extended options...).
bzr revid: apa@tinyerp.com-20100310110501-awf588z6w9qcz7vp
This commit is contained in:
parent
a65f5deab0
commit
ace30b898c
|
@ -41,6 +41,12 @@ class account_invoice_report(osv.osv):
|
|||
'price_total':fields.float('Total Price', readonly=True),
|
||||
'price_average':fields.float('Average Price', readonly=True),
|
||||
'nbr':fields.integer('# of Lines', readonly=True),
|
||||
'type': fields.selection([
|
||||
('out_invoice','Customer Invoice'),
|
||||
('in_invoice','Supplier Invoice'),
|
||||
('out_refund','Customer Refund'),
|
||||
('in_refund','Supplier Refund'),
|
||||
],'Type', readonly=True),
|
||||
'state': fields.selection([
|
||||
('draft','Draft'),
|
||||
('proforma','Pro-forma'),
|
||||
|
@ -68,6 +74,7 @@ class account_invoice_report(osv.osv):
|
|||
sum(l.quantity*l.price_unit) as price_total,
|
||||
(sum(l.quantity*l.price_unit)/sum(l.quantity * u.factor))::decimal(16,2) as price_average,
|
||||
count(*) as nbr,
|
||||
s.type as type,
|
||||
s.state
|
||||
from
|
||||
account_invoice_line l
|
||||
|
@ -75,7 +82,7 @@ class account_invoice_report(osv.osv):
|
|||
account_invoice s on (s.id=l.invoice_id)
|
||||
left join product_uom u on (u.id=l.uos_id)
|
||||
group by
|
||||
s.date_invoice, s.partner_id, l.product_id,
|
||||
s.type,s.date_invoice, s.partner_id, l.product_id,
|
||||
l.uos_id, s.user_id, s.state,
|
||||
s.company_id
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<field name="user_id"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<!--field name="shop_id" invisible="1"/-->
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="product_id"/>
|
||||
|
@ -46,11 +46,9 @@
|
|||
<filter icon="terp-account"
|
||||
string="This Year"
|
||||
domain="[('year','=',time.strftime('%%Y'))]"
|
||||
default="1"
|
||||
help="Invoices of the year"/>
|
||||
<filter icon="terp-account"
|
||||
string="This Month"
|
||||
default="1"
|
||||
domain="[('month','=',time.strftime('%%m'))]"
|
||||
help="Invoices of this month"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
@ -59,7 +57,6 @@
|
|||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-account"
|
||||
string="Invoices"
|
||||
default="1"
|
||||
domain="[('state','<>','draft'),('state','<>','cancel')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="product_id"/>
|
||||
|
@ -72,6 +69,7 @@
|
|||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
|
||||
<newline/>
|
||||
|
||||
<group expand="1" string="Group By..." colspan="10" col="12">
|
||||
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}"/>
|
||||
<filter string="Salesman" icon="terp-account" context="{'group_by':'user_id'}" default="1"/>
|
||||
|
@ -83,6 +81,21 @@
|
|||
<filter string="Month" icon="terp-account" context="{'group_by':'date'}"/>
|
||||
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Extended options..." colspan="10" col="12">
|
||||
<filter icon="terp-account"
|
||||
string="Customer Invoices"
|
||||
domain="[('type','=','out_invoice')]"/>
|
||||
<filter icon="terp-account"
|
||||
string="Supplier Invoices"
|
||||
domain="[('type','=','in_invoice')]"/>
|
||||
<filter icon="terp-account"
|
||||
string="Customer Refunds"
|
||||
domain="[('type','=','out_refund')]"/>
|
||||
<filter icon="terp-account"
|
||||
string="Supplier Refunds"
|
||||
domain="[('type','=','in_refund')]"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue