[MERGE]: lp:~openerp-dev/openobject-addons/trunk-dev-addons1

bzr revid: sbh@tinyerp.com-20100426072455-g7lc8s1b17stwn0v
This commit is contained in:
sbh (Open ERP) 2010-04-26 12:54:55 +05:30
commit 72a9bc80c3
5 changed files with 121 additions and 283 deletions

View File

@ -78,8 +78,8 @@
<!-- report-related wizards -->
<!-- <wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/> -->
<!-- <menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
<!--<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/> -->
<!-- <wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>-->

View File

@ -2,11 +2,6 @@
<openerp>
<data>
<menuitem id="next_id_22"
name="Partner Accounts"
parent="menu_finance_generic_reporting"
sequence="1"/>
<record id="account_aged_balance_view" model="ir.ui.view">
<field name="name">Aged Partner Balance</field>
<field name="model">account.aged.trial.balance</field>

View File

@ -0,0 +1,116 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import osv, fields
from tools.translate import _
class job2phonecall(osv.osv_memory):
_name = 'hr.recruitment.job2phonecall'
_description = 'Schedule Phone Call'
_columns = {
'user_id': fields.many2one('res.users', 'Assign To'),
'deadline': fields.datetime('Planned Date'),
'note': fields.text('Goals'),
'category_id': fields.many2one('crm.case.categ', 'Category', required=True),
}
def _date_user(self, cr, uid, context=None):
case_obj = self.pool.get('hr.applicant')
case = case_obj.browse(cr, uid, context['active_id'])
return case.user_id and case.user_id.id or False
def _date_category(self, cr, uid, context=None):
categ_id = self.pool.get('crm.case.categ').search(cr, uid, [('name','=','Outbound')])
return categ_id and categ_id[0] or case.categ_id and case.categ_id.id or False
def _get_note(self, cr, uid, context=None):
case_obj = self.pool.get('hr.applicant')
case = case_obj.browse(cr, uid, context['active_id'])
return case.description or ''
_defaults = {
'user_id': _date_user,
'category_id': _date_category,
'note': _get_note
}
def make_phonecall(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
job_case_obj = self.pool.get('hr.applicant')
data_obj = self.pool.get('ir.model.data')
phonecall_case_obj = self.pool.get('crm.phonecall')
form = self.read(cr, uid, ids, [], context=context)[0]
# form = data['form']
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
# Select the view
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view')
id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
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
for job in job_case_obj.browse(cr, uid, context['active_ids']):
#TODO : Take other info from job
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
'name' : job.name,
'user_id' : form['user_id'],
'categ_id' : form['category_id'],
'description' : form['note'],
'date' : form['deadline'],
# 'section_id' : form['section_id'],
'description':job.description,
'partner_id':job.partner_id.id,
'partner_address_id':job.partner_address_id.id,
'partner_phone':job.partner_phone,
'partner_mobile':job.partner_mobile,
'description':job.description,
'date':job.date,
}, context=context)
new_phonecall = phonecall_case_obj.browse(cr, uid, new_phonecall_id)
vals = {}
# if not job.case_id:
# vals.update({'phonecall_id' : new_phonecall.id})
job_case_obj.write(cr, uid, [job.id], vals)
job_case_obj.case_cancel(cr, uid, [job.id])
phonecall_case_obj.case_open(cr, uid, [new_phonecall_id])
value = {
'name': _('Phone Call'),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'crm.phonecall',
'res_id' : new_phonecall_id,
'views': [(id3,'form'),(id2,'tree'),(False,'calendar'),(False,'graph')],
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']
}
return value
job2phonecall()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:>>>>>>> MERGE-SOURCE

View File

