← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3

 

pso (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.

Requested reviews:
  OpenERP R&D Team (openerp-dev)
Related bugs:
  #438717 Error in account_anglo_saxon when using foreign currency
  https://bugs.launchpad.net/bugs/438717
  #539539 product - VAT definition - multicompany
  https://bugs.launchpad.net/bugs/539539
  #589256 Wrong tax calculation in point of sale (POS)
  https://bugs.launchpad.net/bugs/589256
  #617974 trunk - hr payment - rounding issue payment slip
  https://bugs.launchpad.net/bugs/617974
  #646350 [trunk] sale analysis - wrong average price
  https://bugs.launchpad.net/bugs/646350
  #663585 [6.0rc1] suggested improvements to PO and SO form view
  https://bugs.launchpad.net/bugs/663585
  #663967 [RC1] SO -History - can delete related invoice
  https://bugs.launchpad.net/bugs/663967
  #666592 save and close crash adding product in point of sale
  https://bugs.launchpad.net/bugs/666592
  #669360 hr_timeeshet_sheet : installation fails on 1st (and probably last) date of the month.
  https://bugs.launchpad.net/bugs/669360
  #669533 [hr_timesheet] Employee timesheet reports confuse employee id and user id
  https://bugs.launchpad.net/bugs/669533
  #672684 Manual Global Tax
  https://bugs.launchpad.net/bugs/672684
  #673835 Sales, Purchase and Invoice Analysis Problem
  https://bugs.launchpad.net/bugs/673835
  #689924 [sale_margin] purchase price is wrong
  https://bugs.launchpad.net/bugs/689924
  #691810 Cannot cancel invoice BUG
  https://bugs.launchpad.net/bugs/691810
  #692456 Sale Order Reference not unique
  https://bugs.launchpad.net/bugs/692456
  #692735 [6.0] sales - canceled SO should not be black (normal)
  https://bugs.launchpad.net/bugs/692735
  #692964 in hr_recruitment, add a column "Subject" in applicants list view
  https://bugs.launchpad.net/bugs/692964
  #692976 expenses list shouldn't be editable
  https://bugs.launchpad.net/bugs/692976

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44650

Hello,

Created sales receipt analysis report as like invoices analysis.

Thanks,
pso (Open ERP)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/pso-dev-addons3/+merge/44650
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/pso-dev-addons3 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'account_voucher/__openerp__.py'
--- account_voucher/__openerp__.py	2010-11-19 13:56:06 +0000
+++ account_voucher/__openerp__.py	2010-12-24 08:25:54 +0000
@@ -48,6 +48,7 @@
         "voucher_sales_purchase_view.xml",
         "account_voucher_wizard.xml",
         "account_voucher_pay_invoice.xml",
+        "report/report_sale_receipt_view.xml",
         "security/account_voucher_security.xml"
     ],
     "test" : [

=== modified file 'account_voucher/report/__init__.py'
--- account_voucher/report/__init__.py	2010-10-15 06:01:40 +0000
+++ account_voucher/report/__init__.py	2010-12-24 08:25:54 +0000
@@ -21,5 +21,6 @@
 
 import account_voucher
 import account_voucher_print
+import report_sale_receipt
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== added file 'account_voucher/report/report_sale_receipt.py'
--- account_voucher/report/report_sale_receipt.py	1970-01-01 00:00:00 +0000
+++ account_voucher/report/report_sale_receipt.py	2010-12-24 08:25:54 +0000
@@ -0,0 +1,119 @@
+##############################################################################
+#    
+#    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 sale_receipt_report(osv.osv):
+    _name = "sale.receipt.report"
+    _description = "Sales Receipt Statistics"
+    _auto = False
+    _rec_name = 'date'
+    _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),
+        'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], readonly=True),
+        'currency_id': fields.many2one('res.currency', 'Currency', 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 Without Tax', readonly=True),
+        'price_total_tax': fields.float('Total With Tax', readonly=True),
+        'nbr':fields.integer('# of Voucher Lines', readonly=True),
+        'type': fields.selection([
+            ('sale','Sale'),
+            ('purchase','Purchase'),
+            ('payment','Payment'),
+            ('receipt','Receipt'),
+            ],'Type', readonly=True),
+        'state': fields.selection([
+            ('draft','Draft'),
+             ('proforma','Pro-forma'),
+             ('posted','Posted'),
+             ('cancel','Cancelled')
+            ], 'Voucher State', readonly=True),
+        'date_due': fields.date('Due Date', readonly=True),
+        'account_id': fields.many2one('account.account', 'Account',readonly=True),
+    }
+    _order = 'date desc'
+    def init(self, cr):
+        tools.drop_view_if_exists(cr, 'sale_receipt_report')
+        cr.execute("""
+            create or replace view sale_receipt_report as (
+                 select min(avl.id) as id,
+                    av.date as date,
+                    to_char(av.date, 'YYYY') as year,
+                    to_char(av.date, 'MM') as month,
+                    to_char(av.date, 'YYYY-MM-DD') as day,
+                    av.partner_id as partner_id,
+                    av.period_id as period_id,
+                    av.currency_id as currency_id,
+                    av.journal_id as journal_id,
+                    rp.user_id as user_id,
+                    av.company_id as company_id,
+                    count(avl.*) as nbr,
+                    av.type as type,
+                    av.state,
+                    av.date_due as date_due,
+                    av.account_id as account_id,
+                    sum(av.amount-av.tax_amount)/(select count(l.id) from account_voucher_line as l
+                            left join account_voucher as a ON (a.id=l.voucher_id)
+                            where a.id=av.id) as price_total,
+                    sum(av.amount)/(select count(l.id) from account_voucher_line as l
+                            left join account_voucher as a ON (a.id=l.voucher_id)
+                            where a.id=av.id) as price_total_tax
+                from account_voucher_line as avl
+                left join account_voucher as av on (av.id=avl.voucher_id)
+                left join res_partner as rp ON (rp.id=av.partner_id)
+                left join account_journal as aj ON (aj.id=av.journal_id)
+                where av.type='sale' and aj.type in ('sale','sale_refund')
+                group by 
+                    av.date,
+                    av.id,
+                    to_char(av.date, 'YYYY'),
+                    to_char(av.date, 'MM'),
+                    to_char(av.date, 'YYYY-MM-DD'),
+                    av.partner_id,
+                    av.period_id,
+                    av.currency_id,
+                    av.journal_id,
+                    rp.user_id,
+                    av.company_id,
+                    av.type,
+                    av.state,
+                    av.date_due,
+                    av.account_id,
+                    av.tax_amount, 
+                    av.amount, 
+                    av.tax_amount
+            )
+        """)
+
+sale_receipt_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_voucher/report/report_sale_receipt_view.xml'
--- account_voucher/report/report_sale_receipt_view.xml	1970-01-01 00:00:00 +0000
+++ account_voucher/report/report_sale_receipt_view.xml	2010-12-24 08:25:54 +0000
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data> 
+   
+   <record id="view_sale_receipt_report_tree" model="ir.ui.view">
+        <field name="name">sale.receipt.report.tree</field>
+        <field name="model">sale.receipt.report</field>
+        <field name="type">tree</field>
+        <field name="arch" type="xml">
+            <tree colors="blue:state in ('draft');gray:state in ('cancel','paid');black:state in ('proforma','proforma2')"  string="Sales Receipt Analysis">
+                <field name="date" invisible="1"/>
+                <field name="user_id" invisible="1"/>
+                <field name="year" invisible="1"/>
+                <field name="day" invisible="1"/>
+                <field name="month" invisible="1"/>
+                <field name="type" invisible="1"/>
+                <field name="company_id" invisible="1"/>
+                <field name="partner_id" invisible="1"/>
+                <field name="state" invisible="1"/>
+                <field name="period_id" invisible="1"/>
+                <field name="currency_id" invisible="1"/>
+                <field name="journal_id" invisible="1"/>
+                <field name="date_due" invisible="1"/>
+                <field name="account_id" invisible="1"/>
+                <field name="nbr" sum="# of Voucher Lines"/>
+                <field name="price_total" sum="Total Without Tax"/>
+                <field name="price_total_tax" sum="Total With Tax"/>
+            </tree>
+        </field>
+    </record>
+
+    <record id="view_sale_receipt_report_graph" model="ir.ui.view">
+         <field name="name">sale.receipt.report.graph</field>
+         <field name="model">sale.receipt.report</field>
+         <field name="type">graph</field>
+         <field name="arch" type="xml">
+             <graph string="Sales Receipt Analysis" type="bar">
+                 <field name="account_id"/>
+                 <field name="price_total"/>
+             </graph>
+         </field>
+    </record>
+
+    <record id="view_sale_receipt_report_search" model="ir.ui.view">
+        <field name="name">sale.receipt.report.search</field>
+        <field name="model">sale.receipt.report</field>
+        <field name="type">search</field>
+        <field name="arch" type="xml">
+            <search string="Sales Receipt Analysis">
+              <group col="10" colspan="12">
+                    <filter string="Draft"
+                           icon="terp-document-new"
+                           domain="[('state','=','draft')]"
+                           help = "Draft Vouchers"/>
+                    <filter string="Pro-forma"
+                           icon="terp-gtk-media-pause"
+                           domain="[('state','=','proforma')]"
+                           help = "Pro-forma Vouchers"/>
+                    <filter string="Posted"
+                           name="current"
+                           icon="terp-check"
+                           domain="[('state','not in', ('draft','cancel'))]"
+                           help = "Validated Vouchers"/>
+                    <separator orientation="vertical"/>
+                    <filter icon="terp-personal" string="Sale"
+                            name="sale"
+                            domain="[('type','=','sale')]"
+                            help="Sale Type Vouchers"/>
+                    <filter icon="terp-personal"
+                            string="Purchase"
+                            separator="1"
+                            domain="[('type','=','purchase')]"
+                            help="Purchase Type Vouchers"/>
+                   <separator orientation="vertical"/>
+                   <field name="partner_id"/>
+                   <field name="date" string="Voucher Date"/>
+                </group>
+                <newline/>
+                <group expand="0" string="Extended Filters..." groups="base.group_extended">
+                    <field name="journal_id" widget="selection"/>
+                    <field name="account_id"/>
+                    <separator orientation="vertical"/>
+                    <field name="date_due"/>
+                    <separator orientation="vertical" groups="base.group_multi_company"/>
+                    <field name="company_id" groups="base.group_multi_company" widget="selection"/>
+                </group>
+                <newline/>
+                <group expand="1" string="Group By...">
+                    <filter string="Partner" name="partner" icon="terp-partner" context="{'group_by':'partner_id','residual_visible':True}"/>
+                    <filter string="Salesman" name='user' icon="terp-personal" context="{'group_by':'user_id'}"/>
+                    <separator orientation="vertical"/>
+                    <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
+                    <filter string="Type" icon="terp-stock_symbol-selection" context="{'group_by':'type'}"/>
+                    <separator orientation="vertical"/>
+                    <filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
+                    <separator orientation="vertical"/>
+                    <filter string="Due Date" icon="terp-go-today" context="{'group_by':'date_due'}"/>
+                    <filter string="Period" icon="terp-go-month" context="{'group_by':'period_id'}"/>
+                    <separator orientation="vertical" groups="base.group_multi_company"/>
+                    <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
+                    <separator orientation="vertical"/>
+                    <filter string="Day" name="day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by Invoice Date"/>
+                    <filter string="Month" name="month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of Invoice Date"/>
+                    <filter string="Year" name="year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of Invoice Date"/>
+                </group>
+            </search>
+        </field>
+    </record>
+
+    <record id="action_sale_receipt_report_all" model="ir.actions.act_window">
+        <field name="name">Sales Receipt Analysis</field>
+        <field name="res_model">sale.receipt.report</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,graph</field>
+        <field name="context">{'search_default_current':1, 'search_default_partner':1, 'search_default_customer':1, 'search_default_date': time.strftime('%Y-01-01'), 'group_by':[], 'group_by_no_leaf':1,}</field>
+        <field name="search_view_id" ref="view_sale_receipt_report_search"/>
+        <field name="help">From this report, you can have an overview of the amount invoiced to your customer as well as payment delays. The tool search can also be used to personalise your Invoices reports and so, match this analysis to your needs.</field>
+
+    </record>
+
+    <menuitem action="action_sale_receipt_report_all" id="menu_action_sale_receipt_report_all" parent="account.menu_finance_statistic_report_statement"/>
+       
+   </data>
+</openerp>
\ No newline at end of file


Follow ups