From c69545f00d2567c2d49c13028297a3c1107fc803 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Tue, 6 Apr 2010 16:44:25 +0530 Subject: [PATCH 1/6] [ADD] board_purchase module added bzr revid: vir@tinyerp.com-20100406111425-kca3bssxaj51kltf --- addons/board_purchase/__init__.py | 24 ++++++ addons/board_purchase/__terp__.py | 41 ++++++++++ addons/board_purchase/board_purchase_view.xml | 57 ++++++++++++++ addons/purchase/purchase_view.xml | 16 ++-- addons/purchase/report/purchase_report.py | 66 +++++++++++++++- .../purchase/report/purchase_report_view.xml | 77 +++++++++++++++++-- addons/purchase/security/ir.model.access.csv | 2 +- 7 files changed, 266 insertions(+), 17 deletions(-) create mode 100644 addons/board_purchase/__init__.py create mode 100644 addons/board_purchase/__terp__.py create mode 100644 addons/board_purchase/board_purchase_view.xml diff --git a/addons/board_purchase/__init__.py b/addons/board_purchase/__init__.py new file mode 100644 index 00000000000..3c3121d954a --- /dev/null +++ b/addons/board_purchase/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/board_purchase/__terp__.py b/addons/board_purchase/__terp__.py new file mode 100644 index 00000000000..f5ada7cfe46 --- /dev/null +++ b/addons/board_purchase/__terp__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + + +{ + 'name': 'Board for Purchase Management', + 'version': '1.0', + 'category': 'Board/Purchase', + 'description': """ +This module implements a dashboard for purcgase management that includes: + * Current Purchase Orders + * Draft Purchase Orders + * Graph for quantity and amount per month + """, + 'author': 'Tiny', + 'depends': [ 'purchase','board', + ], + 'update_xml': ['board_purchase_view.xml'], + 'demo_xml': [], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/board_purchase/board_purchase_view.xml b/addons/board_purchase/board_purchase_view.xml new file mode 100644 index 00000000000..4838c845cf1 --- /dev/null +++ b/addons/board_purchase/board_purchase_view.xml @@ -0,0 +1,57 @@ + + + + + + + + + Quotation Request + ir.actions.act_window + purchase.order + form + [('state','in',('wait','confirmed'))] + tree,form + + + + + board.purchase.form + board.board + form + +
+ + + + + + + + + + +
+
+
+ + + Purchase Dashboard + board.board + form + form + menu + + + + +
+
\ No newline at end of file diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 653238748b9..c7247256bfc 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -157,13 +157,13 @@ - + - - + + @@ -176,10 +176,10 @@ purchase.order form [('state','=','draft')] - tree,form - + tree,form + - @@ -216,7 +216,7 @@ - + @@ -289,7 +289,7 @@ name="Product purchases" res_model="purchase.order.line" src_model="product.product"/> - + + + project.vs.remaining.hour.tree + project.vs.remaining.hours + tree + + + + + + + + + + + project.vs.remaining.hour.graph + project.vs.remaining.hours + graph + + + + + + + + + + Project and remaining hours + project.vs.remaining.hours + form + graph,tree + + + + + task.by.days.tree + task.by.days + tree + + + + + + + + + + task.by.days.graph + task.by.days + graph + + + + + + + + + + Task By Days + task.by.days + form + graph,tree + + + + + + task.by.days.vs.planned.hours.tree + task.by.days.vs.planned.hours + tree + + + + + + + + + + task.by.days.vs.planned.hours.graph + task.by.days.vs.planned.hours + graph + + + + + + + + + + Task By Days vs Planned Hours + task.by.days.vs.planned.hours + form + graph,tree + + diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py index ef1e002ae78..3f3c97fc5e0 100644 --- a/addons/project_issue/report/project_issue_report.py +++ b/addons/project_issue/report/project_issue_report.py @@ -35,7 +35,7 @@ class project_issue_report(osv.osv): c.priority as priority, c.project_id as project_id, c.type_id as type_id, - count(*) as nbr, + count(*) as nbr, to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close from project_issue c @@ -49,4 +49,5 @@ class project_issue_report(osv.osv): project_issue_report() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_issue/report/project_issue_report_view.xml b/addons/project_issue/report/project_issue_report_view.xml index 2f7886670c2..52b6f336d58 100644 --- a/addons/project_issue/report/project_issue_report_view.xml +++ b/addons/project_issue/report/project_issue_report_view.xml @@ -117,5 +117,7 @@ + + From 859d60a716ad67c2081f1f1748648c23ec37fdfb Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Tue, 6 Apr 2010 18:54:56 +0530 Subject: [PATCH 3/6] [MOD] board_hr : remaining holidays by user, instead of leaves by type bzr revid: vir@tinyerp.com-20100406132456-kfz5d1fkyc26p42d --- addons/board_hr/board_hr_view.xml | 17 +++++------ .../hr_holidays/report/hr_holidays_report.py | 28 ++++++++++--------- .../report/hr_holidays_report_view.xml | 12 ++++---- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/addons/board_hr/board_hr_view.xml b/addons/board_hr/board_hr_view.xml index 2a587c03a23..b2c105691fe 100644 --- a/addons/board_hr/board_hr_view.xml +++ b/addons/board_hr/board_hr_view.xml @@ -43,13 +43,14 @@ - - Leaves by Type + + Remaining Leaves by User ir.actions.act_window - hr.holidays.by.type + hr.holidays.remaining.leaves.user form graph,tree - + [('user_id','=',uid)] + board.hr.form @@ -60,12 +61,12 @@ - - + + - - + + diff --git a/addons/hr_holidays/report/hr_holidays_report.py b/addons/hr_holidays/report/hr_holidays_report.py index 5652d32b9d5..4bae007f281 100644 --- a/addons/hr_holidays/report/hr_holidays_report.py +++ b/addons/hr_holidays/report/hr_holidays_report.py @@ -71,29 +71,31 @@ class hr_holidays_report(osv.osv): """) hr_holidays_report() -class hr_holidays_by_type(osv.osv): - _name = "hr.holidays.by.type" +class hr_holidays_remaining_leaves_user(osv.osv): + _name = "hr.holidays.remaining.leaves.user" _description = "Total holidays by type" _auto = False _columns = { - 'name': fields.char('Leave Type',size=64), - 'no_of_leaves' : fields.integer('Total leaves'), + 'name': fields.char('Employee',size=64), + 'no_of_leaves' : fields.integer('Remaining leaves'), + 'user_id':fields.many2one('res.users','User'), } def init(self, cr): - tools.drop_view_if_exists(cr, 'hr_holidays_by_type') + tools.drop_view_if_exists(cr, 'hr_holidays_remaining_leaves_user') cr.execute(""" - create or replace view hr_holidays_by_type as ( + create or replace view hr_holidays_remaining_leaves_user as ( select - min(hhl.id) as id, - hhs.name as name, - sum(hhl.number_of_days) * -1 as no_of_leaves + min(hrs.id) as id, + rr.name as name, + sum(hrs.number_of_days) as no_of_leaves, + hrs.user_id from - hr_holidays as hhl,hr_holidays_status as hhs + hr_holidays as hrs, hr_employee as hre, resource_resource as rr where - hhs.id = hhl.holiday_status_id and number_of_days < 0 + hrs.employee_id = hre.id and hre.resource_id = rr.id group by - hhs.name,hhl.holiday_status_id + rr.name,hrs.user_id ) """) -hr_holidays_by_type() +hr_holidays_remaining_leaves_user() diff --git a/addons/hr_holidays/report/hr_holidays_report_view.xml b/addons/hr_holidays/report/hr_holidays_report_view.xml index a70db034e2b..7c15f77da72 100644 --- a/addons/hr_holidays/report/hr_holidays_report_view.xml +++ b/addons/hr_holidays/report/hr_holidays_report_view.xml @@ -90,9 +90,9 @@ - - hr.holidays.by.type.tree - hr.holidays.by.type + + hr.holidays.remaining.leaves.user.tree + hr.holidays.remaining.leaves.user tree @@ -102,9 +102,9 @@ - - hr.holidays.by.type.graph - hr.holidays.by.type + + hr.holidays.remaining.leaves.user.graph + hr.holidays.remaining.leaves.user graph From 3a13731d0777a25260f3628f3647d2c1122e6dfa Mon Sep 17 00:00:00 2001 From: "RCH(Open ERP)" <> Date: Wed, 7 Apr 2010 11:29:42 +0530 Subject: [PATCH 4/6] [MOD] Small changes in project issue and purchase dashboard bzr revid: vir@tinyerp.com-20100407055942-6v8u0ocm8a1lpv9f --- addons/board_purchase/board_purchase_view.xml | 4 ++-- addons/project/report/project_report.py | 6 ++++-- addons/project/report/project_report_view.xml | 3 +++ addons/purchase/report/purchase_report_view.xml | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/board_purchase/board_purchase_view.xml b/addons/board_purchase/board_purchase_view.xml index 4838c845cf1..d1ac01b9e7f 100644 --- a/addons/board_purchase/board_purchase_view.xml +++ b/addons/board_purchase/board_purchase_view.xml @@ -30,8 +30,8 @@ - - + + diff --git a/addons/project/report/project_report.py b/addons/project/report/project_report.py index a8d2f0a550a..af3eae3365a 100644 --- a/addons/project/report/project_report.py +++ b/addons/project/report/project_report.py @@ -119,6 +119,7 @@ class task_by_days(osv.osv): _auto = False _columns = { 'day': fields.char('Day', size=128, required=True), + 'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True), 'total_task': fields.float('Total tasks', readonly=True) } _order = 'day desc' @@ -129,11 +130,12 @@ class task_by_days(osv.osv): select min(pt.id) as id, to_char(pt.create_date, 'YYYY-MM-DD') as day, - count(*) as total_task + count(*) as total_task, + pt.state as state from project_task as pt group by - to_char(pt.create_date, 'YYYY-MM-DD') + to_char(pt.create_date, 'YYYY-MM-DD'),pt.state ) """) task_by_days() diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml index 11419be662e..a318df67832 100644 --- a/addons/project/report/project_report_view.xml +++ b/addons/project/report/project_report_view.xml @@ -88,6 +88,7 @@ + @@ -109,6 +110,7 @@ + @@ -120,6 +122,7 @@ + diff --git a/addons/purchase/report/purchase_report_view.xml b/addons/purchase/report/purchase_report_view.xml index 9482cef716d..19f13755083 100644 --- a/addons/purchase/report/purchase_report_view.xml +++ b/addons/purchase/report/purchase_report_view.xml @@ -139,8 +139,8 @@ graph - - + + From 3681d53a9150f66dcb4c7b901aed0b1b5027bc5e Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Wed, 7 Apr 2010 13:04:57 +0530 Subject: [PATCH 5/6] [IMP]:sale,purchase:Improved SQL Reports. bzr revid: apa@tinyerp.com-20100407073457-ht3odfppeo46fim3 --- addons/purchase/report/purchase_report.py | 18 ++++++++++------ .../purchase/report/purchase_report_view.xml | 21 ++++++++++++++++++- addons/sale/report/sale_report.py | 6 +++++- addons/sale/report/sale_report_view.xml | 15 +++++++++++++ 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/addons/purchase/report/purchase_report.py b/addons/purchase/report/purchase_report.py index f447fd598f9..f5338e93723 100644 --- a/addons/purchase/report/purchase_report.py +++ b/addons/purchase/report/purchase_report.py @@ -43,9 +43,15 @@ class report_purchase_order(osv.osv): ('done','Done'), ('cancel','Cancel') ], 'Order State', readonly=True), + 'invoice_method': fields.selection([ + ('manual','Manual'), + ('order','From Order'), + ('picking','From Picking') + ],'Invoicing Control', readonly=True), 'product_id':fields.many2one('product.product', 'Product', readonly=True), 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', readonly=True), - 'category_id': fields.many2one('product.category', 'Categories', readonly=True), + 'location_id': fields.many2one('stock.location', 'Destination', readonly=True), + 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position',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', 'Responsible', readonly=True), @@ -70,24 +76,24 @@ class report_purchase_order(osv.osv): s.state, s.warehouse_id as warehouse_id, s.partner_id as partner_id, + s.fiscal_position, s.create_uid as user_id, s.company_id as company_id, + s.invoice_method, l.product_id, - t.categ_id as category_id, + s.location_id as location_id, sum(l.product_qty*u.factor) as quantity, count(*) as nbr, sum(l.product_qty*l.price_unit) as price_total, (sum(l.product_qty*l.price_unit)/sum(l.product_qty*u.factor))::decimal(16,2) as price_average from purchase_order s left join purchase_order_line l on (s.id=l.order_id) - left join product_product p on (p.id=l.product_id) - left join product_template t on (t.id=p.product_tmpl_id) left join product_uom u on (u.id=l.product_uom) where l.product_id is not null group by s.company_id,s.create_uid,s.partner_id, - t.categ_id,l.product_id,s.date_order, + s.location_id,l.product_id,s.date_order, to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),s.state, - s.warehouse_id + s.warehouse_id,s.fiscal_position,s.invoice_method ) """) report_purchase_order() diff --git a/addons/purchase/report/purchase_report_view.xml b/addons/purchase/report/purchase_report_view.xml index 19f13755083..5fe1330dcae 100644 --- a/addons/purchase/report/purchase_report_view.xml +++ b/addons/purchase/report/purchase_report_view.xml @@ -33,6 +33,8 @@ + + @@ -72,16 +74,32 @@ + + + + + + + + + + + + + + - + + + @@ -95,6 +113,7 @@ form tree,graph + {'search_default_user_id':True} diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index 9ca34fc2d3d..77cdb4d4cc3 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -39,6 +39,8 @@ class sale_report(osv.osv): 'partner_id':fields.many2one('res.partner', 'Partner', readonly=True), 'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True), 'company_id':fields.many2one('res.company', 'Company', readonly=True), + 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True), + 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position',readonly=True), 'user_id':fields.many2one('res.users', 'Salesman', readonly=True), 'price_total':fields.float('Total Price', readonly=True), 'delay':fields.float('Avg Closing Days', digits=(16,2), readonly=True), @@ -70,6 +72,8 @@ class sale_report(osv.osv): s.partner_id as partner_id, s.user_id as user_id, s.shop_id as shop_id, + s.fiscal_position as fiscal_position, + s.payment_term as payment_term, s.company_id as company_id, extract(epoch from avg(s.date_confirm-s.create_date))/(24*60*60)::decimal(16,2) as delay, sum(l.product_uom_qty*l.price_unit) as price_total, @@ -84,7 +88,7 @@ class sale_report(osv.osv): group by s.date_order, s.partner_id, l.product_id, l.product_uom, s.user_id, s.state, s.shop_id, - s.company_id + s.company_id,s.fiscal_position,s.payment_term ) """) sale_report() diff --git a/addons/sale/report/sale_report_view.xml b/addons/sale/report/sale_report_view.xml index 79fd67084d2..9b927a7d7a0 100644 --- a/addons/sale/report/sale_report_view.xml +++ b/addons/sale/report/sale_report_view.xml @@ -21,6 +21,8 @@ + + @@ -72,6 +74,17 @@ + + + + + + + + + + + @@ -80,8 +93,10 @@ + + From c5c66ed258e5d33c4967a6ed712f933c53cd367a Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Wed, 7 Apr 2010 14:37:16 +0530 Subject: [PATCH 6/6] [IMP]:sale,purchase,account:Improved SQL reports. bzr revid: apa@tinyerp.com-20100407090716-t2mf8cd54peqs4pp --- .../account/report/account_invoice_report.py | 26 ++++++++++++++++--- .../report/account_invoice_report_view.xml | 11 ++++++++ addons/purchase/report/purchase_report.py | 17 +++++++++--- addons/sale/report/sale_report.py | 13 +++++++--- 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 0d4ac30323d..548e6eb50a6 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -35,6 +35,11 @@ class account_invoice_report(osv.osv): ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), 'product_id':fields.many2one('product.product', 'Product', readonly=True), 'product_qty':fields.float('Qty', readonly=True), + 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True), + 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')],readonly=True), + 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position',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), @@ -69,6 +74,11 @@ class account_invoice_report(osv.osv): l.product_id as product_id, sum(l.quantity * u.factor) as product_qty, s.partner_id as partner_id, + s.payment_term as payment_term, + s.period_id as period_id, + s.currency_id as currency_id, + s.journal_id as journal_id, + s.fiscal_position as fiscal_position, s.user_id as user_id, s.company_id as company_id, sum(l.quantity*l.price_unit) as price_total, @@ -82,9 +92,19 @@ 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.type,s.date_invoice, s.partner_id, l.product_id, - l.uos_id, s.user_id, s.state, - s.company_id + s.type, + s.date_invoice, + s.partner_id, + l.product_id, + l.uos_id, + s.user_id, + s.state, + s.company_id, + s.payment_term, + s.period_id, + s.fiscal_position, + s.currency_id, + s.journal_id ) """) account_invoice_report() diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 6dbb5f336aa..00dd2b1304d 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -21,6 +21,11 @@ + + + + + @@ -88,11 +93,17 @@ + + + + + + diff --git a/addons/purchase/report/purchase_report.py b/addons/purchase/report/purchase_report.py index f5338e93723..d357e7c9aa5 100644 --- a/addons/purchase/report/purchase_report.py +++ b/addons/purchase/report/purchase_report.py @@ -90,10 +90,19 @@ class report_purchase_order(osv.osv): left join purchase_order_line l on (s.id=l.order_id) left join product_uom u on (u.id=l.product_uom) where l.product_id is not null - group by s.company_id,s.create_uid,s.partner_id, - s.location_id,l.product_id,s.date_order, - to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),s.state, - s.warehouse_id,s.fiscal_position,s.invoice_method + group by + s.company_id, + s.create_uid, + s.partner_id, + s.location_id, + l.product_id, + s.date_order, + to_char(s.date_order, 'YYYY'), + to_char(s.date_order, 'MM'), + s.state, + s.warehouse_id, + s.fiscal_position, + s.invoice_method ) """) report_purchase_order() diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index 77cdb4d4cc3..6db3b9e044b 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -86,9 +86,16 @@ class sale_report(osv.osv): sale_order s on (s.id=l.order_id) left join product_uom u on (u.id=l.product_uom) group by - s.date_order, s.partner_id, l.product_id, - l.product_uom, s.user_id, s.state, s.shop_id, - s.company_id,s.fiscal_position,s.payment_term + s.date_order, + s.partner_id, + l.product_id, + l.product_uom, + s.user_id, + s.state, + s.shop_id, + s.company_id, + s.fiscal_position, + s.payment_term ) """) sale_report()