@ -1,273 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from mx.DateTime import now
import wizard
import netsvc
import ir
import pooler
import time
from tools.translate import _
class job2phonecall(wizard.interface):
case_form = """<?xml version="1.0"?>
<form string="Schedule Phone Call">
<separator string="Phone Call Description" colspan="4" />
<newline />
<field name='user_id' />
<field name='deadline' />
<newline />
<field name='note' colspan="4"/>
<newline />
<field name='section_id' />
<field name='category_id'/>
</form>"""
case_fields = {
'user_id' : {'string' : 'Assign To', 'type' : 'many2one', 'relation' : 'res.users'},
'deadline' : {'string' : 'Planned Date', 'type' : 'datetime'},
'note' : {'string' : 'Goals', 'type' : 'text'},
'category_id' : {'string' : 'Category', 'type' : 'many2one', 'relation' : 'crm.case.categ', 'required' : True},
'section_id' : {'string' : 'Section', 'type' : 'many2one', 'relation' : 'hr.case.section'},
}
def _default_values(self, cr, uid, data, context):
case_obj = pooler.get_pool(cr.dbname).get('hr.applicant')
categ_id=pooler.get_pool(cr.dbname).get('crm.case.categ').search(cr, uid, [('name','=','Outbound')])
case = case_obj.browse(cr, uid, data['id'])
return {
'user_id' : case.user_id and case.user_id.id,
'category_id' : categ_id and categ_id[0] or case.categ_id and case.categ_id.id,
'section_id' : case.section_id and case.section_id.id or False,
'note' : case.description
}
def _doIt(self, cr, uid, data, context):
form = data['form']
pool = pooler.get_pool(cr.dbname)
mod_obj = pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
phonecall_case_obj = pool.get('hr.phonecall')
job_case_obj = pool.get('hr.applicant')
# Select the view
data_obj = pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'hr', 'hr_case_phone_tree_view')
id3 = data_obj._get_id(cr, uid, 'hr', 'hr_case_phone_form_view')
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
for job in job_case_obj.browse(cr, uid, data['ids']):
#TODO : Take other info from job
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
'name' : job.name,
'user_id' : form['user_id'],
'categ_id' : form['category_id'],
'description' : form['note'],
'date' : form['deadline'],
'section_id' : form['section_id'],
'description':job.description,
'partner_id':job.partner_id.id,
'partner_address_id':job.partner_address_id.id,
'partner_phone':job.partner_phone,
'partner_mobile':job.partner_mobile,
'description':job.description,
'date':job.date,
}, context=context)
new_phonecall = phonecall_case_obj.browse(cr, uid, new_phonecall_id)
vals = {}
if not job.case_id:
vals.update({'phonecall_id' : new_phonecall.id})
job_case_obj.write(cr, uid, [job.id], vals)
job_case_obj.case_cancel(cr, uid, [job.id])
phonecall_case_obj.case_open(cr, uid, [new_phonecall_id])
value = {
'name': _('Phone Call'),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'hr.phonecall',
'res_id' : new_phonecall_id,
'views': [(id3,'form'),(id2,'tree'),(False,'calendar'),(False,'graph')],
'type': 'ir.actions.act_window',
'search_view_id': res['res_id']
}
return value
states = {
'init': {
'actions': [_default_values],
'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
'state' : [('end', 'Cancel','gtk-cancel'),('order', 'Schedule Phone Call','gtk-go-forward')]}
},
'order': {
'actions': [],
'result': {'type': 'action', 'action': _doIt, 'state': 'end'}
}
}
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 = """<?xml version="1.0"?>
<form string="Convert To Partner">
<label string="Are you sure you want to create a partner based on this job request ?" colspan="4"/>
<label string="You may have to verify that this partner does not exist already." colspan="4"/>
<!--field name="close"/-->
</form>"""
case_fields = {
'close': {'type':'boolean', 'string':'Close job request'}
}
def _selectPartner(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
case_obj = pool.get('hr.applicant')
for case in case_obj.browse(cr, uid, data['ids']):
if case.partner_id:
raise wizard.except_wizard(_('Warning !'),
_('A partner is already defined on this job request.'))
return {}
def _makeOrder(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, 'base', 'view_res_partner_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
case_obj = pool.get('hr.applicant')
partner_obj = pool.get('res.partner')
contact_obj = pool.get('res.partner.address')
for case in case_obj.browse(cr, uid, data['ids']):
partner_id = partner_obj.search(cr, uid, [('name', '=', case.partner_name or case.name)])
if partner_id:
raise wizard.except_wizard(_('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_name2,
'phone': case.partner_phone,
'mobile': case.partner_mobile,
'email': case.email_from
})
case_obj.write(cr, uid, data['ids'], {
'partner_id': partner_id,
'partner_address_id': contact_id
})
if data['form']['close']:
case_obj.case_close(cr, uid, data['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
states = {
'init': {
'actions': [_selectPartner],
'result': {'type': 'form', 'arch': case_form, 'fields': case_fields,
'state' : [('end', 'Cancel', 'gtk-cancel'),('confirm', 'Create Partner', 'gtk-go-forward')]}
},
'confirm': {
'actions': [],
'result': {'type': 'action', 'action': _makeOrder, 'state': 'end'}
}
}
partner_create('hr.applicant.partner_create')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -192,10 +192,10 @@
<field name="arch" type="xml">
<search string="Search Timesheet">
<group col="10" colspan="4">
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My" default="1"/>
<filter icon="terp-partner" string="My Timesheet" domain="[('user_id','=',uid)]" help="My Timesheets" />
<separator orientation="vertical"/>
<filter icon="terp-crm" string="In Progress" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
<filter icon="terp-crm" string="To Validate" domain="[('state','=','confirmed')]" help="Confirmed Timesheets"/>
<filter icon="terp-crm" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
<filter icon="terp-crm" string="To Validate" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
<separator orientation="vertical"/>
<field name="user_id" select="1" widget="selection"/>
<field name="date_from"/>