+
+
+
+ Scrum Dashboard
+ board.board
+ form
+ form
+ menu
+
+
+
+
+
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/account/wizard/wizard_account_duplicate.py b/addons/board_purchase/__terp__.py
similarity index 50%
rename from addons/account/wizard/wizard_account_duplicate.py
rename to addons/board_purchase/__terp__.py
index abded25e9ad..f5ada7cfe46 100644
--- a/addons/account/wizard/wizard_account_duplicate.py
+++ b/addons/board_purchase/__terp__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,39 +15,27 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
-import wizard
-import pooler
-duplicate_form = '''
-
+
+
+
+
+ Purchase Dashboard
+ board.board
+ form
+ form
+ menu
+
+
+
+
+
+
diff --git a/addons/board_sale/__openerp__.py b/addons/board_sale/__openerp__.py
index bf4e572d031..1c9d01d376a 100644
--- a/addons/board_sale/__openerp__.py
+++ b/addons/board_sale/__openerp__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,7 +15,7 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
diff --git a/addons/board_sale/board_sale_view.xml b/addons/board_sale/board_sale_view.xml
index c58a4983185..d04b6204940 100644
--- a/addons/board_sale/board_sale_view.xml
+++ b/addons/board_sale/board_sale_view.xml
@@ -5,39 +5,37 @@
Sales
-
- crm.phonecall
- form
- tree,calendar
-
- [('user_id','=',uid)]
-
-
-
-
-
- crm.meeting
- tree,form,gantt
-
- [('user_id','=',uid)]
- [('date','>=',time.strftime('%Y-%m-%d')),('date','<=',(datetime.datetime.today() + datetime.timedelta(days=2)).strftime('%Y-%m-%d'))]
-
-
+
board.sales.manager.formboard.boardform
-
+
-
-
+
+
-
-
-
+
+
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 30e1db744cc..85a27bb5d55 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -432,11 +432,20 @@ class crm_case(osv.osv):
"""
if not context:
context = {}
+
+ hist_obj = self.pool.get('crm.case.history')
+ log_obj = self.pool.get('crm.case.log')
for case in self.browse(cr, uid, ids, context):
if (not case.section_id.allow_unlink) and (case.state <> 'draft'):
raise osv.except_osv(_('Warning !'),
_('You can not delete this case. You should better cancel it.'))
+
+ # Also removing history and logs
+ history_ids = map(lambda x: x.id, case.history_line)
+ log_ids = map(lambda x: x.id, case.log_ids)
+ hist_obj.unlink(cr, uid, history_ids, context=context)
+ log_obj.unlink(cr, uid, log_ids, context=context)
return super(crm_case, self).unlink(cr, uid, ids, context)
def stage_next(self, cr, uid, ids, context=None):
diff --git a/addons/crm/crm_claims_menu.xml b/addons/crm/crm_claims_menu.xml
index 7b52343342e..16711036100 100644
--- a/addons/crm/crm_claims_menu.xml
+++ b/addons/crm/crm_claims_menu.xml
@@ -14,7 +14,7 @@
formtree,calendar,form,graph
- {"search_default_section_id":section_id,"search_default_current":1,"search_default_my_claims":1}
+ {"search_default_section_id":section_id,"search_default_current":1,"search_default_my_claims":1}
diff --git a/addons/crm/crm_claims_view.xml b/addons/crm/crm_claims_view.xml
index 722c1f3db94..39cc8778e0b 100644
--- a/addons/crm/crm_claims_view.xml
+++ b/addons/crm/crm_claims_view.xml
@@ -161,7 +161,7 @@
-
+
@@ -183,7 +183,7 @@
@@ -245,9 +245,9 @@
search
-
-
+
+ widget="selection"
+ default="context.get('section_id', False)">
diff --git a/addons/crm/crm_fund_menu.xml b/addons/crm/crm_fund_menu.xml
index bc4b91fa409..7a53ab1aa18 100644
--- a/addons/crm/crm_fund_menu.xml
+++ b/addons/crm/crm_fund_menu.xml
@@ -13,7 +13,6 @@
crm.fundraisingtree,form,graph
- {"search_default_my_funds":1,"search_default_section_id":section_id}
diff --git a/addons/crm/crm_fund_view.xml b/addons/crm/crm_fund_view.xml
index a2a104adf15..20d3f5a286a 100644
--- a/addons/crm/crm_fund_view.xml
+++ b/addons/crm/crm_fund_view.xml
@@ -196,7 +196,7 @@
@@ -257,7 +257,7 @@
diff --git a/addons/crm/crm_helpdesk_menu.xml b/addons/crm/crm_helpdesk_menu.xml
index b1a7dfcc428..bd3f0889bd1 100644
--- a/addons/crm/crm_helpdesk_menu.xml
+++ b/addons/crm/crm_helpdesk_menu.xml
@@ -11,7 +11,6 @@
crm.helpdesktree,calendar,form
- {"search_default_my_hd_request":1,"search_default_section_id":section_id}
diff --git a/addons/crm/crm_helpdesk_view.xml b/addons/crm/crm_helpdesk_view.xml
index dc11b071a4c..fa2071f950b 100644
--- a/addons/crm/crm_helpdesk_view.xml
+++ b/addons/crm/crm_helpdesk_view.xml
@@ -104,7 +104,7 @@
-
+
@@ -126,7 +126,7 @@
@@ -224,8 +224,9 @@
-
+ date_until:
- break
+ break
duration = len(no_days)
res[lead.id][field] = abs(int(duration))
return res
@@ -126,9 +126,9 @@ class crm_lead(osv.osv):
'referred': fields.char('Referred By', size=64),
'date_open': fields.datetime('Opened', readonly=True),
'day_open': fields.function(_compute_day, string='Days to Open', \
- method=True, multi='day_open', type="integer", store=True),
+ method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
- method=True, multi='day_close', type="integer", store=True),
+ method=True, multi='day_close', type="float", store=True),
'function_name': fields.char('Function', size=64),
}
diff --git a/addons/crm/crm_lead_menu.xml b/addons/crm/crm_lead_menu.xml
index d9424b77fc4..4d752ca8a9b 100644
--- a/addons/crm/crm_lead_menu.xml
+++ b/addons/crm/crm_lead_menu.xml
@@ -7,8 +7,6 @@
crm.leadtree,form
- {"search_default_current":1,"search_default_my_lead":1,"search_default_section_id":section_id}
- {"search_default_current":1,"search_default_my_lead":1,"search_default_section_id":section_id}
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 829372fb30b..03318270e9b 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -264,8 +264,9 @@
search
-
-
-
+ gantt
-
-
+ gantt
@@ -85,7 +85,6 @@
crm.meetingcalendar,tree,form,gantt
- {"search_default_current":1,"search_default_section_id":section_id}
@@ -116,27 +115,26 @@
+ parent="base.menu_base_partner" sequence="3" />
+ action="crm_case_categ_meet" parent="menu_meeting_sale"
+ sequence="1" />
- Meeting Invitations
- ir.actions.act_window
- calendar.attendee
- form
- tree,form
-
+ Meeting Invitations
+ ir.actions.act_window
+ calendar.attendee
+ form
+ tree,form
+ [('ref','like','crm.meeting,')]
- {'default_sent_by_uid': uid}
-
+ {'default_sent_by_uid': uid}
+
+ name="Meeting Invitations" parent="crm.menu_meeting_sale"
+ sequence="10" action="action_view_attendee_form" />
@@ -146,7 +144,7 @@
tree,calendar,form,gantt
+ eval="[('state','in',('pending','draft','open')),('date','>=',time.strftime('%Y-%m-%d'))]" />
@@ -170,7 +168,7 @@
-
+ gantt
diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py
index e147d4ed20d..204890e348c 100644
--- a/addons/crm/crm_opportunity.py
+++ b/addons/crm/crm_opportunity.py
@@ -62,9 +62,9 @@ class crm_opportunity(osv.osv):
@param ids: List of Openday’s IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
- """
- cal_obj = self.pool.get('resource.calendar')
- res_obj = self.pool.get('resource.resource')
+ """
+ cal_obj = self.pool.get('resource.calendar')
+ res_obj = self.pool.get('resource.resource')
res = {}
for opportunity in self.browse(cr, uid, ids , context):
@@ -93,7 +93,7 @@ class crm_opportunity(osv.osv):
duration = float(ans.days)
if opportunity.section_id.resource_calendar_id:
- duration = float(ans.days) * 24
+ duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
opportunity.section_id.resource_calendar_id and opportunity.section_id.resource_calendar_id.id or False,
@@ -105,9 +105,9 @@ class crm_opportunity(osv.osv):
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
- no_days.append(in_time.date)
+ no_days.append(in_time.date)
if out_time > date_until:
- break
+ break
duration = len(no_days)
res[opportunity.id][field] = abs(int(duration))
return res
@@ -138,9 +138,9 @@ class crm_opportunity(osv.osv):
'date_open': fields.datetime('Opened', readonly=True),
'day_open': fields.function(_compute_day, string='Days to Open', \
- method=True, multi='day_open', type="integer", store=True),
+ method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
- method=True, multi='day_close', type="integer", store=True),
+ method=True, multi='day_close', type="float", store=True),
}
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
diff --git a/addons/crm/crm_opportunity_menu.xml b/addons/crm/crm_opportunity_menu.xml
index ba01ca72be4..3bcdbc7bb9f 100644
--- a/addons/crm/crm_opportunity_menu.xml
+++ b/addons/crm/crm_opportunity_menu.xml
@@ -27,7 +27,6 @@
crm.opportunitytree,form,graph
- {"search_default_my_oprtnit":1,"search_default_new_oprtnit":1,"search_default_section_id":section_id}
diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml
index b7019885a4a..4bdc0d90158 100644
--- a/addons/crm/crm_opportunity_view.xml
+++ b/addons/crm/crm_opportunity_view.xml
@@ -86,13 +86,15 @@
-
+
+ on_change="onchange_partner_id(partner_id, email_from)"
+ colspan="2" />
+ on_change="onchange_partner_address_id(partner_address_id, email_from)"
+ colspan="1" />
@@ -104,7 +106,7 @@
domain="[('object_id.model', '=', 'crm.opportunity')]" />
-
+
@@ -216,7 +218,7 @@
-
+
@@ -264,6 +266,7 @@
-
+ help="My Opportunities" default="1"
+ />
formtree,calendar
- {"set_editable":True,"default_state":'open',"search_default_my_calls":1,"search_default_state":1,"search_default_section_id":section_id}
@@ -56,7 +55,7 @@
tree,calendar
- {"default_state":'open',"search_default_my_calls":1,"search_default_state":1,"search_default_section_id":section_id}
+ {'set_editable':True,'default_state':'open'}
diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml
index dfa949ad0b7..e5d6c7565df 100644
--- a/addons/crm/crm_phonecall_view.xml
+++ b/addons/crm/crm_phonecall_view.xml
@@ -176,9 +176,9 @@
-
+
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml
index f3c178afb74..31d82cd94fb 100644
--- a/addons/crm/crm_view.xml
+++ b/addons/crm/crm_view.xml
@@ -404,7 +404,7 @@
@@ -436,7 +436,7 @@
+ default="1" help="Cases Related to Current User" />
+ default="context.get('section_id', False)" select="1"
+ widget="selection"/>
@@ -528,6 +529,7 @@
diff --git a/addons/crm/i18n/fi.po b/addons/crm/i18n/fi.po
index ee51240f4c7..d8d7144e92c 100644
--- a/addons/crm/i18n/fi.po
+++ b/addons/crm/i18n/fi.po
@@ -14,7 +14,11 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+<<<<<<< TREE
+"X-Launchpad-Export-Date: 2010-04-07 03:46+0000\n"
+=======
"X-Launchpad-Export-Date: 2010-04-17 04:01+0000\n"
+>>>>>>> MERGE-SOURCE
"X-Generator: Launchpad (build Unknown)\n"
#. module: crm
diff --git a/addons/crm/report/crm_claim_report.py b/addons/crm/report/crm_claim_report.py
index 03e439d889e..4148a834810 100644
--- a/addons/crm/report/crm_claim_report.py
+++ b/addons/crm/report/crm_claim_report.py
@@ -21,6 +21,7 @@
from osv import fields,osv
import tools
+import crm_report
class crm_claim_report(osv.osv):
@@ -32,7 +33,7 @@ class crm_claim_report(osv.osv):
_description = "CRM Claim Report"
_columns = {
- 'delay_close': fields.char('Delay to close', size=20, readonly=True),
+ 'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.claim')]", readonly=True),
@@ -41,6 +42,10 @@ class crm_claim_report(osv.osv):
('object_id.model', '=', 'crm.claim')]", readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ 'priority': fields.selection(crm_report.AVAILABLE_PRIORITIES, 'Priority'),
+ 'type_id': fields.many2one('crm.case.resource.type', 'Claim Type',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.claim')]"),
}
def init(self, cr):
@@ -56,6 +61,7 @@ class crm_claim_report(osv.osv):
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
+ to_char(c.create_date, 'YYYY-MM-DD') as day,
c.state,
c.user_id,
c.stage_id,
@@ -67,12 +73,16 @@ class crm_claim_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
- to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
+ c.priority as priority,
+ c.type_id as type_id,
+ date_trunc('day',c.create_date) as create_date,
+ avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
crm_claim c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), \
c.state, c.user_id,c.section_id, c.stage_id,\
- c.categ_id,c.partner_id,c.company_id
+ c.categ_id,c.partner_id,c.company_id,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
+ ,c.priority,c.type_id,c.som
)""")
crm_claim_report()
diff --git a/addons/crm/report/crm_claim_report_view.xml b/addons/crm/report/crm_claim_report_view.xml
index 4d544c97711..647a0125179 100644
--- a/addons/crm/report/crm_claim_report_view.xml
+++ b/addons/crm/report/crm_claim_report_view.xml
@@ -10,17 +10,20 @@
tree
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -66,12 +69,33 @@
search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -81,9 +105,9 @@
Claimscrm.claim.reportform
- tree,graph
+ tree,graph
+ {"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}
- {"search_default_section_id":section_id,"search_default_this_year":1,"search_default_this_month":1,"search_default_by_user":1}
diff --git a/addons/crm/report/crm_fundraising_report.py b/addons/crm/report/crm_fundraising_report.py
index d0ff60a4055..af867ea0008 100644
--- a/addons/crm/report/crm_fundraising_report.py
+++ b/addons/crm/report/crm_fundraising_report.py
@@ -35,10 +35,10 @@ class crm_fundraising_report(osv.osv):
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.fundraising')]"),
- 'probability': fields.float('Avg. Probability', readonly=True),
- 'amount_revenue': fields.float('Est.Revenue', readonly=True),
- 'amount_revenue_prob': fields.float('Est. Rev*Prob.', readonly=True),
- 'delay_close': fields.char('Delay to close', size=20, readonly=True),
+ 'probability': fields.float('Avg. Probability',digits=(16,2),readonly=True, group_operator="avg"),
+ 'amount_revenue': fields.float('Est.Revenue',readonly=True,digits=(16,2)),
+ 'amount_revenue_prob': fields.float('Est. Rev*Prob.',digits=(16,2),readonly=True),
+ 'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'partner_id': fields.many2one('res.partner', 'Partner'),
'company_id': fields.many2one('res.company', 'Company'),
}
@@ -56,6 +56,7 @@ class crm_fundraising_report(osv.osv):
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
+ to_char(c.create_date, 'YYYY-MM-DD') as day,
c.state,
c.user_id,
c.section_id,
@@ -66,14 +67,16 @@ class crm_fundraising_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
+ date_trunc('day',c.create_date) as create_date,
sum(planned_revenue) as amount_revenue,
sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob,
avg(probability)::decimal(16,2) as probability,
- to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
+ avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
crm_fundraising c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
- c.state, c.user_id,c.section_id,c.categ_id,c.partner_id,c.company_id
+ c.state, c.user_id,c.section_id,c.categ_id,c.partner_id,c.company_id,
+ c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
)""")
crm_fundraising_report()
diff --git a/addons/crm/report/crm_fundraising_report_view.xml b/addons/crm/report/crm_fundraising_report_view.xml
index c051ab8dcb8..e1c32726b4f 100644
--- a/addons/crm/report/crm_fundraising_report_view.xml
+++ b/addons/crm/report/crm_fundraising_report_view.xml
@@ -9,20 +9,21 @@
crm.fundraising.reporttree
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -67,8 +68,14 @@
search
-
-
+
+
+
+
+
+
+
+
@@ -79,8 +86,8 @@
crm.fundraising.reportformtree,graph
+ {"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}
- {"search_default_section_id":section_id,"search_default_this_year":1,"search_default_this_month":1,"search_default_by_user":1}
diff --git a/addons/crm/report/crm_helpdesk_report_view.xml b/addons/crm/report/crm_helpdesk_report_view.xml
index 0852d343c95..b10f51162e7 100644
--- a/addons/crm/report/crm_helpdesk_report_view.xml
+++ b/addons/crm/report/crm_helpdesk_report_view.xml
@@ -66,40 +66,40 @@
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+ domain="[]" context="{'group_by':'user_id'}"
+ default="1" />
formtree,graph
- {"search_default_section_id":section_id,"search_default_this_year":1,"search_default_this_month":1,"search_default_by_user":1}
diff --git a/addons/crm/report/crm_lead_report.py b/addons/crm/report/crm_lead_report.py
index 6c092f4f984..d400700c0b5 100644
--- a/addons/crm/report/crm_lead_report.py
+++ b/addons/crm/report/crm_lead_report.py
@@ -22,6 +22,14 @@
from osv import fields,osv
import tools
+AVAILABLE_STATES = [
+ ('draft','Draft'),
+ ('open','Open'),
+ ('cancel', 'Cancelled'),
+ ('done', 'Closed'),
+ ('pending','Pending')
+]
+
class crm_lead_report(osv.osv):
""" CRM Lead Report """
_name = "crm.lead.report"
@@ -30,7 +38,7 @@ class crm_lead_report(osv.osv):
_description = "CRM Lead Report"
_columns = {
- 'delay_close': fields.char('Delay to close', size=20, readonly=True),
+ 'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]" , readonly=True),
@@ -54,7 +62,8 @@ class crm_lead_report(osv.osv):
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
- c.state,
+ to_char(c.create_date, 'YYYY-MM-DD') as day,
+ c.state as state,
c.user_id,
c.stage_id,
c.company_id,
@@ -65,11 +74,13 @@ class crm_lead_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
- to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
+ date_trunc('day',c.create_date) as create_date,
+ avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
crm_lead c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
c.state, c.user_id,c.section_id,c.stage_id,categ_id,c.partner_id,c.company_id
+ ,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
)""")
crm_lead_report()
diff --git a/addons/crm/report/crm_lead_report_view.xml b/addons/crm/report/crm_lead_report_view.xml
index 30c1ab2135c..d6502c190d9 100644
--- a/addons/crm/report/crm_lead_report_view.xml
+++ b/addons/crm/report/crm_lead_report_view.xml
@@ -10,14 +10,15 @@
tree
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -63,12 +64,21 @@
search
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -78,8 +88,8 @@
Leadscrm.lead.reportform
+ {"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}tree,graph
- {"search_default_section_id":section_id,"search_default_this_year":1,"search_default_this_month":1,"search_default_by_user":1}
diff --git a/addons/crm/report/crm_opportunity_report.py b/addons/crm/report/crm_opportunity_report.py
index 36dec45ddf7..a3af4be8b7c 100644
--- a/addons/crm/report/crm_opportunity_report.py
+++ b/addons/crm/report/crm_opportunity_report.py
@@ -22,6 +22,14 @@
from osv import fields,osv
import tools
+AVAILABLE_STATES = [
+ ('draft','Draft'),
+ ('open','Open'),
+ ('cancel', 'Cancelled'),
+ ('done', 'Closed'),
+ ('pending','Pending')
+]
+
class crm_opportunity_report(osv.osv):
""" CRM Opportunity Report """
_name = "crm.opportunity.report"
@@ -29,11 +37,10 @@ class crm_opportunity_report(osv.osv):
_inherit = "crm.case.report"
_description = "CRM Opportunity Report"
_columns = {
- 'probability': fields.float('Avg. Probability', readonly=True, group_operator="avg"),
+ 'probability': fields.float('Avg. Probability', readonly=True,group_operator='avg'),
'amount_revenue': fields.float('Est.Revenue', readonly=True),
'amount_revenue_prob': fields.float('Est. Rev*Prob.', readonly=True),
- 'delay_close': fields.float('Days to Close', digits=(16,2), readonly=True, group_operator="avg",
- help="Number of Days to close the opportunities"),
+ 'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.opportunity')]", readonly=True),
@@ -57,7 +64,8 @@ class crm_opportunity_report(osv.osv):
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
- c.state,
+ to_char(c.create_date, 'YYYY-MM-DD') as day,
+ c.state as state,
c.user_id,
c.section_id,
c.categ_id,
@@ -68,21 +76,25 @@ class crm_opportunity_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
+ date_trunc('day',c.create_date) as create_date,
sum(planned_revenue) as amount_revenue,
sum((planned_revenue*probability)/100.0)::decimal(16,2) as amount_revenue_prob,
avg(probability)::decimal(16,2) as probability,
- avg(extract('epoch' from (date_closed-c.create_date)))/(3600*24) as delay_close
+ avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
crm_opportunity c
group by
to_char(c.create_date, 'YYYY'),
to_char(c.create_date, 'MM'),
+ to_char(c.create_date, 'YYYY-MM-DD'),
c.state,
c.user_id,
c.section_id,
c.stage_id,
c.categ_id,
- c.partner_id,company_id
+ c.partner_id,
+ company_id,
+ create_date
)""")
crm_opportunity_report()
diff --git a/addons/crm/report/crm_opportunity_report_view.xml b/addons/crm/report/crm_opportunity_report_view.xml
index 58768ebceef..29a66b838f0 100644
--- a/addons/crm/report/crm_opportunity_report_view.xml
+++ b/addons/crm/report/crm_opportunity_report_view.xml
@@ -9,21 +9,22 @@
crm.opportunity.reporttree
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
@@ -69,15 +70,24 @@
search
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -88,7 +98,7 @@
crm.opportunity.reportformtree,graph
- {"search_default_section_id":section_id,"search_default_this_year":1,"search_default_this_month":1,"search_default_by_user":1, "group_by": [], 'group_by_no_leaf': 1}
+ {"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}
diff --git a/addons/crm/report/crm_phonecall_report.py b/addons/crm/report/crm_phonecall_report.py
index a72bfbd9c1f..40b34779aba 100644
--- a/addons/crm/report/crm_phonecall_report.py
+++ b/addons/crm/report/crm_phonecall_report.py
@@ -31,7 +31,7 @@ class crm_phonecall_report(osv.osv):
_inherit = "crm.case.report"
_columns = {
- 'delay_close': fields.char('Delay to close', size=20, readonly=True),
+ 'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.phonecall')]"),
@@ -52,6 +52,7 @@ class crm_phonecall_report(osv.osv):
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
+ to_char(c.create_date, 'YYYY-MM-DD') as day,
c.state,
c.user_id,
c.section_id,
@@ -62,11 +63,13 @@ class crm_phonecall_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
- to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
+ date_trunc('day',c.create_date) as create_date,
+ avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
crm_phonecall c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
c.state, c.user_id,c.section_id, c.categ_id,c.partner_id,c.company_id
+ ,to_char(c.create_date, 'YYYY-MM-DD'),c.create_date
)""")
crm_phonecall_report()
diff --git a/addons/crm/report/crm_phonecall_report_view.xml b/addons/crm/report/crm_phonecall_report_view.xml
index e937ef6bd22..698a9b88fa3 100644
--- a/addons/crm/report/crm_phonecall_report_view.xml
+++ b/addons/crm/report/crm_phonecall_report_view.xml
@@ -10,17 +10,18 @@
tree
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
@@ -64,8 +65,14 @@
search
-
-
+
+
+
+
+
+
+
+
@@ -76,8 +83,8 @@
crm.phonecall.reportformtree,graph
+ {"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}
- {"search_default_section_id":section_id,"search_default_this_year":1,"search_default_this_month":1,"search_default_by_user":1}
diff --git a/addons/crm/report/crm_report.py b/addons/crm/report/crm_report.py
index 82f3a049de4..f2b3a48d339 100644
--- a/addons/crm/report/crm_report.py
+++ b/addons/crm/report/crm_report.py
@@ -29,6 +29,13 @@ AVAILABLE_STATES = [
('done', 'Closed'),
('pending','Pending')
]
+AVAILABLE_PRIORITIES = [
+ ('5', 'Lowest'),
+ ('4', 'Low'),
+ ('3', 'Normal'),
+ ('2', 'High'),
+ ('1', 'Highest')
+]
class crm_case_report(osv.osv):
""" Cases and section """
@@ -89,6 +96,8 @@ class crm_case_report(osv.osv):
('09', 'September'), ('10', 'October'),\
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ 'create_date': fields.datetime('Create Date', readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True)
}
_order = 'name desc, user_id'
@@ -104,15 +113,18 @@ class crm_case_report(osv.osv):
min(c.id) as id,
to_char(c.create_date, 'YYYY') as name,
to_char(c.create_date, 'MM') as month,
+ to_char(c.create_date, 'YYYY-MM-DD') as day,
c.state,
c.user_id,
c.section_id,
c.company_id,
- count(*) as nbr
+ count(*) as nbr,
+ c.create_date as create_date
from
crm_case c
- group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
+ group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),
c.state, c.user_id,c.section_id,c.company_id
+ ,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
)""")
crm_case_report()
@@ -124,7 +136,6 @@ class report_crm_case_service_dashboard(osv.osv):
_name = "report.crm.case.service.dashboard"
_description = "Report of Closed and Open CRM Cases within past 15 days"
_auto = False
-
_columns = {
'date_deadline': fields.datetime('Deadline', readonly=True),
'name': fields.char('Description', size=64, readonly=True),
@@ -143,7 +154,7 @@ class report_crm_case_service_dashboard(osv.osv):
select
cse.id as id, cse.date_deadline as date_deadline,
cse.name as name, cse.user_id as user_id,
- cse.state as state,
+ cse.state as state,
cse.create_date as create_date
from
crm_case cse
diff --git a/addons/crm/report/crm_report_view.xml b/addons/crm/report/crm_report_view.xml
index 3cd8b518b5d..97fa4feb6f1 100644
--- a/addons/crm/report/crm_report_view.xml
+++ b/addons/crm/report/crm_report_view.xml
@@ -63,26 +63,33 @@
+
+ domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
-
+
+
+
+
-
-
-
-
-
+
+
+
@@ -100,14 +107,23 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
@@ -145,7 +164,6 @@
crm.case.reportformtree,graph
- {"search_default_section_id":section_id,"search_default_this_year":1,"search_default_this_month":1}
diff --git a/addons/crm/wizard/crm_send_email.py b/addons/crm/wizard/crm_send_email.py
index 7054c77cb90..a0f91fb2ae5 100644
--- a/addons/crm/wizard/crm_send_email.py
+++ b/addons/crm/wizard/crm_send_email.py
@@ -165,7 +165,7 @@ class crm_send_new_email(osv.osv_memory):
if 'email_cc' in fields:
res.update({'email_cc': case.email_cc or ''})
if 'text' in fields:
- res.update({'text': '\n\n'+(case.user_id.signature or '')})
+ res.update({'text': '\n\n'+(case.user_id.signature or '') + '\n\n' + (case.description or '')})
if 'state' in fields:
res.update({'state': 'pending'})
return res
diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py
index 7e7d31975e5..35b3ed481e9 100644
--- a/addons/delivery/delivery.py
+++ b/addons/delivery/delivery.py
@@ -28,6 +28,17 @@ class delivery_carrier(osv.osv):
_name = "delivery.carrier"
_description = "Carrier and delivery grids"
+ def name_get(self, cr, uid, ids, context={}):
+ if not len(ids):
+ return []
+ order_id = context.get('order_id',False)
+ if not order_id:
+ res = super(delivery_carrier, self).name_get(cr, uid, ids, context=context)
+ else:
+ order = self.pool.get('sale.order').browse(cr, uid, [order_id])[0]
+ currency = order.pricelist_id.currency_id.name or ''
+ res = [(r['id'], r['name']+' ('+(str(r['price']))+' '+currency+')') for r in self.read(cr, uid, ids, ['name', 'price'], context)]
+ return res
def get_price(self, cr, uid, ids, field_name, arg=None, context={}):
res={}
sale_obj=self.pool.get('sale.order')
@@ -94,9 +105,7 @@ class delivery_grid(osv.osv):
}
_order = 'sequence'
-
def get_price(self, cr, uid, id, order, dt, context):
-
total = 0
weight = 0
volume = 0
@@ -112,7 +121,6 @@ class delivery_grid(osv.osv):
def get_price_from_picking(self, cr, uid, id, total, weight, volume, context={}):
grid = self.browse(cr, uid, id, context)
-
price = 0.0
ok = False
diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml
index 16f4a61ed1e..f14d45c79de 100644
--- a/addons/delivery/delivery_view.xml
+++ b/addons/delivery/delivery_view.xml
@@ -289,5 +289,16 @@
+
+ sale.order.multicompany
+ sale.order
+
+
+
+
+
+
+
+
diff --git a/addons/delivery/wizard/delivery_sale_order.py b/addons/delivery/wizard/delivery_sale_order.py
index efc82ae4141..5f066b23bb0 100644
--- a/addons/delivery/wizard/delivery_sale_order.py
+++ b/addons/delivery/wizard/delivery_sale_order.py
@@ -50,7 +50,11 @@ class make_delivery(osv.osv_memory):
res = super(make_delivery, self).default_get(cr, uid, fields, context=context)
order_obj = self.pool.get('sale.order')
for order in order_obj.browse(cr, uid, context.get('active_ids', [])):
- res.update({'carrier_id': order.partner_id.property_delivery_carrier.id})
+ carrier = order.carrier_id.id
+ if not carrier:
+ carrier = order.partner_id.property_delivery_carrier.id
+ res.update({'carrier_id': carrier})
+
return res
def view_init(self, cr , uid , fields, context=None):
diff --git a/addons/delivery/wizard/delivery_sale_order_view.xml b/addons/delivery/wizard/delivery_sale_order_view.xml
index c2609bc3923..6ac0883493f 100644
--- a/addons/delivery/wizard/delivery_sale_order_view.xml
+++ b/addons/delivery/wizard/delivery_sale_order_view.xml
@@ -11,26 +11,28 @@
-
+
+
-
+ string="_Cancel" />
+
+
+
+ Delivery Costs
+ ir.actions.act_window
+ delivery.sale.order
+ form
+ form
+
+ new
+
-
-
-
diff --git a/addons/document_email/document_email.py b/addons/document_email/document_email.py
index a4406f7a4d5..e4e94fa6c1f 100644
--- a/addons/document_email/document_email.py
+++ b/addons/document_email/document_email.py
@@ -79,7 +79,7 @@ class email_to_document(osv.osv):
if file_ext[1] not in ext:
logger.notifyChannel('document', netsvc.LOG_WARNING, 'file type %s is not allows to process for directory %s' % (file_ext[1], dr.directory_id.name))
continue
-
+
data_attach = {
'name': attactment,
'datas':binascii.b2a_base64(str(attachents.get(attactment))),
diff --git a/addons/document_email/document_email.xml b/addons/document_email/document_email.xml
index 9dd550acd7c..bfcde49816a 100644
--- a/addons/document_email/document_email.xml
+++ b/addons/document_email/document_email.xml
@@ -93,11 +93,11 @@
[]
-
+
+
+
+
+
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py
index feb88b57136..611b7c178fb 100644
--- a/addons/fetchmail/fetchmail.py
+++ b/addons/fetchmail/fetchmail.py
@@ -320,12 +320,22 @@ class email_server(osv.osv):
return res_id
+ def __fetch_mail(self, cr, uid, ids, context={}):
+ sendmail_thread = threading.Thread(target=self.fetch_mail, args=(cr, uid, ids))
+ sendmail_thread.start()
+ return True
+
def _fetch_mails(self, cr, uid, ids=False, context={}):
if not ids:
ids = self.search(cr, uid, [])
return self.fetch_mail(cr, uid, ids, context)
def fetch_mail(self, cr, uid, ids, context={}):
+
+ fp = os.popen('ping www.google.com -c 1 -w 5',"r")
+ if not fp.read():
+ logger.notifyChannel('imap', netsvc.LOG_WARNING, 'lost internet connection !')
+
for server in self.browse(cr, uid, ids, context):
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name))
@@ -356,7 +366,7 @@ class email_server(osv.osv):
pop_server = POP3_SSL(server.server, int(server.port))
else:
pop_server = POP3(server.server, int(server.port))
-
+
#TODO: use this to remove only unread messages
#pop_server.user("recent:"+server.user)
pop_server.user(server.user)
@@ -373,9 +383,10 @@ class email_server(osv.osv):
pop_server.quit()
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch %s email(s) from %s' % (numMsgs, server.name))
-
+
+ self.write(cr, uid, [server.id], {'state':'done'})
except Exception, e:
- logger.notifyChannel('IMAP', netsvc.LOG_WARNING, '%s' % (e))
+ logger.notifyChannel(server.type, netsvc.LOG_WARNING, '%s' % (e))
return True
diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml
index 80d0b60a74f..a3a8534b559 100644
--- a/addons/fetchmail/fetchmail_view.xml
+++ b/addons/fetchmail/fetchmail_view.xml
@@ -58,8 +58,7 @@
-
-
+
diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml
index 5125052c499..5e04cf1aaad 100644
--- a/addons/hr/hr_view.xml
+++ b/addons/hr/hr_view.xml
@@ -314,7 +314,7 @@
-
+
diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
index 1d0be1f288e..a1d89f67b28 100644
--- a/addons/hr_evaluation/hr_evaluation.py
+++ b/addons/hr_evaluation/hr_evaluation.py
@@ -318,8 +318,7 @@ class hr_evaluation_interview(osv.osv):
record = record and record[0]
context.update({'survey_id': record.survey_id.id, 'response_id' : [record.response.id], 'response_no':0,})
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context)
- return value
-
+ return value
hr_evaluation_interview()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1
diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml
index bf6e45376e7..cff66266686 100644
--- a/addons/hr_evaluation/hr_evaluation_view.xml
+++ b/addons/hr_evaluation/hr_evaluation_view.xml
@@ -202,14 +202,24 @@
-
+
+ hr_evaluation.evaluation.graph
+ hr_evaluation.evaluation
+ graph
+
+
+
+
+
+
+ hr_evaluation.evaluation_searchhr_evaluation.evaluationsearch
-
+
@@ -242,7 +252,7 @@
hr_evaluation.evaluationform
- tree,form
+ tree,form,graph
@@ -297,8 +307,8 @@
-
+
diff --git a/addons/hr_evaluation/report/hr_evaluation_report.py b/addons/hr_evaluation/report/hr_evaluation_report.py
index 3b318905bbe..504bdcd08f4 100644
--- a/addons/hr_evaluation/report/hr_evaluation_report.py
+++ b/addons/hr_evaluation/report/hr_evaluation_report.py
@@ -27,14 +27,24 @@ class hr_evaluation_report(osv.osv):
_auto = False
_rec_name = 'date'
_columns = {
- 'create_date': fields.datetime('Create Date', readonly=True),
+ 'create_date': fields.date('Create Date', readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
'deadline': fields.date("Deadline", readonly=True),
+ 'request_id': fields.many2one('survey.request','Request_id', readonly=True),
'closed': fields.date("closed", readonly=True),
'year': fields.char('Year', size=4, 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),
+ 'plan_id': fields.many2one('hr_evaluation.plan', 'Plan', readonly=True),
'employee_id': fields.many2one('hr.employee', "Employee", readonly=True),
+ 'rating': fields.selection([
+ ('0','Significantly bellow expectations'),
+ ('1','Did not meet expectations'),
+ ('2','Meet expectations'),
+ ('3','Exceeds expectations'),
+ ('4','Significantly exceeds expectations'),
+ ], "Overall Rating", readonly=True),
'nbr':fields.integer('# of Requests', readonly=True),
'state': fields.selection([
('draft','Draft'),
@@ -51,21 +61,35 @@ class hr_evaluation_report(osv.osv):
create or replace view hr_evaluation_report as (
select
min(l.id) as id,
- s.create_date as create_date,
+ date_trunc('day',s.create_date) as create_date,
+ to_char(s.create_date, 'YYYY-MM-DD') as day,
s.employee_id,
+ l.request_id,
+ s.plan_id,
+ s.rating,
s.date as deadline,
s.date_close as closed,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
- count(*) as nbr,
+ count(l.*) as nbr,
s.state
from
hr_evaluation_interview l
left join
hr_evaluation_evaluation s on (s.id=l.evaluation_id)
group by
- s.create_date,s.state,s.employee_id,
- s.date,s.date_close
+ s.create_date,
+ date_trunc('day',s.create_date),
+ to_char(s.create_date, 'YYYY-MM-DD'),
+ to_char(s.create_date, 'YYYY'),
+ to_char(s.create_date, 'MM'),
+ s.state,
+ s.employee_id,
+ s.date,
+ s.date_close,
+ l.request_id,
+ s.rating,
+ s.plan_id
)
""")
hr_evaluation_report()
diff --git a/addons/hr_evaluation/report/hr_evaluation_report_view.xml b/addons/hr_evaluation/report/hr_evaluation_report_view.xml
index 2048c8337db..0417fb0ffd2 100644
--- a/addons/hr_evaluation/report/hr_evaluation_report_view.xml
+++ b/addons/hr_evaluation/report/hr_evaluation_report_view.xml
@@ -7,49 +7,95 @@
tree
-
-
-
+
+
+
+
+
+
-
+
+
+ hr.evaluation.report.graph
+ hr.evaluation.report
+ graph
+
+
+
+
+
+
+
+
+
hr.evaluation.report.searchhr.evaluation.reportsearch
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
@@ -61,7 +107,8 @@
Evaluationshr.evaluation.reportform
- tree
+ tree,graph
+ {'search_default_month':1,'search_default_employee':1,'group_by_no_leaf':1,'group_by':[]}
diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml
index b8f3c1928ed..292cbf6f027 100644
--- a/addons/hr_expense/hr_expense_view.xml
+++ b/addons/hr_expense/hr_expense_view.xml
@@ -66,6 +66,7 @@
+
@@ -147,10 +148,11 @@
-
@@ -171,7 +173,6 @@
Expenseshr.expense.expenseform
- {"search_default_my_expns":1}
diff --git a/addons/hr_expense/report/hr_expense_report.py b/addons/hr_expense/report/hr_expense_report.py
index 81cb18dcc09..cc3f282e9fa 100644
--- a/addons/hr_expense/report/hr_expense_report.py
+++ b/addons/hr_expense/report/hr_expense_report.py
@@ -31,12 +31,16 @@ class hr_expense_report(osv.osv):
_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),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
+ 'journal_id': fields.many2one('account.journal', 'Force Journal', readonly=True),
'product_qty':fields.float('Qty', readonly=True),
'employee_id': fields.many2one('hr.employee', "Employee's Name", readonly=True),
+ 'date_confirm': fields.date('Confirmation Date', readonly=True),
+ 'date_valid': fields.date('Validation Date', readonly=True),
'invoice_id': fields.many2one('account.invoice', 'Invoice',readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
@@ -60,12 +64,16 @@ class hr_expense_report(osv.osv):
create or replace view hr_expense_report as (
select
min(l.id) as id,
- s.date as date,
+ date_trunc('day',s.create_date) as date,
s.employee_id,
+ s.journal_id,
+ to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_confirm,
+ to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_valid,
s.invoice_id,
s.department_id,
- to_char(s.date, 'YYYY') as year,
- to_char(s.date, 'MM') as month,
+ to_char(date_trunc('day',s.create_date), 'YYYY') as year,
+ to_char(date_trunc('day',s.create_date), 'MM') as month,
+ to_char(date_trunc('day',s.create_date), 'YYYY-MM-DD') as day,
l.product_id as product_id,
sum(l.unit_quantity * u.factor) as product_qty,
s.user_id as user_id,
@@ -80,10 +88,19 @@ class hr_expense_report(osv.osv):
hr_expense_expense s on (s.id=l.expense_id)
left join product_uom u on (u.id=l.uom_id)
group by
- s.date, l.product_id,s.invoice_id,
+ date_trunc('day',s.create_date),
+ to_char(date_trunc('day',s.create_date), 'YYYY-MM-DD'),
+ to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY'),
+ to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY'),
+ l.product_id,
+ s.invoice_id,
s.department_id,
- l.uom_id, s.user_id, s.state,
- s.company_id,s.employee_id
+ l.uom_id,
+ s.user_id,
+ s.state,
+ s.journal_id,
+ s.company_id,
+ s.employee_id
)
""")
hr_expense_report()
diff --git a/addons/hr_expense/report/hr_expense_report_view.xml b/addons/hr_expense/report/hr_expense_report_view.xml
index 2f9a0afb29c..972557edd0c 100644
--- a/addons/hr_expense/report/hr_expense_report_view.xml
+++ b/addons/hr_expense/report/hr_expense_report_view.xml
@@ -7,16 +7,18 @@
tree
-
-
-
+
+
+
+
-
-
+
+
+
@@ -31,8 +33,9 @@
graph
-
-
+
+
+
@@ -43,41 +46,81 @@
search
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
+
+
+
+
@@ -90,7 +133,7 @@
hr.expense.reportformtree,graph
- {"search_default_expenses":1,"search_default_by_user":1}
+ {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
diff --git a/addons/hr_holidays/__openerp__.py b/addons/hr_holidays/__openerp__.py
index f5a57313348..83ce130e360 100644
--- a/addons/hr_holidays/__openerp__.py
+++ b/addons/hr_holidays/__openerp__.py
@@ -55,6 +55,8 @@
'hr_holidays_view.xml',
'hr_holidays_wizard.xml',
'hr_holidays_report.xml',
+ 'report/hr_holidays_report_view.xml',
+ 'report/available_holidays_view.xml',
'wizard/hr_holidays_summary_department_view.xml',
'wizard/hr_holidays_summary_employees_view.xml',
#'process/hr_holidays_process.xml'
diff --git a/addons/hr_holidays/hr_holidays_report.xml b/addons/hr_holidays/hr_holidays_report.xml
index 165b54c72f0..23d1e1a75bf 100644
--- a/addons/hr_holidays/hr_holidays_report.xml
+++ b/addons/hr_holidays/hr_holidays_report.xml
@@ -1,23 +1,14 @@
-
-
+
+
-
-
-
-
+
diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml
index 92e4acd7f63..d5e0602e5bb 100644
--- a/addons/hr_holidays/hr_holidays_view.xml
+++ b/addons/hr_holidays/hr_holidays_view.xml
@@ -10,8 +10,9 @@
-
-
+
+
-
-
+
+
-
+
diff --git a/addons/hr_holidays/report/__init__.py b/addons/hr_holidays/report/__init__.py
index 00783721fe3..a617b4b6d8a 100644
--- a/addons/hr_holidays/report/__init__.py
+++ b/addons/hr_holidays/report/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,11 +15,12 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
import holidays_summary_report
import available_holidays
+import hr_holidays_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_holidays/report/available_holidays.py b/addons/hr_holidays/report/available_holidays.py
index e69de29bb2d..4a1972f1f7d 100644
--- a/addons/hr_holidays/report/available_holidays.py
+++ b/addons/hr_holidays/report/available_holidays.py
@@ -0,0 +1,76 @@
+# -*- 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 .
+#
+##############################################################################
+from osv import fields,osv
+import tools
+
+class available_holidays_report(osv.osv):
+ _name = "available.holidays.report"
+ _auto = False
+ _columns = {
+ 'date': fields.datetime('Date', readonly=True),
+ 'year': fields.char('Year', size=4, 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),
+ 'employee_id': fields.many2one ('hr.employee', 'Employee', readonly=True),
+ 'holiday_status_id': fields.many2one('hr.holidays.status', 'Leave Type', readonly=True),
+ 'max_leave': fields.float('Allocated Leaves', readonly=True),
+ 'taken_leaves': fields.float('Taken Leaves', readonly=True),
+ 'remaining_leave': fields.float('Remaining Leaves',readonly=True),
+ 'user_id':fields.many2one('res.users', 'User', readonly=True),
+ }
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'available_holidays_report')
+ cr.execute("""
+ create or replace view available_holidays_report as (
+ select
+ min(h.id) as id,
+ date_trunc('day',h.create_date) as date,
+ to_char(s.create_date, 'YYYY') as year,
+ to_char(s.create_date, 'MM') as month,
+ h.employee_id as employee_id,
+ h.user_id as user_id,
+ h.state as state,
+ h.holiday_status_id as holiday_status_id,
+ sum(number_of_days) as remaining_leave,
+ (select sum(number_of_days_temp) from hr_holidays
+ where type='remove'
+ and employee_id=h.employee_id
+ and holiday_status_id=h.holiday_status_id
+ and state='validate') as taken_leaves,
+ (select sum(number_of_days_temp) from hr_holidays
+ where type='add'
+ and employee_id=h.employee_id
+ and holiday_status_id=h.holiday_status_id
+ and state='validate') as max_leave
+ from hr_holidays h
+ left join hr_holidays_status s on (s.id = h.holiday_status_id)
+ where h.state='validate'
+ and h.employee_id is not null
+ and s.active <> 'f'
+ group by h.holiday_status_id, h.employee_id,
+ date_trunc('day',h.create_date),to_char(s.create_date, 'YYYY'),
+ to_char(s.create_date, 'MM'),h.user_id,h.state
+
+ )""")
+available_holidays_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_holidays/report/available_holidays_view.xml b/addons/hr_holidays/report/available_holidays_view.xml
new file mode 100644
index 00000000000..18ea7d58d45
--- /dev/null
+++ b/addons/hr_holidays/report/available_holidays_view.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+ available.holidays.report.tree
+ available.holidays.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ available.holidays.report.form
+ available.holidays.report
+ form
+
+
+
+
+
+
+
+
+
+ available.holidays.report.graph
+ available.holidays.report
+ graph
+
+
+
+
+
+
+
+
+
+
+ available.holidays.report.search
+ available.holidays.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Available Holidays
+ available.holidays.report
+ form
+ tree,graph
+
+
+
+
+
+
+ tree
+
+
+
+
+
+
+
+ graph
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_holidays/report/hr_holidays_report.py b/addons/hr_holidays/report/hr_holidays_report.py
index 59a0a361eeb..435eee71ea5 100644
--- a/addons/hr_holidays/report/hr_holidays_report.py
+++ b/addons/hr_holidays/report/hr_holidays_report.py
@@ -63,6 +63,7 @@ class hr_holidays_report(osv.osv):
s.state
from
hr_holidays s
+ where type='remove'
group by
s.create_date,s.state,s.date_from,s.date_to,
s.number_of_days_temp,s.employee_id,s.user_id
@@ -70,3 +71,37 @@ class hr_holidays_report(osv.osv):
""")
hr_holidays_report()
+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('Employee',size=64),
+ 'no_of_leaves': fields.integer('Remaining leaves'),
+ 'user_id': fields.many2one('res.users','User'),
+ 'leave_type': fields.char('Leave Type',size=64),
+
+ }
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'hr_holidays_remaining_leaves_user')
+ cr.execute("""
+ create or replace view hr_holidays_remaining_leaves_user as (
+ select
+ min(hrs.id) as id,
+ rr.name as name,
+ sum(hrs.number_of_days) as no_of_leaves,
+ rr.user_id as user_id,
+ hhs.name as leave_type
+ from
+ hr_holidays as hrs, hr_employee as hre,
+ resource_resource as rr,hr_holidays_status as hhs
+ where
+ hrs.employee_id = hre.id and
+ hre.resource_id = rr.id and
+ hhs.id = hrs.holiday_status_id
+ group by
+ rr.name,rr.user_id,hhs.name
+ )
+ """)
+
+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 66094e70f5c..e9e0e6aae36 100644
--- a/addons/hr_holidays/report/hr_holidays_report_view.xml
+++ b/addons/hr_holidays/report/hr_holidays_report_view.xml
@@ -9,7 +9,6 @@
-
@@ -47,6 +46,20 @@
domain="[('month','=',time.strftime('%%m'))]"
help="Leaves of this month"/>
+
+
+
+
+
+
-
+
@@ -72,10 +85,36 @@
hr.holidays.reportformtree,graph
+ {'search_default_employee': 1}
-
+
-
+
+ hr.holidays.remaining.leaves.user.tree
+ hr.holidays.remaining.leaves.user
+ tree
+
+
+
+
+
+
+
+
+
+
+ hr.holidays.remaining.leaves.user.graph
+ hr.holidays.remaining.leaves.user
+ graph
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_holidays/security/ir.model.access.csv b/addons/hr_holidays/security/ir.model.access.csv
index a7426724594..d928a8dcb9b 100644
--- a/addons/hr_holidays/security/ir.model.access.csv
+++ b/addons/hr_holidays/security/ir.model.access.csv
@@ -3,3 +3,9 @@
"access_hr_holidays_user","hr holidays user","model_hr_holidays","hr.group_hr_user",1,1,1,0
"access_hr_holydays_status_manager","hr.holidays.status manager","model_hr_holidays_status","hr.group_hr_manager",1,1,1,1
"access_hr_holidays_manager","hr holidays manager","model_hr_holidays","hr.group_hr_manager",1,1,1,1
+"access_hr_holidays_remain","hr holidays user","model_hr_holidays_remaining_leaves_user","hr.group_hr_user",1,0,0,0
+"access_hr_holidays_report","hr.holidays.report","model_hr_holidays_report","hr.group_hr_manager",1,1,1,1
+"access_hr_holidays_remaining_leaves_user","hr.hr.holidays.remaining.leaves.user","model_hr_holidays_remaining_leaves_user","hr.group_hr_manager",1,1,1,1
+"access_available_holidays_report","hr.available.holidays.report","model_available_holidays_report","hr.group_hr_manager",1,1,1,1
+"access_hr_holidays_report_user","hr.holidays.report","model_hr_holidays_report","hr.group_hr_user",1,0,0,0
+"access_available_holidays_report_user","hr.available.holidays.report","model_available_holidays_report","hr.group_hr_user",1,0,0,0
diff --git a/addons/hr_recruitment/__openerp__.py b/addons/hr_recruitment/__openerp__.py
index a19ef25515b..14557c33c42 100644
--- a/addons/hr_recruitment/__openerp__.py
+++ b/addons/hr_recruitment/__openerp__.py
@@ -39,14 +39,15 @@ system to store and search in your CV base.
'hr_recruitment_data.xml'
],
'update_xml': [
- 'hr_recruitment_wizard.xml',
+ 'wizard/hr_recruitment_phonecall_view.xml',
'hr_recruitment_view.xml',
'hr_recruitment_menu.xml',
# 'report_hr_recruitment_view.xml',
'security/hr_recruitment_security.xml',
'security/ir.model.access.csv',
'board_hr_recruitment_statistical_view.xml',
- 'report/hr_recruitment_report_view.xml'
+ 'report/hr_recruitment_report_view.xml',
+ 'wizard/hr_recruitment_create_partner_job_view.xml',
],
'demo_xml': [
'hr_recruitment_demo.xml'
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 6fe8b91aa3e..eb0d1ae1334 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -20,7 +20,6 @@
##############################################################################
from osv import fields,osv,orm
-from tools.translate import _
AVAILABLE_STATES = [
('draft','New'),
@@ -55,8 +54,8 @@ class hr_applicant(osv.osv):
'partner_name': fields.char("Applicant's Name", size=64),
'partner_phone': fields.char('Phone', size=32),
'partner_mobile': fields.char('Mobile', size=32),
- 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('object_id.model', '=', 'hr.applicant')]"),
- 'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('object_id.model', '=', 'hr.applicant')]"),
+ 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
+ 'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
'department_id':fields.many2one('hr.department','Department'),
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
@@ -65,7 +64,7 @@ class hr_applicant(osv.osv):
def stage_previous(self, cr, uid, ids, context=None):
"""This function computes previous stage for case from its current stage
- using available stage for that case type
+ using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -83,7 +82,7 @@ class hr_applicant(osv.osv):
def stage_next(self, cr, uid, ids, context=None):
"""This function computes next stage for case from its current stage
- using available stage for that case type
+ using available stage for that case type
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -168,7 +167,6 @@ class hr_applicant(osv.osv):
context.update({'survey_id': record.survey.id, 'response_id' : [record.response], 'response_no':0,})
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context)
return value
-
hr_applicant()
class hr_job(osv.osv):
diff --git a/addons/hr_recruitment/hr_recruitment_menu.xml b/addons/hr_recruitment/hr_recruitment_menu.xml
index bbf32cf0501..ba3278b3c66 100644
--- a/addons/hr_recruitment/hr_recruitment_menu.xml
+++ b/addons/hr_recruitment/hr_recruitment_menu.xml
@@ -9,7 +9,6 @@
hr.applicanttree,form,graph
- {"search_default_current":1,"search_default_my_recrui":1}
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 2367603502c..beb9467814c 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -43,8 +43,8 @@
-
-
+
+
@@ -71,16 +71,16 @@
-
+
+ name="%(action_hr_recruitment_phonecall)d" icon="gtk-redo" type="action"/>
+ icon="gtk-execute" context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant', 'cur_id' :active_id}" attrs="{'readonly':[('survey','=',False)]}"/>
@@ -160,10 +160,10 @@
+ string="Reply to Last Email"
+ name="%(crm.action_crm_send_mail)d"
+ context="{'mail':'reply', 'model': 'hr.applicant'}"
+ icon="gtk-undo" type="action" />
@@ -172,9 +172,9 @@
+ name="%(crm.action_crm_send_mail)d"
+ context="{'mail':'new', 'model': 'hr.applicant'}"
+ icon="gtk-go-forward" type="action" />
@@ -201,10 +201,10 @@
search
-
-
-
-
+
@@ -232,9 +231,8 @@
domain="[('department_id','=',context.get('department_id',False))]"
help="My Department"/>
-
-
+
diff --git a/addons/hr_recruitment/hr_recruitment_wizard.xml b/addons/hr_recruitment/hr_recruitment_wizard.xml
index b2ef149d604..d82153eabbb 100644
--- a/addons/hr_recruitment/hr_recruitment_wizard.xml
+++ b/addons/hr_recruitment/hr_recruitment_wizard.xml
@@ -9,6 +9,14 @@
multi="True"
string="Schedule Phone Call" />
+
+
tree
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -39,57 +44,88 @@
search
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -100,7 +136,7 @@
hr.recruitment.reportformtree,graph
- {"search_default_user_id":1,"search_default_by_user":1}
+ {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
diff --git a/addons/hr_recruitment/wizard/__init__.py b/addons/hr_recruitment/wizard/__init__.py
index 48e225c5a54..c946ed7264f 100644
--- a/addons/hr_recruitment/wizard/__init__.py
+++ b/addons/hr_recruitment/wizard/__init__.py
@@ -20,10 +20,8 @@
##############################################################################
-import hr_recruitment_wizard
-
-
-
+import hr_recruitment_phonecall
+import hr_recruitment_create_partner_job
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_recruitment/wizard/hr_recruitment_create_partner_job.py b/addons/hr_recruitment/wizard/hr_recruitment_create_partner_job.py
new file mode 100644
index 00000000000..4627751f731
--- /dev/null
+++ b/addons/hr_recruitment/wizard/hr_recruitment_create_partner_job.py
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import osv, fields
+from tools.translate import _
+
+class hr_recruitment_partner_create(osv.osv_memory):
+ _name = 'hr.recruitment.partner.create'
+ _description = 'Create Partner from job application'
+ _columns = {
+ 'close': fields.boolean('Close job request'),
+ }
+
+ def view_init(self, cr , uid , fields_list, context=None):
+ case_obj = self.pool.get('hr.applicant')
+ for case in case_obj.browse(cr, uid, context['active_ids']):
+ if case.partner_id:
+ raise osv.except_osv(_('Warning !'),
+ _('A partner is already defined on this job request.'))
+ pass
+
+ def make_order(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ partner_obj = self.pool.get('res.partner')
+ contact_obj = self.pool.get('res.partner.address')
+ case_obj = self.pool.get('hr.applicant')
+
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids, [], context)[0]
+ result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
+ res = mod_obj.read(cr, uid, result, ['res_id'])
+
+ for case in case_obj.browse(cr, uid, context['active_ids']):
+ partner_id = partner_obj.search(cr, uid, [('name', '=', case.partner_name or case.name)])
+ if partner_id:
+ raise osv.except_osv(_('Warning !'),_('A partner is already existing with the same name.'))
+ else:
+ partner_id = partner_obj.create(cr, uid, {
+ 'name': case.partner_name or case.name,
+ 'user_id': case.user_id.id,
+ 'comment': case.description,
+ })
+ contact_id = contact_obj.create(cr, uid, {
+ 'partner_id': partner_id,
+ 'name': case.partner_name,
+ 'phone': case.partner_phone,
+ 'mobile': case.partner_mobile,
+ 'email': case.email_from
+ })
+
+ case_obj.write(cr, uid, context['active_ids'], {
+ 'partner_id': partner_id,
+ 'partner_address_id': contact_id
+ })
+ if data['close']:
+ case_obj.case_close(cr, uid, context['active_ids'])
+
+ value = {
+ 'domain': "[]",
+ 'view_type': 'form',
+ 'view_mode': 'form,tree',
+ 'res_model': 'res.partner',
+ 'res_id': int(partner_id),
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': res['res_id']
+ }
+ return value
+
+hr_recruitment_partner_create()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_recruitment/wizard/hr_recruitment_create_partner_job_view.xml b/addons/hr_recruitment/wizard/hr_recruitment_create_partner_job_view.xml
new file mode 100644
index 00000000000..1eaaa2fefdd
--- /dev/null
+++ b/addons/hr_recruitment/wizard/hr_recruitment_create_partner_job_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ hr.recruitment.partner.create.form
+ hr.recruitment.partner.create
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create Partner
+ ir.actions.act_window
+ hr.recruitment.partner.create
+ form
+ form
+ new
+
+
+
+
+
+ Create Partner
+ client_action_multi
+
+ action
+ hr.applicant
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall_view.xml b/addons/hr_recruitment/wizard/hr_recruitment_phonecall_view.xml
new file mode 100644
index 00000000000..f7c162594d2
--- /dev/null
+++ b/addons/hr_recruitment/wizard/hr_recruitment_phonecall_view.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+ hr.recruitment.job2phonecall.form
+ hr.recruitment.job2phonecall
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Schedule Phone Call
+ ir.actions.act_window
+ hr.recruitment.job2phonecall
+ form
+ form
+ new
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_recruitment/wizard/hr_recruitment_wizard.py b/addons/hr_recruitment/wizard/hr_recruitment_wizard.py
index a12ff4957eb..bd6fa8ba134 100644
--- a/addons/hr_recruitment/wizard/hr_recruitment_wizard.py
+++ b/addons/hr_recruitment/wizard/hr_recruitment_wizard.py
@@ -132,6 +132,61 @@ class job2phonecall(wizard.interface):
job2phonecall('hr.applicant.reschedule_phone_call')
+class job2meeting(wizard.interface):
+
+ def _makeMeeting(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ job_case_obj = pool.get('hr.applicant')
+ meeting_case_obj = pool.get('hr.meeting')
+ for job in job_case_obj.browse(cr, uid, data['ids']):
+ new_meeting_id = meeting_case_obj.create(cr, uid, {
+ 'name': job.name,
+ 'date': job.date,
+ 'duration': job.duration,
+ })
+ new_meeting = meeting_case_obj.browse(cr, uid, new_meeting_id)
+ vals = {}
+ job_case_obj.write(cr, uid, [job.id], vals)
+ job_case_obj.case_cancel(cr, uid, [job.id])
+ meeting_case_obj.case_open(cr, uid, [new_meeting_id])
+
+ data_obj = pool.get('ir.model.data')
+ result = data_obj._get_id(cr, uid, 'hr', 'view_hr_case_meetings_filter')
+ id = data_obj.read(cr, uid, result, ['res_id'])
+ id1 = data_obj._get_id(cr, uid, 'hr', 'hr_case_calendar_view_meet')
+ id2 = data_obj._get_id(cr, uid, 'hr', 'hr_case_form_view_meet')
+ id3 = data_obj._get_id(cr, uid, 'hr', 'hr_case_tree_view_meet')
+ if id1:
+ id1 = data_obj.browse(cr, uid, id1, context=context).res_id
+ if id2:
+ id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ if id3:
+ id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+ return {
+ 'name': _('Meetings'),
+ 'view_type': 'form',
+ 'view_mode': 'calendar,form,tree',
+ 'res_model': 'hr.meeting',
+ 'view_id': False,
+ 'views': [(id1,'calendar'),(id2,'form'),(id3,'tree'),(False,'graph')],
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _makeMeeting, 'state': 'order'}
+ },
+ 'order': {
+ 'actions': [],
+ 'result': {'type': 'state', 'state': 'end'}
+ }
+ }
+
+job2meeting('hr.applicant.meeting_set')
+
+
class partner_create(wizard.interface):
case_form = """
diff --git a/addons/hr_timesheet/i18n/de.po b/addons/hr_timesheet/i18n/de.po
index c0dc16b4145..8da6cb5fbef 100644
--- a/addons/hr_timesheet/i18n/de.po
+++ b/addons/hr_timesheet/i18n/de.po
@@ -13,7 +13,11 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+<<<<<<< TREE
+"X-Launchpad-Export-Date: 2010-04-07 03:46+0000\n"
+=======
"X-Launchpad-Export-Date: 2010-04-17 04:11+0000\n"
+>>>>>>> MERGE-SOURCE
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_timesheet
diff --git a/addons/hr_timesheet_invoice/__openerp__.py b/addons/hr_timesheet_invoice/__openerp__.py
index 3f4aecb9d3f..72148b83f63 100644
--- a/addons/hr_timesheet_invoice/__openerp__.py
+++ b/addons/hr_timesheet_invoice/__openerp__.py
@@ -40,6 +40,9 @@ reports, eso.""",
'report/report_analytic_view.xml',
'report/hr_timesheet_invoice_report_view.xml',
'wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml',
+ 'wizard/hr_timesheet_analytic_profit_view.xml',
+ 'wizard/hr_timesheet_invoice_create_view.xml',
+ 'wizard/hr_timesheet_invoice_create_final_view.xml',
],
'demo_xml': ['hr_timesheet_invoice_demo.xml'],
'installable': True,
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
index bed54ff7d0d..f2d9f5a8c4a 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
@@ -24,7 +24,7 @@
rml="hr_timesheet_invoice/report/account_analytic_profit.rml"
string="Timesheet Profit"/>
-
+ groups="hr.group_hr_manager"/>-->
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_wizard.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_wizard.xml
index 350f30c780d..50ca292d39d 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_wizard.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_wizard.xml
@@ -1,8 +1,8 @@
-
-
-
+
+
+
diff --git a/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py b/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py
index 28f129dce22..b7cf2e8a2df 100644
--- a/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py
+++ b/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,13 +15,67 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
from osv import fields,osv
from tools.sql import drop_view_if_exists
+class report_timesheet_line(osv.osv):
+ _name = "report.timesheet.line"
+ _description = "Timesheet Line"
+ _auto = False
+ _columns = {
+ 'name': fields.char('Year',size=64,required=False, readonly=True),
+ 'user_id':fields.many2one('res.users', 'User', readonly=True),
+ 'date' : fields.date('Date', readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'quantity': fields.float('Quantity', readonly=True),
+ 'cost': fields.float('Cost', readonly=True),
+ 'product_id' : fields.many2one('product.product', 'Product',readonly=True),
+ 'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
+ 'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True),
+ 'invoice_id': fields.many2one('account.invoice', 'Invoiced', 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),
+ }
+ _order = 'name desc,user_id desc'
+ def init(self, cr):
+ drop_view_if_exists(cr, 'report_timesheet_line')
+ cr.execute("""
+ create or replace view report_timesheet_line as (
+ select
+ min(l.id) as id,
+ l.date as date,
+ to_char(l.date,'YYYY') as name,
+ to_char(l.date,'MM') as month,
+ l.user_id,
+ to_char(l.date, 'YYYY-MM-DD') as day,
+ l.invoice_id,
+ l.product_id,
+ l.account_id,
+ l.general_account_id,
+ sum(l.unit_amount) as quantity,
+ sum(l.amount) as cost
+ from
+ account_analytic_line l
+ where
+ l.user_id is not null
+ group by
+ l.date,
+ l.user_id,
+ l.product_id,
+ l.account_id,
+ l.general_account_id,
+ l.invoice_id
+ )
+ """)
+report_timesheet_line()
+
+
+
+
class report_timesheet_user(osv.osv):
_name = "report_timesheet.user"
_description = "Timesheet per day"
@@ -102,7 +156,7 @@ class report_timesheet_account_date(osv.osv):
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
}
_order = 'name desc,account_id desc,user_id desc'
-
+
def init(self, cr):
drop_view_if_exists(cr, 'report_timesheet_account_date')
cr.execute("""
@@ -167,7 +221,7 @@ class report_random_timsheet(osv.osv):
_name = "report.random.timesheet"
_description = "Random Timesheet Report"
_auto = False
-
+
_columns = {
'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True),
'name': fields.char('Description', size=64, readonly=True),
@@ -176,34 +230,34 @@ class report_random_timsheet(osv.osv):
'user_id' : fields.many2one('res.users', 'User', readonly=True)
}
_order = "date desc"
-
+
def __init__(self, pool, cr):
super(report_random_timsheet, self).__init__(pool, cr)
self.called = False
-
+
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
""" To call the init() method timely
"""
if not self.called:
self.init(cr, user)
self.called = True # To make sure that init doesn't get called multiple times
-
+
res = super(report_random_timsheet, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
return res
-
+
def init(self, cr, uid=1):
drop_view_if_exists(cr, 'report_random_timesheet')
-
+
cr.execute("""create or replace view report_random_timesheet as (
- select
+ select
line.id as id, line.account_id as analytic_account_id, line.name as name,
line.unit_amount as quantity, line.date as date, line.user_id as user_id
- from
+ from
account_analytic_line line, hr_department dept,hr_department_user_rel dept_user
where
(dept.id = dept_user.department_id AND dept_user.user_id=line.user_id AND line.user_id is not null)
- AND (dept.manager_id = """ + str(uid) + """ )
+ AND (dept.manager_id = """ + str(uid) + """ )
AND (line.date <= CURRENT_DATE AND line.date > (CURRENT_DATE-3))
LIMIT 10
)
@@ -215,32 +269,32 @@ class random_timesheet_lines(osv.osv):
_name = "random.timesheet.lines"
_description = "Random Timesheet Lines"
_auto = False
-
+
_columns = {
- 'date': fields.date('Date', readonly=True),
+ 'date': fields.date('Date', readonly=True),
'name': fields.char('Description', size=64, readonly=True),
'user_id' : fields.many2one('res.users', 'User', readonly=True),
'quantity' : fields.float('Quantity', readonly=True),
- 'product_id' : fields.many2one('product.product', 'Product', readonly=True),
+ 'product_id' : fields.many2one('product.product', 'Product', readonly=True),
'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True),
'uom_id' : fields.many2one('product.uom', 'UoM', readonly=True),
'amount' : fields.float('Amount', readonly=True),
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Invoicing', readonly=True),
'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True)
}
-
+
_order = "date desc"
-
+
def init(self, cr):
drop_view_if_exists(cr, 'random_timesheet_lines')
-
+
cr.execute("""create or replace view random_timesheet_lines as (
- select
+ select
line.id as id, line.date as date, line.name as name, line.unit_amount as quantity,
line.product_id as product_id, line.account_id as analytic_account_id,
line.product_uom_id as uom_id, line.amount as amount, line.to_invoice as to_invoice,
- line.general_account_id as general_account_id, line.user_id as user_id
- from
+ line.general_account_id as general_account_id, line.user_id as user_id
+ from
account_analytic_line line
where
(line.date <= CURRENT_DATE AND line.date > (CURRENT_DATE-15))
diff --git a/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report_view.xml b/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report_view.xml
index c895250284e..4de60162d1a 100644
--- a/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report_view.xml
+++ b/addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report_view.xml
@@ -6,6 +6,106 @@
name="Reporting"
parent="hr.menu_hr_root"
sequence="40" />
+
+
+ report.timesheet.line.graph
+ report.timesheet.line
+ graph
+
+
+
+
+
+
+
+
+
+
+ report.timesheet.line.tree
+ report.timesheet.line
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ report.timesheet.line.search
+ report.timesheet.line
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Timesheet Line
+ report.timesheet.line
+ form
+ tree,graph
+ {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
+
+
+
+
+
@@ -89,7 +189,7 @@
graph,tree
-
+
@@ -155,7 +255,7 @@
graph,tree
-
+
@@ -229,7 +329,7 @@
graph,tree
-
+
@@ -304,7 +404,7 @@
graph,tree
-
+
diff --git a/addons/hr_timesheet_invoice/wizard/__init__.py b/addons/hr_timesheet_invoice/wizard/__init__.py
index b3921b01008..6dce6a7b651 100644
--- a/addons/hr_timesheet_invoice/wizard/__init__.py
+++ b/addons/hr_timesheet_invoice/wizard/__init__.py
@@ -20,7 +20,7 @@
##############################################################################
import hr_timesheet_invoice_create
-import account_analytic_profit
+import hr_timesheet_analytic_profit
import hr_timesheet_final_invoice_create
import hr_timesheet_analytic_cost_ledger_report
diff --git a/addons/hr_timesheet_invoice/wizard/account_analytic_profit.py b/addons/hr_timesheet_invoice/wizard/account_analytic_profit.py
deleted file mode 100644
index 90861b6f5a9..00000000000
--- a/addons/hr_timesheet_invoice/wizard/account_analytic_profit.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- 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 .
-#
-##############################################################################
-
-import wizard
-import datetime
-import pooler
-from tools.translate import _
-
-form='''
-
-
-
-
-
-
'''
-
-class wizard_report(wizard.interface):
- def _date_from(*a):
- return datetime.datetime.today().strftime('%Y-%m-1')
-
- def _date_to(*a):
- return datetime.datetime.today().strftime('%Y-%m-%d')
-
- def _check(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- line_obj = pool.get('account.analytic.line')
- product_obj = pool.get('product.product')
- price_obj = pool.get('product.pricelist')
- ids = line_obj.search(cr, uid, [
- ('date', '>=', data['form']['date_from']),
- ('date', '<=', data['form']['date_to']),
- ('journal_id', 'in', data['form']['journal_ids'][0][2]),
- ('user_id', 'in', data['form']['employee_ids'][0][2]),
- ])
- if not ids:
- raise wizard.except_wizard(_('Data Insufficient!'), _('No Records Found for Report!'))
-
- return data['form']
-
-
- fields={
- 'date_from':{
- 'string':'From',
- 'type':'date',
- 'required':True,
- 'default':_date_from,
- },
- 'date_to':{
- 'string':'To',
- 'type':'date',
- 'required':True,
- 'default':_date_to,
- },
- 'journal_ids':{
- 'string':'Journal',
- 'type':'many2many',
- 'relation':'account.analytic.journal',
- 'required':True,
- },
- 'employee_ids':{
- 'string':'Employee',
- 'type':'many2many',
- 'relation':'res.users',
- 'required':True,
- },
- }
-
- states={
- 'init':{
- 'actions':[],
- 'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end', 'Cancel', 'gtk-cancel'), ('report', 'Print', 'gtk-ok')]}
- },
- 'report':{
- 'actions':[_check],
- 'result':{'type':'print', 'report':'account.analytic.profit', 'state':'end'}
- }
- }
-wizard_report('account.analytic.profit')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py
new file mode 100644
index 00000000000..f5b37256a02
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py
@@ -0,0 +1,79 @@
+# -*- 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 .
+#
+##############################################################################
+import datetime
+
+from osv import osv, fields
+from tools.translate import _
+
+class account_analytic_profit(osv.osv_memory):
+ _name = 'hr.timesheet.analytic.profit'
+ _description = 'Print Timesheet Profit'
+ _columns = {
+ 'date_from': fields.date('From', required=True),
+ 'date_to': fields.date('To', required=True),
+ 'journal_ids': fields.many2many('account.analytic.journal', 'analytic_profit_journal_rel', 'analytic_id', 'journal_id', 'Journal', required=True),
+ 'employee_ids': fields.many2many('res.users', 'analytic_profit_emp_rel', 'analytic_id', 'emp_id', 'Employee', required=True),
+ }
+
+ def _date_from(*a):
+ return datetime.datetime.today().strftime('%Y-%m-1')
+
+ def _date_to(*a):
+ return datetime.datetime.today().strftime('%Y-%m-%d')
+
+ _defaults = {
+ 'date_from': _date_from,
+ 'date_to': _date_to
+ }
+
+ def print_report(self, cr, uid, ids, context=None):
+ line_obj = self.pool.get('account.analytic.line')
+ product_obj = self.pool.get('product.product')
+ price_obj = self.pool.get('product.pricelist')
+ data = {}
+ data['form'] = self.read(cr, uid , ids, [], context=context)[0]
+ if context is None:
+ context = {}
+ ids_chk = line_obj.search(cr, uid, [
+ ('date', '>=', data['form']['date_from']),
+ ('date', '<=', data['form']['date_to']),
+ ('journal_id', 'in', data['form']['journal_ids']),
+ ('user_id', 'in', data['form']['employee_ids']),
+ ])
+ if not ids_chk:
+ raise osv.except_osv(_('Data Insufficient!'), _('No Records Found for Report!'))
+
+ data['form']['journal_ids'] = [(6, 0, data['form']['journal_ids'])] # Improve me => Change the rml/sxw so that it can support withou [0][2]
+ data['form']['employee_ids'] = [(6, 0, data['form']['employee_ids'])]
+ datas = {
+ 'ids': [],
+ 'model': 'account.analytic.line',
+ 'form': data['form']
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.analytic.profit',
+ 'datas': datas,
+ }
+
+account_analytic_profit()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit_view.xml
new file mode 100644
index 00000000000..f79cae2eef8
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit_view.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+ Timesheet Profit
+ hr.timesheet.analytic.profit
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Timesheet Profit
+ ir.actions.act_window
+ hr.timesheet.analytic.profit
+ form
+ form
+ new
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py
index 1f9efe9641f..e8309d84921 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,15 +15,14 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
-import wizard
-import pooler
import time
-from tools.translate import _
+from osv import osv, fields
+from tools.translate import _
#
# Create an final invoice based on selected timesheet lines
#
@@ -31,26 +30,37 @@ from tools.translate import _
#
# TODO: check unit of measure !!!
#
-class final_invoice_create(wizard.interface):
- def _get_defaults(self, cr, uid, data, context):
- return {}
+class final_invoice_create(osv.osv_memory):
+ _name = 'hr.timesheet.invoice.create.final'
+ _description = 'Create invoice from timesheet final'
+ _columns = {
+ 'date': fields.boolean('Date', help='Display date in the history of works'),
+ 'time': fields.boolean('Time spent', help='Display time in the history of works'),
+ 'name': fields.boolean('Name of entry', help='Display detail of work in the invoice line.'),
+ 'price': fields.boolean('Cost', help='Display cost of the item you reinvoice'),
+ 'balance_product': fields.many2one('product.product', 'Balance product', help='The product that will be used to invoice the remaining amount'),
+ }
- def _do_create(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- mod_obj = pool.get('ir.model.data')
+ def do_create(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ analytic_account_obj = self.pool.get('account.analytic.account')
+ res_partner_obj = self.pool.get('res.partner')
+ account_payment_term_obj = self.pool.get('account.payment.term')
+ invoices = []
+
+ if context is None:
+ context = {}
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
- analytic_account_obj = pool.get('account.analytic.account')
- res_partner_obj = pool.get('res.partner')
- account_payment_term_obj = pool.get('account.payment.term')
- account_ids = data['ids']
- invoices = []
+ data = self.read(cr, uid, ids, [], context)[0]
+ account_ids = 'active_ids' in context and context['active_ids'] or []
+
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
amount_total=0.0
if (not partner) or not (account.pricelist_id):
- raise wizard.except_wizard(_('Analytic account incomplete'),
+ raise osv.except_osv(_('Analytic account incomplete'),
_('Please fill in the partner and pricelist field '
'in the analytic account:\n%s') % (account.name,))
@@ -67,15 +77,15 @@ class final_invoice_create(wizard.interface):
curr_invoice = {
'name': time.strftime('%D')+' - '+account.name,
'partner_id': account.partner_id.id,
- 'address_contact_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['contact'])['contact'],
- 'address_invoice_id': pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['invoice'])['invoice'],
+ 'address_contact_id': self.pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['contact'])['contact'],
+ 'address_invoice_id': self.pool.get('res.partner').address_get(cr, uid, [account.partner_id.id], adr_pref=['invoice'])['invoice'],
'payment_term': partner.property_payment_term.id or False,
'account_id': partner.property_account_receivable.id,
'currency_id': account.pricelist_id.currency_id.id,
'date_due': date_due,
'fiscal_position': account.partner_id.property_account_position.id
}
- last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice)
+ last_invoice = self.pool.get('account.invoice').create(cr, uid, curr_invoice)
invoices.append(last_invoice)
context2=context.copy()
@@ -106,14 +116,14 @@ class final_invoice_create(wizard.interface):
line.product_uom_id,
move_line.ref""", (account.id,))
for product_id, amount, account_id, product_uom_id, ref in cr.fetchall():
- product = pool.get('product.product').browse(cr, uid, product_id, context2)
+ product = self.pool.get('product.product').browse(cr, uid, product_id, context2)
if product:
taxes = product.taxes_id
else:
taxes = []
- tax = pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
+ tax = self.pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
curr_line = {
'price_unit': -amount,
'quantity': 1.0,
@@ -126,14 +136,14 @@ class final_invoice_create(wizard.interface):
'account_id': account_id,
'account_analytic_id': account.id
}
- pool.get('account.invoice.line').create(cr, uid, curr_line)
+ self.pool.get('account.invoice.line').create(cr, uid, curr_line)
- if not data['form']['balance_product']:
- raise wizard.except_wizard(_('Balance product needed'), _('Please fill a Balance product in the wizard'))
- product = pool.get('product.product').browse(cr, uid, data['form']['balance_product'], context2)
+ if not data['balance_product']:
+ raise osv.except_osv(_('Balance product needed'), _('Please fill a Balance product in the wizard'))
+ product = self.pool.get('product.product').browse(cr, uid, data['balance_product'], context2)
taxes = product.taxes_id
- tax = pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
+ tax = self.pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
curr_line = {
'price_unit': account.amount_max - amount_total,
@@ -147,9 +157,9 @@ class final_invoice_create(wizard.interface):
'account_id': account_id,
'account_analytic_id': account.id
}
- pool.get('account.invoice.line').create(cr, uid, curr_line)
+ self.pool.get('account.invoice.line').create(cr, uid, curr_line)
if account.amount_max < amount_total:
- pool.get('account.invoice').write(cr, uid, [last_invoice], {'type': 'out_refund',})
+ self.pool.get('account.invoice').write(cr, uid, [last_invoice], {'type': 'out_refund',})
cr.execute('update account_analytic_line set invoice_id=%s where invoice_id is null and account_id=%s', (last_invoice, account.id))
return {
@@ -161,40 +171,9 @@ class final_invoice_create(wizard.interface):
'view_id': False,
'context': "{'type':'out_invoice'}",
'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
+ 'search_view_id': res['res_id']
+ }
+final_invoice_create()
- _create_form = """
-
-
-
-
-
-
-
-
-
"""
-
- _create_fields = {
- 'date': {'string':'Date', 'type':'boolean', 'help':"Display date in the history of works"},
- 'time': {'string':'Time spent', 'type':'boolean', 'help':"Display time in the history of works"},
- 'name': {'string':'Name of entry', 'type':'boolean', 'help':"Display detail of work in the invoice line."},
- 'price': {'string':'Cost', 'type':'boolean', 'help':"Display cost of the item you reinvoice"},
- 'balance_product': {'string':'Balance product', 'type': 'many2one', 'relation':'product.product', 'help':"The product that will be used to invoice the remaining amount."},
- }
-
- states = {
- 'init' : {
- 'actions' : [_get_defaults],
- 'result' : {'type':'form', 'arch':_create_form, 'fields':_create_fields, 'state': [('end','Cancel', 'gtk-cancel'),('create','Create invoices', 'gtk-ok')]},
- },
- 'create' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_do_create, 'state':'end'},
- },
- }
-final_invoice_create('hr.timesheet.final.invoice.create')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
index 7e5edca5474..89ff5e92697 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
@@ -19,52 +19,69 @@
#
##############################################################################
-import wizard
-import pooler
import time
+
+from osv import osv, fields
from tools.translate import _
-#
-# Create an invoice based on selected timesheet lines
+## Create an invoice based on selected timesheet lines
#
#
# TODO: check unit of measure !!!
#
-class invoice_create(wizard.interface):
- def _get_accounts(self, cr, uid, data, context):
- if not len(data['ids']):
+class hr_timesheet_invoice_create(osv.osv_memory):
+
+ _name = 'hr.timesheet.invoice.create'
+ _description = 'Create invoice from timesheet'
+ _columns = {
+ 'accounts': fields.many2many('account.analytic.account', 'invoice_id', 'account_id', 'Analytic Accounts', required=True),
+ 'date': fields.boolean('Date', help='The real date of each work will be displayed on the invoice'),
+ 'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'),
+ 'name': fields.boolean('Name of entry', help='The detail of each work done will be displayed on the invoice'),
+ 'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'),
+ 'product': fields.many2one('product.product', 'Product', help='Complete this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'),
+ }
+
+ def _get_accounts(self, cr, uid, context=None):
+ if context is None:
+ context = {}
+ if not len(context['active_ids']):
return {}
#Checking whether the analytic line is invoiced or not
- pool = pooler.get_pool(cr.dbname)
- analytic_line_obj = pool.get('account.analytic.line').browse(cr, uid, data['ids'], context)
+ analytic_line_obj = self.pool.get('account.analytic.line').browse(cr, uid, context['active_ids'], context)
for obj_acc in analytic_line_obj:
if obj_acc.invoice_id and obj_acc.invoice_id.state !='cancel':
- raise wizard.except_wizard(_('Warning'),_('The analytic entry "%s" is already invoiced!')%(obj_acc.name,))
-
- cr.execute("SELECT distinct(account_id) from account_analytic_line where id =ANY(%s)",(data['ids'],))
- account_ids = cr.fetchall()
- return {'accounts': [x[0] for x in account_ids]}
+ raise osv.except_osv(_('Warning'),_('The analytic entry "%s" is already invoiced!')%(obj_acc.name,))
+
+ cr.execute("SELECT distinct(account_id) from account_analytic_line where id =ANY(%s)",(context['active_ids'],))
+ account_ids = cr.fetchall()
+ return [x[0] for x in account_ids]
+
+ _defaults = {
+ 'accounts': _get_accounts
+ }
+
+ def do_create(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ analytic_account_obj = self.pool.get('account.analytic.account')
+ res_partner_obj = self.pool.get('res.partner')
+ account_payment_term_obj = self.pool.get('account.payment.term')
+ invoices = []
- def _do_create(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
- analytic_account_obj = pool.get('account.analytic.account')
- res_partner_obj = pool.get('res.partner')
- account_payment_term_obj = pool.get('account.payment.term')
- account_ids = data['form']['accounts'][0][2]
- invoices = []
+ data = self.read(cr, uid, ids, [], context)[0]
+ account_ids = data['accounts']
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
if (not partner) or not (account.pricelist_id):
- raise wizard.except_wizard(_('Analytic Account incomplete'),
+ raise osv.except_osv(_('Analytic Account incomplete'),
_('Please fill in the Associate Partner and Sale Pricelist fields in the Analytic Account:\n%s') % (account.name,))
if not partner.address:
- raise wizard.except_wizard(_('Partner incomplete'),
+ raise osv.except_osv(_('Partner incomplete'),
_('Please fill in the Address field in the Partner: %s.') % (partner.name,))
date_due = False
@@ -90,7 +107,7 @@ class invoice_create(wizard.interface):
'date_due': date_due,
'fiscal_position': account.partner_id.property_account_position.id
}
- last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice)
+ last_invoice = self.pool.get('account.invoice').create(cr, uid, curr_invoice)
invoices.append(last_invoice)
context2=context.copy()
@@ -99,26 +116,26 @@ class invoice_create(wizard.interface):
"FROM account_analytic_line as line " \
"WHERE account_id = %s " \
"AND id =ANY(%s) AND to_invoice IS NOT NULL " \
- "GROUP BY product_id,to_invoice", (account.id,data['ids'],))
+ "GROUP BY product_id,to_invoice", (account.id,context['active_ids'],))
for product_id,factor_id,qty in cr.fetchall():
product = pool.get('product.product').browse(cr, uid, product_id, context2)
if not product:
- raise wizard.except_wizard(_('Error'), _('At least one line has no product !'))
+ raise osv.except_osv(_('Error'), _('At least one line has no product !'))
factor_name = ''
factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2)
- if not data['form']['product']:
+ if not data['product']:
if factor.customer_name:
factor_name = product.name+' - '+factor.customer_name
else:
factor_name = product.name
else:
- factor_name = pool.get('product.product').name_get(cr, uid, [data['form']['product']], context=context)[0][1]
+ factor_name = pool.get('product.product').name_get(cr, uid, [data['product']], context=context)[0][1]
if account.pricelist_id:
pl = account.pricelist_id.id
- price = pool.get('product.pricelist').price_get(cr,uid,[pl], data['form']['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
+ price = pool.get('product.pricelist').price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
else:
price = 0.0
@@ -132,7 +149,7 @@ class invoice_create(wizard.interface):
'invoice_line_tax_id': [(6,0,tax )],
'invoice_id': last_invoice,
'name': factor_name,
- 'product_id': data['form']['product'] or product_id,
+ 'product_id': data['product'] or product_id,
'invoice_line_tax_id': [(6,0,tax)],
'uos_id': product.uom_id.id,
'account_id': account_id,
@@ -149,27 +166,27 @@ class invoice_create(wizard.interface):
for line in line_ids:
# set invoice_line_note
details = []
- if data['form']['date']:
+ if data['date']:
details.append(line['date'])
- if data['form']['time']:
+ if data['time']:
if line['product_uom_id']:
details.append("%s %s" % (line['unit_amount'], pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name))
else:
details.append("%s" % (line['unit_amount'], ))
- if data['form']['name']:
+ if data['name']:
details.append(line['name'])
- #if data['form']['price']:
+ #if data['price']:
# details.append(abs(line['amount']))
note.append(u' - '.join(map(lambda x: unicode(x) or '',details)))
curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note))
pool.get('account.invoice.line').create(cr, uid, curr_line)
- cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =ANY(%s)" ,(last_invoice,account.id,data['ids']))
+ cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =ANY(%s)" ,(last_invoice, account.id,data['ids']))
- pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)
+ self.pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)
- mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
- act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
mod_id = mod_obj.search(cr, uid, [('name', '=', 'action_invoice_tree1')])[0]
res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
@@ -190,45 +207,8 @@ class invoice_create(wizard.interface):
# 'search_view_id': res['res_id']
# }
- _create_form = """
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
"""
- _create_fields = {
- 'accounts': {'string':'Analytic Accounts', 'type':'many2many', 'required':'true', 'relation':'account.analytic.account'},
- 'date': {'string':'Date', 'type':'boolean', 'help':'The real date of each work will be displayed on the invoice'},
- 'time': {'string':'Time spent', 'type':'boolean', 'help':'The time of each work done will be displayed on the invoice'},
- 'name': {'string':'Name of entry', 'type':'boolean', 'help':'The detail of each work done will be displayed on the invoice'},
- 'price': {'string':'Cost', 'type':'boolean', 'help':'The cost of each work done will be displayed on the invoice. You probably don\'t want to check this.'},
- 'product': {'string':'Product', 'type':'many2one', 'relation': 'product.product', 'help':"Complete this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost."},
- }
-
- states = {
- 'init' : {
- 'actions' : [_get_accounts],
- 'result' : {'type':'form', 'arch':_create_form, 'fields':_create_fields, 'state': [('end','Cancel', 'gtk-cancel'),('create','Create Invoices', 'gtk-ok')]},
- },
- 'create' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_do_create, 'state':'end'},
- },
- }
-invoice_create('hr.timesheet.invoice.create')
+hr_timesheet_invoice_create()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_final_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_final_view.xml
new file mode 100644
index 00000000000..7b3f5ed4d6a
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_final_view.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+ hr.timesheet.invoice.create.final.form
+ hr.timesheet.invoice.create.final
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Final Invoice
+ ir.actions.act_window
+ hr.timesheet.invoice.create.final
+ form
+ form
+ new
+
+
+
+
+
+ Final Invoice
+ client_action_multi
+
+ action
+ account.analytic.account
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml
new file mode 100644
index 00000000000..7ddf3bc99a7
--- /dev/null
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+ hr.timesheet.invoice.create.form
+ hr.timesheet.invoice.create
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Invoice analytic lines
+ ir.actions.act_window
+ hr.timesheet.invoice.create
+ form
+ form
+ new
+
+
+
+
+
+ Invoice analytic lines
+ client_action_multi
+
+ action
+ account.analytic.line
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_timesheet_sheet/__init__.py b/addons/hr_timesheet_sheet/__init__.py
index 46961316bb4..d7635359c74 100644
--- a/addons/hr_timesheet_sheet/__init__.py
+++ b/addons/hr_timesheet_sheet/__init__.py
@@ -21,6 +21,6 @@
import hr_timesheet_sheet
import wizard
-
+import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_timesheet_sheet/__openerp__.py b/addons/hr_timesheet_sheet/__openerp__.py
index 9042d4200f1..44058d048cb 100644
--- a/addons/hr_timesheet_sheet/__openerp__.py
+++ b/addons/hr_timesheet_sheet/__openerp__.py
@@ -52,7 +52,8 @@ The validation can be configured in te company:
'security/hr_timesheet_data.xml',
'hr_timesheet_sheet_view.xml',
'hr_timesheet_workflow.xml',
- 'process/hr_timesheet_sheet_process.xml'
+ 'process/hr_timesheet_sheet_process.xml',
+ 'report/timesheet_report_view.xml',
],
'demo_xml': ['hr_timesheet_sheet_demo.xml'],
'installable': True,
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
index 81b86fecfa6..04d9451a4bf 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
@@ -20,7 +20,18 @@
-
+
+ hr.timesheet.sheet.graph
+ hr_timesheet_sheet.sheet
+ graph
+
+
+
+
+
+
+
+ hr.timesheet.account.formhr_timesheet_sheet.sheet.account
@@ -181,7 +192,7 @@
-
+
diff --git a/addons/hr_timesheet_sheet/report/__init__.py b/addons/hr_timesheet_sheet/report/__init__.py
new file mode 100644
index 00000000000..89f12b7c9a6
--- /dev/null
+++ b/addons/hr_timesheet_sheet/report/__init__.py
@@ -0,0 +1,25 @@
+# -*- 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 .
+#
+##############################################################################
+
+import timesheet_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/hr_timesheet_sheet/report/timesheet_report.py b/addons/hr_timesheet_sheet/report/timesheet_report.py
new file mode 100644
index 00000000000..ee016df56d7
--- /dev/null
+++ b/addons/hr_timesheet_sheet/report/timesheet_report.py
@@ -0,0 +1,94 @@
+# -*- 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 .
+#
+##############################################################################
+
+import tools
+from osv import fields,osv
+
+class timesheet_report(osv.osv):
+ _name = "timesheet.report"
+ _description = "Timesheet"
+ _auto = False
+ _columns = {
+ 'year': fields.char('Year',size=64,required=False, 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),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'name': fields.char('Description', size=64,readonly=True),
+ 'user_id': fields.many2one('res.users', 'User',readonly=True),
+ 'nbr': fields.integer('#Nbr',readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company',readonly=True),
+ 'department_id':fields.many2one('hr.department','Department',readonly=True),
+ 'date_from': fields.date('Date from',readonly=True,),
+ 'date_to': fields.date('Date to',readonly=True),
+ 'date_current': fields.date('Current date', required=True),
+ 'state' : fields.selection([
+ ('new', 'New'),
+ ('draft','Draft'),
+ ('confirm','Confirmed'),
+ ('done','Done')], 'State', readonly=True),
+ 'total_att': fields.float('Total Timesheet',readonly=True),
+ 'total_ts': fields.float('Total Attendance',readonly=True),
+ 'total_diff': fields.float('Difference', readonly=True),
+ }
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'timesheet_report')
+ cr.execute("""
+ create or replace view timesheet_report as (
+ select
+ min(aal.id) as id,
+ htss.date_current,
+ htss.name,
+ htss.date_from,
+ htss.date_to,
+ to_char(htss.date_current,'YYYY') as year,
+ to_char(htss.date_current,'MM') as month,
+ to_char(htss.date_current, 'YYYY-MM-DD') as day,
+ count(*) as nbr,
+ sum(day.total_attendance) as total_att,
+ sum(day.total_timesheet) as total_ts,
+ sum(day.total_difference) as total_diff,
+ aal.account_id,
+ htss.user_id,
+ htss.company_id,
+ htss.department_id,
+ htss.state
+ from account_analytic_line as aal
+ left join hr_analytic_timesheet as hat ON (hat.line_id=aal.id)
+ left join hr_timesheet_sheet_sheet as htss ON (hat.line_id=htss.id)
+ left join hr_timesheet_sheet_sheet_day AS day ON (htss.id = day.sheet_id)
+ group by
+ to_char(htss.date_current,'YYYY'),
+ to_char(htss.date_current,'MM'),
+ to_char(htss.date_current, 'YYYY-MM-DD'),
+ aal.account_id,
+ htss.date_from,
+ htss.date_to,
+ htss.date_current,
+ htss.name,
+ htss.company_id,
+ htss.state,
+ htss.department_id,
+ htss.user_id
+ )
+ """)
+timesheet_report()
\ No newline at end of file
diff --git a/addons/hr_timesheet_sheet/report/timesheet_report_view.xml b/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
new file mode 100644
index 00000000000..976b2a6f8ea
--- /dev/null
+++ b/addons/hr_timesheet_sheet/report/timesheet_report_view.xml
@@ -0,0 +1,119 @@
+
+
+
+
+ timesheet.report.graph
+ timesheet.report
+ graph
+
+
+
+
+
+
+
+
+
+
+ timesheet.report.tree
+ timesheet.report
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ timesheet.report.search
+ timesheet.report
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Timesheet
+ timesheet.report
+ form
+ tree,graph
+ {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}
+
+
+
+
+
diff --git a/addons/hr_timesheet_sheet/wizard/__init__.py b/addons/hr_timesheet_sheet/wizard/__init__.py
index f6fba6021af..485bfbe5db2 100644
--- a/addons/hr_timesheet_sheet/wizard/__init__.py
+++ b/addons/hr_timesheet_sheet/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,12 +15,11 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
-import wizard_timesheet_current
-import wizard_timesheet_department
+import hr_timesheet_current
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_timesheet_sheet/wizard/wizard_timesheet_current.py b/addons/hr_timesheet_sheet/wizard/hr_timesheet_current.py
similarity index 73%
rename from addons/hr_timesheet_sheet/wizard/wizard_timesheet_current.py
rename to addons/hr_timesheet_sheet/wizard/hr_timesheet_current.py
index 8613df3bc82..4d9998014c8 100644
--- a/addons/hr_timesheet_sheet/wizard/wizard_timesheet_current.py
+++ b/addons/hr_timesheet_sheet/wizard/hr_timesheet_current.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,27 +15,27 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
-
-
-import wizard
-import netsvc
import time
-import pooler
-from osv import osv
+
+from osv import osv, fields
from tools.translate import _
-class wiz_timesheet_open(wizard.interface):
- def _open_timesheet(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- user_ids = pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
- if not len(user_ids):
- raise wizard.except_wizard(_('Error !'), _('No employee defined for your user !'))
- ts = pool.get('hr_timesheet_sheet.sheet')
- ids = ts.search(cr, uid, [('user_id','=',uid),('state','=','draft'),('date_from','<=',time.strftime('%Y-%m-%d')), ('date_to','>=',time.strftime('%Y-%m-%d'))])
+class hr_timesheet_current_open(osv.osv_memory):
+ _name = 'hr.timesheet.current.open'
+ _description = 'hr.timesheet.current.open'
+
+ def open_timesheet(self, cr, uid, ids, context=None):
+ ts = self.pool.get('hr_timesheet_sheet.sheet')
view_type = 'form,tree'
+
+ user_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
+ if not len(user_ids):
+ raise osv.except_osv(_('Error !'), _('No employee defined for your user !'))
+ ids = ts.search(cr, uid, [('user_id','=',uid),('state','=','draft'),('date_from','<=',time.strftime('%Y-%m-%d')), ('date_to','>=',time.strftime('%Y-%m-%d'))])
+
if len(ids) > 1:
view_type = 'tree,form'
domain = "[('id','in',["+','.join(map(str, ids))+"]),('user_id', '=', uid)]"
@@ -46,7 +46,7 @@ class wiz_timesheet_open(wizard.interface):
domain = "[('user_id', '=', uid)]"
value = {
'domain': domain,
- 'name': 'Open timesheet',
+ 'name': 'Open Timesheet',
'view_type': 'form',
'view_mode': view_type,
'res_model': 'hr_timesheet_sheet.sheet',
@@ -57,14 +57,6 @@ class wiz_timesheet_open(wizard.interface):
value['res_id'] = ids[0]
return value
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
- }
- }
-wiz_timesheet_open('hr_timesheet_sheet.current.open')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+hr_timesheet_current_open()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr_timesheet_sheet/wizard/wizard_timesheet_department.py b/addons/hr_timesheet_sheet/wizard/wizard_timesheet_department.py
deleted file mode 100644
index 93aa12045ba..00000000000
--- a/addons/hr_timesheet_sheet/wizard/wizard_timesheet_department.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# -*- 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 .
-#
-##############################################################################
-
-
-import wizard
-import netsvc
-import time
-import pooler
-from osv import osv
-
-class wiz_timesheet_open(wizard.interface):
- def _open_timesheet(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- dep_ids = pool.get('hr.department').search(cr, uid, [('manager_id','=',uid)])
- user_ids = {}
- for dep in pool.get('hr.department').browse(cr, uid, dep_ids, context):
- for user in dep.member_ids:
- user_ids[user.id] = 1
- value = {
- 'domain': "[('user_id', 'in', "+str(user_ids.keys())+")]",
- 'name': 'Timesheets',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'hr_timesheet_sheet.sheet',
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
- return value
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
- }
- }
-wiz_timesheet_open('hr_timesheet_sheet.department.open')
-
-class wiz_timesheet_confirm_open(wizard.interface):
- def _open_timesheet(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- dep_ids = pool.get('hr.department').search(cr, uid, [('manager_id','=',uid)])
- user_ids = {}
- for dep in pool.get('hr.department').browse(cr, uid, dep_ids, context):
- for user in dep.member_ids:
- user_ids[user.id] = 1
- value = {
- 'domain': "[('user_id', 'in', "+str(user_ids.keys())+"),('state','=','draft')]",
- 'name': 'Timesheets',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'hr_timesheet_sheet.sheet',
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
- return value
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
- }
- }
-wiz_timesheet_confirm_open('hr_timesheet_sheet.department.confirm.open')
-
-
-class wiz_timesheet_validate_open(wizard.interface):
- def _open_timesheet(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- dep_ids = pool.get('hr.department').search(cr, uid, [('manager_id','=',uid)])
- user_ids = {}
- for dep in pool.get('hr.department').browse(cr, uid, dep_ids, context):
- for user in dep.member_ids:
- user_ids[user.id] = 1
- value = {
- 'domain': "[('user_id', 'in', "+str(user_ids.keys())+"),('state','=','confirm')]",
- 'name': 'Timesheets',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'hr_timesheet_sheet.sheet',
- 'view_id': False,
- 'type': 'ir.actions.act_window'
- }
- return value
-
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
- }
- }
-wiz_timesheet_validate_open('hr_timesheet_sheet.department.validate.open')
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index 2c33f69d577..5b8b7c41084 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -618,7 +618,8 @@
- formtree,form,calendar,graph,gantt
- {"search_default_current":1}
@@ -852,7 +852,7 @@
-
+ mrp.procurementform
- {"search_default_current":1}