[IMP] removed completly false report

bzr revid: fp@tinyerp.com-20110924141451-772qbu8ipjib4ulo
This commit is contained in:
Fabien Pinckaers 2011-09-24 16:14:51 +02:00
parent 8e34fa6526
commit 4fdebeef0f
5 changed files with 1 additions and 212 deletions

View File

@ -19,7 +19,6 @@
##############################################################################
import sale_margin
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -33,7 +33,7 @@ This gives the profitability by calculating the difference between the Unit Pric
"depends":["sale"],
"demo_xml":[],
'test': ['test/sale_margin.yml'],
"update_xml":["security/ir.model.access.csv","sale_margin_view.xml","report/report_margin_view.xml"],
"update_xml":["security/ir.model.access.csv","sale_margin_view.xml"],
"active": False,
"installable": True,
"certificate" : "001165700015525701661",

View File

@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import report_margin
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,90 +0,0 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
import pooler
from tools import config
import time
import tools
class report_account_invoice_product(osv.osv):
_name = 'report.account.invoice.product'
_auto = False
_description = "Invoice Statistics"
_columns = {
'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'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',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'),
('open','Open'),
('paid','Paid'),
('cancel','Canceled')
],'State', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'amount': fields.float('Amount', readonly=True),
'cost_price': fields.float('Cost Price', readonly=True),
'margin': fields.float('Margin', readonly=True),
'categ_id': fields.many2one('product.category', 'Categories', readonly=True),
'quantity': fields.float('Quantity', readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_account_invoice_product')
cr.execute("""
create or replace view report_account_invoice_product as (
select
min(l.id) as id,
i.create_date as date,
to_char(date_trunc('day',i.date_invoice), 'YYYY') as year,
to_char(date_trunc('day',i.date_invoice), 'MM') as month,
to_char(date_trunc('day',i.date_invoice), 'YYYY-MM-DD') as day,
i.type,
i.state,
l.product_id,
t.categ_id,
i.partner_id,
sum(l.quantity * l.price_unit * (1.0 - l.discount/100.0)) as amount,
sum(l.quantity * l.cost_price) as cost_price,
sum((l.quantity * l.price_unit * (1.0 - l.discount/100.0) - (l.quantity * l.cost_price))) as margin,
sum(l.quantity) as quantity
from account_invoice i
left join account_invoice_line l on (i.id = l.invoice_id)
left join product_product p on (p.id = l.product_id)
left join product_template t on (t.id = p.product_tmpl_id)
group by t.categ_id,i.partner_id,l.product_id, i.date_invoice, i.type, i.state,i.create_date
)
""")
report_account_invoice_product()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,97 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_report_account_invoice_tree">
<field name="name">report.account.invoice.product.tree</field>
<field name="model">report.account.invoice.product</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invoices by product">
<field name="date"/>
<field name="year" invisible="1" />
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="type"/>
<field name="state"/>
<field name="product_id" invisible="1" />
<field name="partner_id"/>
<field name="categ_id" invisible="1" />
<field name="amount"/>
<field name="cost_price"/>
<field name="margin"/>
<field name="quantity"/>
</tree>
</field>
</record>
<record id="view_report_account_invoice_filter" model="ir.ui.view">
<field name="name">account.invoice.product.filter</field>
<field name="model">report.account.invoice.product</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Margin">
<group>
<filter icon="terp-go-year" string="This Year" domain="[('year','=',time.strftime('%%Y'))]" help="All Months Sales by Margin"/>
<filter icon="terp-go-month" string="This Month" domain="[('month','=',time.strftime('%%m'))]" help="This Months Sales by Margin"/>
<separator orientation="vertical"/>
<filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]" help="Draft Invoices"/>
<filter string="Pro-forma" icon="terp-gtk-media-pause" domain="[('state','=','proforma')]" help="Pro-forma Invoices"/>
<filter string="Open" icon="terp-check" domain="[('state', '=' ,'open')]" help="Open Invoices"/>
<filter string="Done" icon="terp-dialog-close" domain="[('state','=','paid')]" help="Done Invoices"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="date" string="Date Invoiced"/>
<separator orientation="vertical"/>
<field name="partner_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="amount" />
<field name="state"/>
<newline/>
<field name="product_id"/>
<field name="categ_id"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter string="Category" icon="terp-stock_symbol-selection" context="{'group_by':'categ_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-month" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
</search>
</field>
</record>
<record id="view_report_account_invoice_graph" model="ir.ui.view">
<field name="name">report.account.invoice.product.graph</field>
<field name="model">report.account.invoice.product</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Invoice by Partner" type="pie">
<field name="partner_id"/>
<field name="margin"/>
</graph>
</field>
</record>
<record id="action_report_account_invoice_report" model="ir.actions.act_window">
<field name="name">Invoice Analysis</field>
<field name="res_model">report.account.invoice.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{"search_default_At Date":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_report_account_invoice_filter"/>
<field name="help">This report gives you an overview of all the invoices generated by the system. You can sort and group your results by specific selection criteria to quickly find what you are looking for.</field>
</record>
<menuitem name="Invoice Report" id="menu_report_account_invoice_product" parent="account.menu_finance_reporting"/>
<menuitem name="Invoice" id="menu_report_account_invoice_reoirt" parent="menu_report_account_invoice_product" action="action_report_account_invoice_report" groups="account.group_account_manager"/>
</data>
</openerp>