[MERGE] merged dev2 branch

bzr revid: qdp-launchpad@tinyerp.com-20101001134123-fnr30iavhwzgy4sa
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-10-01 15:41:23 +02:00
commit a08df47184
95 changed files with 1161 additions and 823 deletions

View File

@ -122,7 +122,7 @@
separator="1" help="Delegated Invitations" />
<separator orientation="vertical"/>
<field name="email" select='1'/>
<field name="user_id" select="1"/>
<field name="user_id" select="1" string="Responsible"/>
<separator orientation="vertical"/>
<field name="cutype" string="Invitation type" select="1"/>
<field name="event_date" select="1"/>

View File

@ -143,34 +143,9 @@
<menuitem
name="Custom Reports" id="base.menu_custom_reports"
groups="base.group_extended"
action="base_report_creator_action" parent="base.reporting_menu" sequence="1"/>
<menuitem
parent="base.next_id_50"
id="menu_base_report_creator_action_config"
action="base_report_creator_action"/>
<record model="ir.ui.view" id="base_report_creator_tree_simple">
<field name="name">base_report_creator.report.simple.tree</field>
<field name="model">base_report_creator.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Reports">
<field name="name"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="base_report_creator_action_tree">
<field name="res_model">base_report_creator.report</field>
<field name="view_type">tree</field>
</record>
<menuitem
name="Custom Reports" parent="base.menu_custom_reports"
id="menu_base_report_creator_action"
action="base_report_creator_action_tree"/>
</data>
</openerp>

View File

@ -72,21 +72,10 @@
<field name="context">{'menu':True}</field>
</record>
<menuitem icon="terp-graph" id="base.reporting_menu"
name="Reporting" sequence="30" />
<menuitem id="base.next_id_50" name="Configuration"
parent="base.reporting_menu" sequence="3" />
<menuitem parent="base.next_id_50" name="Report Designer"
<menuitem parent="base.reporting_menu" name="Report Designer"
action="action_report_designer_wizard"
id="menu_action_report_designer_wizard" sequence="70" />
<menuitem parent="base.next_id_50" name="Modify an existing report"
action="action_view_base_report_sxw"
id="menu_wizard_report_designer_modify" sequence="70" groups="base.group_extended"/>
</data>
</openerp>

View File

@ -24,9 +24,12 @@
"version":"0.1",
"author":"Tiny",
"category":"Generic Modules/Base",
"description": """Synchronization with all objects.""",
"depends":["base"],
"demo_xml":[],
"update_xml":["base_synchro_wizard.xml","base_synchro_view.xml"],
"update_xml":[ "wizard/base_synchro_view.xml",
"base_synchro_view.xml",
"security/ir.model.access.csv",],
"active":False,
"installable":True,
}

View File

@ -42,7 +42,7 @@ class base_synchro_server(osv.osv):
base_synchro_server()
class base_synchro_obj(osv.osv):
'''Class to store the operations done by wizart'''
'''Class to store the operations done by wizard'''
_name = "base.synchro.obj"
_description = "Register Class"
_columns = {
@ -66,6 +66,10 @@ class base_synchro_obj(osv.osv):
#
# Return a list of changes: [ (date, id) ]
#
def get_ids(self, cr, uid, object, dt, domain=[], context={}):
return self._get_ids(cr, uid, object, dt, domain, context)
def _get_ids(self, cr, uid, object, dt, domain=[], context={}):
result = []
if dt:

View File

@ -30,6 +30,37 @@
</field>
</record>
<record id="ir_filters_transfer_line_form" model="ir.ui.view">
<field name="name">base.synchro.obj.line.form</field>
<field name="model">base.synchro.obj.line</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Transfered Ids Details">
<group colspan="4" col="10">
<field name="name"/>
<field name="obj_id"/>
</group>
<newline/>
<group expand="0" string="Group By" colspan="4">
<filter string="Object" icon="terp-stage" domain="[]" context="{'group_by':'obj_id'}"/>
<separator orientation="vertical"/>
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'name'}"/>
</group>
</search>
</field>
</record>
<!-- Filters action-->
<record id="actions_transfer_line_form" model="ir.actions.act_window">
<field name="name">Filters</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.synchro.obj.line</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_transfer_line_tree"/>
<field name="search_view_id" ref="ir_filters_transfer_line_form"/>
</record>
<record id="action_base_synchro_obj_line_tree" model="ir.actions.act_window">
<field name="name">Synchronized instances</field>
@ -56,7 +87,7 @@
<field colspan="4" name="domain"/>
<field name="synchronize_date"/>
<newline/>
<field name="avoid_ids" colspan="4">
<field name="avoid_ids" colspan="4" nolabel="1">
<tree string="Fields" editable="bottom">
<field name="name"/>
</tree>
@ -81,6 +112,37 @@
</field>
</record>
<record id="ir_filters_regclass_tree" model="ir.ui.view">
<field name="name">base.synchro.obj.line.form</field>
<field name="model">base.synchro.obj</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Synchronized objects">
<group colspan="4" col="10">
<field name="model_id"/>
<field name="synchronize_date"/>
</group>
<newline/>
<group expand="0" string="Group By" colspan="4">
<filter string="Object to synchronize" icon="terp-stage" domain="[]" context="{'group_by':'model_id'}"/>
<separator orientation="vertical"/>
<filter string="Latest synchronization" icon="terp-go-month" domain="[]" context="{'group_by':'synchronize_date'}"/>
</group>
</search>
</field>
</record>
<!-- Filters action-->
<record id="actions_regclass_tree" model="ir.actions.act_window">
<field name="name">Filters</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.synchro.obj</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_regclass_tree"/>
<field name="search_view_id" ref="ir_filters_regclass_tree"/>
</record>
<record id="action_transfer_tree" model="ir.actions.act_window">
<field name="name">Synchronized objects</field>
<field name="type">ir.actions.act_window</field>
@ -115,15 +177,15 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Synchronized server">
<field name="name" select="1"/>
<newline/>
<field name="server_url" select="2"/>
<newline/>
<field name="server_port"/>
<field name="server_db"/>
<newline/>
<field name="login" select="1"/>
<field name="password"/>
<group colspan="4" col="6">
<field name="name"/>
<field name="login"/>
<field name="password" password="True"/>
<field name="server_url"/>
<field name="server_port"/>
<field name="server_db"/>
</group>
</form>
</field>
</record>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<wizard id="wizard_cost_account_synchro" model="account.analytic.account" name="account.analytic.account.transfer" string="Synchronize objects"/>
<menuitem id="next_id_62" name="Synchronization" parent="base.menu_administration"/><menuitem action="wizard_cost_account_synchro" id="menu_wizard_cost_account_synchro" parent="base_synchro.next_id_62" type="wizard"/>
</data>
</openerp>

View File

@ -0,0 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"base_synchro_server","base.synchro.server","model_base_synchro_server","base.group_system",1,1,1,1
" base_synchro_obj"," base.synchro.obj","model_base_synchro_obj","base.group_system",1,1,1,1
"base_synchro_obj_avoid","base.synchro.obj.avoid","model_base_synchro_obj_avoid","base.group_system",1,1,1,1
"base_synchro_obj_line","base.synchro.obj.line","model_base_synchro_obj_line","base.group_system",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 base_synchro_server base.synchro.server model_base_synchro_server base.group_system 1 1 1 1
3 base_synchro_obj base.synchro.obj model_base_synchro_obj base.group_system 1 1 1 1
4 base_synchro_obj_avoid base.synchro.obj.avoid model_base_synchro_obj_avoid base.group_system 1 1 1 1
5 base_synchro_obj_line base.synchro.obj.line model_base_synchro_obj_line base.group_system 1 1 1 1

View File

@ -19,4 +19,5 @@
#
##############################################################################
import base_synchro
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
## -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
@ -18,7 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import osv
from datetime import date
import time
@ -27,26 +26,7 @@ import xmlrpclib
import re
import tools
import threading
acc_synchro_form = '''<?xml version="1.0"?>
<form string="Transfer Data To Server">
<field name="server_url" colspan="4"/>
<newline/>
<separator string="Control" colspan="4"/>
<field name="user_id"/>
<newline/>
</form>'''
acc_synchro_fields = {
'server_url': {'string':'Server URL', 'type':'many2one', 'relation':'base.synchro.server','required':True},
'user_id': {'string':'Send Result To', 'type':'many2one', 'relation':'res.users', 'default': lambda uid,data,state: uid},
}
finish_form ='''<?xml version="1.0"?>
<form string="Synchronization Complited!">
<label string="The synchronisation has been started.\nYou will receive a request when it's done." colspan="4"/>
</form>
'''
from osv import osv, fields
class RPCProxyOne(object):
def __init__(self, server, ressource):
@ -66,13 +46,26 @@ class RPCProxy(object):
def get(self, ressource):
return RPCProxyOne(self.server, ressource)
class wizard_cost_account_synchro(wizard.interface):
class base_synchro(osv.osv_memory):
"""Base Synchronization """
_name = 'base.synchro'
_columns = {
'server_url': fields.many2one('base.synchro.server', "Server URL", required=True),
'user_id': fields.many2one('res.users', "Send Result To",),
}
_defaults = {
'user_id': lambda self,cr,uid,context: uid,
}
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
report = []
report_total = 0
report_create = 0
report_write = 0
def _synchronize(self, cr, uid, server, object, context):
def synchronize(self, cr, uid, server, object, context):
pool = pooler.get_pool(cr.dbname)
self.meta = {}
ids = []
@ -80,14 +73,14 @@ class wizard_cost_account_synchro(wizard.interface):
pool2 = pool
#try:
if object.action in ('d','b'):
ids = pool1.get('base.synchro.obj')._get_ids(cr, uid,
ids = pool1.get('base.synchro.obj').get_ids(cr, uid,
object.model_id.model,
object.synchronize_date,
eval(object.domain),
{'action':'d'}
)
if object.action in ('u','b'):
ids += pool2.get('base.synchro.obj')._get_ids(cr, uid,
ids += pool2.get('base.synchro.obj').get_ids(cr, uid,
object.model_id.model,
object.synchronize_date,
eval(object.domain),
@ -109,7 +102,7 @@ class wizard_cost_account_synchro(wizard.interface):
if object.model_id.model=='crm.case.history':
fields = ['email','description','log_id']
value = pool_src.get(object.model_id.model).read(cr, uid, [id], fields)[0]
value = self._data_transform(cr, uid, pool_src, pool_dest, object.model_id.model, value, action)
value = self.data_transform(cr, uid, pool_src, pool_dest, object.model_id.model, value, action)
id2 = self.get_id(cr, uid, object.id, id, action, context)
#
# Transform value
@ -133,7 +126,7 @@ class wizard_cost_account_synchro(wizard.interface):
else:
print value
idnew = pool_dest.get(object.model_id.model).create(cr, uid, value)
synid = pool.get('base.synchro.obj.line').create(cr, uid, {
synid = self.pool.get('base.synchro.obj.line').create(cr, uid, {
'obj_id': object.id,
'local_id': (action=='u') and id or idnew,
'remote_id': (action=='d') and id or idnew
@ -141,25 +134,20 @@ class wizard_cost_account_synchro(wizard.interface):
self.report_total+=1
self.report_create+=1
self.meta = {}
return 'finish'
return True
#
# IN: object and ID
# OUT: ID of the remote object computed:
# If object is synchronised, read the sync database
# Otherwise, use the name_search method
#
def get_id(self, cr, uid, object_id, id, action, context={}):
pool = pooler.get_pool(cr.dbname)
line_pool = pool.get('base.synchro.obj.line')
field_src = (action=='u') and 'local_id' or 'remote_id'
field_dest = (action=='d') and 'local_id' or 'remote_id'
rid = pool.get('base.synchro.obj.line').search(cr, uid, [('obj_id','=',object_id), (field_src,'=',id)], context=context)
rid = line_pool.search(cr, uid, [('obj_id','=',object_id), (field_src,'=',id)], context=context)
result = False
if rid:
result = pool.get('base.synchro.obj.line').read(cr, uid, rid, [field_dest], context=context)[0][field_dest]
result = line_pool.read(cr, uid, rid, [field_dest], context=context)[0][field_dest]
return result
def _relation_transform(self, cr, uid, pool_src, pool_dest, object, id, action, context={}):
def relation_transform(self, cr, uid, pool_src, pool_dest, object, id, action, context={}):
if not id:
return False
pool = pooler.get_pool(cr.dbname)
@ -186,7 +174,14 @@ class wizard_cost_account_synchro(wizard.interface):
print self.report.append('WARNING: Record "%s" on relation %s not found, set to null.' % (names,object))
return result
def _data_transform(self, cr, uid, pool_src, pool_dest, object, data, action='u', context={}):
#
# IN: object and ID
# OUT: ID of the remote object computed:
# If object is synchronised, read the sync database
# Otherwise, use the name_search method
#
def data_transform(self, cr, uid, pool_src, pool_dest, object, data, action='u', context={}):
self.meta.setdefault(pool_src, {})
if not object in self.meta[pool_src]:
self.meta[pool_src][object] = pool_src.get(object).fields_get(cr, uid, context)
@ -201,12 +196,12 @@ class wizard_cost_account_synchro(wizard.interface):
del data[f]
elif ftype == 'many2one':
if data[f]:
df = self._relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], data[f][0], action, context)
df = self.relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], data[f][0], action, context)
data[f] = df
if not data[f]:
del data[f]
elif ftype == 'many2many':
res = map(lambda x: self._relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], x, action, context), data[f])
res = map(lambda x: self.relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], x, action, context), data[f])
data[f] = [(6, 0, res)]
del data['id']
return data
@ -215,21 +210,22 @@ class wizard_cost_account_synchro(wizard.interface):
# Find all objects that are created or modified after the synchronize_date
# Synchronize these obejcts
#
def _upload_download(self, db_name, uid, data, context):
cr = pooler.get_db(db_name).cursor()
def upload_download(self, cr, uid, ids, context):
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
syn_obj = self.browse(cr, uid, ids)[0]
pool = pooler.get_pool(cr.dbname)
server = pool.get('base.synchro.server').browse(cr, uid, data['form']['server_url'], context)
server = pool.get('base.synchro.server').browse(cr, uid, ids, context)[0]
for object in server.obj_ids:
dt = time.strftime('%Y-%m-%d %H:%M:%S')
self._synchronize(cr, uid, server, object, context)
self.synchronize(cr, uid, server, object, context)
if object.action=='b':
time.sleep(1)
dt = time.strftime('%Y-%m-%d %H:%M:%S')
pool.get('base.synchro.obj').write(cr, uid, [object.id], {'synchronize_date': dt})
cr.commit()
self.pool.get('base.synchro.obj').write(cr, uid, [object.id], {'synchronize_date': dt})
end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
if 'user_id' in data['form'] and data['form']['user_id']:
if 'user_id' in syn_obj.user_id:
request = pooler.get_pool(cr.dbname).get('res.request')
if not self.report:
self.report.append('No exception.')
@ -248,32 +244,26 @@ Exceptions:
request.create(cr, uid, {
'name' : "Synchronization report",
'act_from' : uid,
'act_to' : data['form']['user_id'],
'act_to' : syn_obj.user_id,
'body': summary,
})
cr.commit()
cr.close()
return 'finish'
return True
def _upload_download_multi_thread(self, cr, uid, data, context):
threaded_synchronization = threading.Thread(target=self._upload_download, args=(cr.dbname, uid, data, context))
threaded_synchronization.start()
return 'finish'
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':acc_synchro_form, 'fields':acc_synchro_fields, 'state':[('end','Cancel'),('upload_download','Synchronize')]}
},
'upload_download': {
'actions': [],
'result':{'type':'choice', 'next_state': _upload_download_multi_thread}
},
'finish': {
'actions': [],
'result':{'type':'form', 'arch':finish_form,'fields':{},'state':[('end','Ok')]}
},
}
wizard_cost_account_synchro('account.analytic.account.transfer')
def upload_download_multi_thread(self, cr, uid, data, context):
threaded_synchronization = threading.Thread(target=self.upload_download, args=(cr, uid, data, context))
threaded_synchronization.run()
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'base_synchro', 'view_base_synchro_finish')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.synchro',
'views': [(id2, 'form')],
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
}
base_synchro()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_base_synchro" model="ir.ui.view">
<field name="name">Base Synchronization</field>
<field name="model">base.synchro</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Transfer Data To Server">
<field name="server_url" colspan="4"/>
<field name="user_id" default="uid"/>
<newline/>
<separator string="" colspan="4"/>
<button special="cancel" string="_Close" icon="gtk-cancel"/>
<button name="upload_download_multi_thread" string="_Synchronize" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<record id="action_view_base_synchro" model="ir.actions.act_window">
<field name="name">Base Synchronization</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">base.synchro</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="next_id_62" name="Synchronization" parent="base.menu_administration"/>
<record id="view_base_synchro_finish" model="ir.ui.view">
<field name="name">Base Synchronization</field>
<field name="model">base.synchro</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Synchronization Complited!">
<label string="The synchronisation has been started.You will receive a request when it's done." colspan="4"/>
<separator string="" colspan="4"/>
<button special="cancel" string="OK" icon="gtk-ok"/>
</form>
</field>
</record>
<menuitem id="next_id_62" name="Synchronization" parent="base.menu_administration"/>
<menuitem parent="base_synchro.next_id_62" name="Synchronize objects"
action="action_view_base_synchro"
id="menu_action_view_base_synchro" />
</data>
</openerp>

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem id="base.reporting_menu"
parent="base.menu_custom"
name="Reporting" sequence="30" />
<!--Board Note Search View -->
<record id="view_board_note_search" model="ir.ui.view">
<field name="name">board.note.search</field>
@ -23,7 +20,7 @@
</search>
</field>
</record>
<!--Board Note Tree View -->
<record id="view_board_note_tree" model="ir.ui.view">
@ -33,11 +30,11 @@
<field name="arch" type="xml">
<tree string="Notes">
<field name="name"/>
<field name="user_id"/>
<field name="user_id"/>
</tree>
</field>
</record>
<!--Board Note Form View -->
<record id="view_board_note_form" model="ir.ui.view">
@ -113,7 +110,7 @@
</form>
</field>
</record>
<record id="view_board_search" model="ir.ui.view">
<field name="name">board.board.search</field>
<field name="model">board.board</field>
@ -136,19 +133,13 @@
<field name="search_view_id" ref="view_board_search"/>
</record>
<menuitem
id="base.next_id_50"
name="Configuration"
parent="base.reporting_menu"
groups="base.group_system"
sequence="3"/>
<menuitem
action="action_view_board_list_form"
id="menu_view_board_form"
parent="base.next_id_50" sequence="1"/>
id="menu_view_board_form" parent="base.reporting_menu" sequence="1"/>
<menuitem action="action_view_board_note_form"
id="menu_view_board_note_form" parent="base.next_id_50"
id="menu_view_board_note_form"
parent="base.reporting_menu"
sequence="3" groups="base.group_system" />
<act_window context="{'view': active_id}" id="dashboard_open"

View File

@ -145,53 +145,29 @@ class crm_case(object):
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
s = self.get_stage_dict(cr, uid, ids, context=context)
section = self._name
stage = False
stage_pool = self.pool.get('crm.case.stage')
model = self._name
for case in self.browse(cr, uid, ids, context):
if section in s:
st = not context.get('force_domain', False) and case.stage_id.id or False
if st in s[section]:
data = {'stage_id': s[section][st]}
stage = s[section][st]
self.write(cr, uid, [case.id], data)
return stage
def get_stage_dict(self, cr, uid, ids, context=None):
"""This function gives dictionary for stage according to stage levels
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
stage_obj = self.pool.get('crm.case.stage')
res = self.read(cr, uid, ids, ['section_id', 'stage_id'], context)[0]
section_id = res['section_id'] and res['section_id'][0] or False
stage_id = res['stage_id'] and res['stage_id'][0] or False
# We select either the stages in the same section as the current stage
# if it a stage that does not have a section, or the stages of the
# current section of the case
if stage_id:
stage_record = stage_obj.browse(cr, uid, stage_id)
if not stage_record.section_id:
section_id = False # only select stages without section
domain = [('object_id.model', '=', self._name), '|', ('section_id', '=', section_id),('section_id','=',False)]
if 'force_domain' in context and context['force_domain']:
domain += context['force_domain']
sid = stage_obj.search(cr, uid, domain, context=context)
s = {}
previous = {}
section = self._name
for stage in stage_obj.browse(cr, uid, sid, context=context):
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
return s
next_stage = False
data = {}
domain = [('object_id.model', '=', model)]
if case.section_id and case.section_id.stage_ids:
domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids)))
stages = stage_pool.search(cr, uid, domain, order='sequence')
index = -1
if case.stage_id and case.stage_id.id in stages:
index = stages.index(case.stage_id.id)
if index + 1 == len(stages):
return False
else:
next_stage = stages[index + 1]
if next_stage:
data = {'stage_id': next_stage}
stage = stage_pool.browse(cr, uid, next_stage, context=context)
if stage.on_change:
data.update({'probability': stage.probability})
self.write(cr, uid, [case.id], data, context=context)
return next_stage
def stage_previous(self, cr, uid, ids, context=None):
"""This function computes previous stage for case from its current stage
@ -203,21 +179,28 @@ class crm_case(object):
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
s = self.get_stage_dict(cr, uid, ids, context=context)
section = self._name
stage_pool = self.pool.get('crm.case.stage')
model = self._name
for case in self.browse(cr, uid, ids, context):
if section in s:
st = not context.get('force_domain', False) and case.stage_id.id or False
s[section] = dict([(v, k) for (k, v) in s[section].iteritems()])
if st in s[section]:
data = {'stage_id': s[section][st]}
if s[section][st]:
stage = stage_pool.browse(cr, uid, s[section][st], context=context)
if stage.on_change:
data.update({'probability': stage.probability})
self.write(cr, uid, [case.id], data)
prev_stage = False
data = {}
domain = [('object_id.model', '=', model)]
if case.section_id and case.section_id.stage_ids:
domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids)))
stages = stage_pool.search(cr, uid, domain, order='sequence')
index = 0
if case.stage_id and case.stage_id.id in stages:
index = stages.index(case.stage_id.id)
if index == 0:
return False
else:
prev_stage = stages[index - 1]
if prev_stage:
data = {'stage_id': prev_stage}
stage = stage_pool.browse(cr, uid, prev_stage, context=context)
if stage.on_change:
data.update({'probability': stage.probability})
self.write(cr, uid, [case.id], data, context=context)
return True
def onchange_partner_id(self, cr, uid, ids, part, email=False):
@ -492,6 +475,43 @@ class crm_case(object):
return res
class crm_case_stage(osv.osv):
""" Stage of case """
_name = "crm.case.stage"
_description = "Stage of case"
_rec_name = 'name'
_order = "sequence"
_columns = {
'name': fields.char('Stage Name', size=64, required=True, translate=True),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of case stages."),
'object_id': fields.many2one('ir.model', 'Object Name'),
'probability': fields.float('Probability (%)', required=True, help="This percentage depicts the default/average probability of the Case for this stage to be a success"),
'on_change': fields.boolean('Change Probability Automatically', \
help="Change Probability on next and previous stages."),
'requirements': fields.text('Requirements')
}
def _find_object_id(self, cr, uid, context=None):
"""Finds id for case object
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
object_id = context and context.get('object_id', False) or False
ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', object_id)])
return ids and ids[0]
_defaults = {
'sequence': lambda *args: 1,
'probability': lambda *args: 0.0,
'object_id' : _find_object_id
}
crm_case_stage()
class crm_case_section(osv.osv):
"""Sales Team"""
@ -517,7 +537,8 @@ class crm_case_section(osv.osv):
'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Teams'),
'resource_calendar_id': fields.many2one('resource.calendar', "Resource's Calendar"),
'note': fields.text('Description'),
'working_hours': fields.float('Working Hours', digits=(16,2 )),
'working_hours': fields.float('Working Hours', digits=(16,2 )),
'stage_ids':fields.many2many('crm.case.stage', 'section_stage_rel', 'section_id', 'stage_id', 'Stages'),
}
_defaults = {
@ -619,43 +640,6 @@ class crm_case_resource_type(osv.osv):
crm_case_resource_type()
class crm_case_stage(osv.osv):
""" Stage of case """
_name = "crm.case.stage"
_description = "Stage of case"
_rec_name = 'name'
_order = "sequence"
_columns = {
'name': fields.char('Stage Name', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of case stages."),
'object_id': fields.many2one('ir.model', 'Object Name'),
'probability': fields.float('Probability (%)', required=True, help="This percentage depicts the default/average probability of the Case for this stage to be a success"),
'on_change': fields.boolean('Change Probability Automatically', \
help="Change Probability on next and previous stages."),
'requirements': fields.text('Requirements')
}
def _find_object_id(self, cr, uid, context=None):
"""Finds id for case object
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
object_id = context and context.get('object_id', False) or False
ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', object_id)])
return ids and ids[0]
_defaults = {
'sequence': lambda *args: 1,
'probability': lambda *args: 0.0,
'object_id' : _find_object_id
}
crm_case_stage()
def _links_get(self, cr, uid, context=None):
"""Gets links value for reference field
@param self: The object pointer

View File

@ -126,8 +126,8 @@ class crm_lead(crm_case, osv.osv):
'contact_name': fields.char('Contact Name', size=64),
'partner_name': fields.char("Partner Name", size=64),
'optin': fields.boolean('Opt-In'),
'optout': fields.boolean('Opt-Out'),
'optin': fields.boolean('Opt-In', help="If opt-in is checked, this contact has accepted to receive emails."),
'optout': fields.boolean('Opt-Out', help="If opt-out is checked, this contact has refused to receive emails or unsubscribed to a campaign."),
'type':fields.selection([
('lead','Lead'),
('opportunity','Opportunity'),

View File

@ -8,7 +8,6 @@
<field name="name">New</field>
<field eval="'10'" name="probability"/>
<field eval="'1'" name="sequence"/>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
@ -16,7 +15,6 @@
<field name="name">Qualification</field>
<field eval="'20'" name="probability"/>
<field eval="'2'" name="sequence"/>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
@ -24,7 +22,6 @@
<field name="name">Proposition</field>
<field eval="'40'" name="probability"/>
<field eval="'3'" name="sequence"/>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
@ -32,7 +29,6 @@
<field name="name">Negotiation</field>
<field eval="'60'" name="probability"/>
<field eval="'4'" name="sequence"/>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
@ -40,7 +36,6 @@
<field name="name">Win</field>
<field eval="'100'" name="probability"/>
<field eval="'5'" name="sequence"/>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
@ -48,10 +43,15 @@
<field name="name">Lost</field>
<field eval="'0'" name="probability"/>
<field eval="'6'" name="sequence"/>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/>
</record>
<record model="crm.case.section" id="section_sales_department">
<field name="name">Sales Department</field>
<field name="code">Sales</field>
<field name="stage_ids" eval="[(4, ref('stage_lead1')), (4, ref('stage_lead2')), (4, ref('stage_lead3')), (4, ref('stage_lead4')), (4, ref('stage_lead5')), (4, ref('stage_lead6'))]"/>
</record>
<!-- CASE CATEGORY2(category2_id) -->
<record model="crm.case.resource.type" id="type_lead1">
<field name="name">Telesales</field>

View File

@ -8,9 +8,8 @@
<field name="view_mode">tree,form</field>
<field name="domain">['|', ('type','=','lead'), ('type','=',False)]</field>
<field name="view_id" ref="crm_case_tree_view_leads"/>
<field name="context">{"search_default_user_id":uid,'search_default_current':1}</field>
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
<field name="context">{'search_default_current':1, 'default_type': 'lead', 'search_default_section_id':section_id}</field>
<field name="context">{'search_default_current':1, 'default_type': 'lead', 'search_default_section_id': section_id}</field>
<field name="help">A lead is a first, unqualified, contact with a new prospect. Use leads when you import a database of prospects or integrate your website's contact form with OpenERP. After having been qualified, the lead can be converted to a partner and a business opportunity for a further detailed tracking of the related activities.</field>
</record>

View File

@ -55,8 +55,7 @@
<newline />
<field name="section_id" widget="selection" />
<field name="user_id" />
<field name="stage_id"
domain="[('section_id','=',section_id), ('section_id','=',False), ('object_id.model', '=', 'crm.lead')]" />
<field name="stage_id" readonly="1"/>
<group col="2" colspan="1">
<button name="stage_previous" string="Previous"
states="open,pending,draft" type="object"
@ -235,7 +234,7 @@
<field name="referred" invisible="1"/>
<field name="channel_id" invisible="1"/>
<field name="stage_id" />
<field name="stage_id" readonly="1"/>
<button name="stage_previous" string="Previous Stage"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next Stage"
@ -318,7 +317,7 @@
context="{'invisible_section': False}">
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team(s)"/>
<filter icon="terp-personal+"
context="{'invisible_section': False}"
@ -342,8 +341,9 @@
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
<filter string="Referrer" icon="terp-personal" domain="[]" context="{'group_by':'referred'}"/>
<separator orientation="vertical"/>
<filter string="Category" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'categ_id'}"/>
<filter string="Campaign" icon="terp-stock_symbol-selection"
@ -351,11 +351,10 @@
<filter string="Channel" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'channel_id'}" />
<separator orientation="vertical"/>
<filter string="Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
<filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Referrer" icon="terp-personal" domain="[]" context="{'group_by':'referred'}"/>
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Creation Month" icon="terp-go-month"
<filter string="Creation" help="Create date" icon="terp-go-month"
domain="[]" context="{'group_by':'create_date'}" />
</group>
</search>

View File

@ -49,7 +49,7 @@
<field name="res_model">crm.meeting</field>
<field name="view_mode">calendar,tree,form,gantt</field>
<field name="view_id" ref="crm_case_calendar_view_meet"/>
<field name="context">{"search_default_user_id":uid}</field>
<field name="context">{"search_default_user_id":uid, 'search_default_section_id': section_id}</field>
<field name="search_view_id" ref="view_crm_case_meetings_filter"/>
<field name="help">The calendar of meetings is shared between sales teams and fully integrated with the others applications like the employee holidays. You can also synchronize meetings with your mobile phone using the caldav interface.</field>
</record>

View File

@ -312,7 +312,7 @@
<field name="partner_id" select="1" />
<field name="section_id" select="1" widget="selection">
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team(s)" />
</field>
<field name="user_id" select="1"/>

View File

@ -14,8 +14,9 @@
<label string="Stage:" align="1.0"/>
<group colspan="1" col="4">
<field name="stage_id" nolabel="1"
on_change="onchange_stage_id(stage_id)"
domain="['|',('section_id','=',section_id),('section_id','=',False),('object_id.model', '=', 'crm.lead')]" />
on_change="onchange_stage_id(stage_id)"
domain="[('object_id.model', '=', 'crm.lead')]"
readonly="1" />
<button name="stage_previous"
states="open,pending" type="object"
icon="gtk-go-back" string="" />
@ -211,7 +212,7 @@
<field name="model">crm.lead</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done');red:date_deadline and (date_deadline &lt; current_date)">
<tree string="Opportunities" colors="blue:state=='pending' and not(date_deadline and (date_deadline &lt; current_date));gray:state in ('cancel', 'done');red:date_deadline and (date_deadline &lt; current_date)">
<field name="date_deadline" invisible="1"/>
<field name="create_date"/>
<field name="name" string="Opportunity"/>
@ -302,7 +303,7 @@
context="{'invisible_section': False}"
widget="selection">
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
context="{'invisible_section': False}"
help="My Sales Team(s)" />
<filter icon="terp-personal+"

View File

@ -61,9 +61,6 @@ class crm_phonecall(crm_case, osv.osv):
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'stage_id': fields.many2one('crm.case.stage', 'Stage', \
domain="['|',('section_id','=',section_id),('section_id','=',False),\
('object_id.model', '=', 'crm.phonecall')]"),
'date_open': fields.datetime('Opened', readonly=True),
# phonecall fields
'duration': fields.float('Duration', help="Duration in Minutes"),

View File

@ -16,23 +16,5 @@
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
</record>
<!--
Case Stage
-->
<record model="crm.case.stage" id="stage_phone1">
<field name="name">Planned</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_phone2">
<field name="name">Held</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
</record>
<record model="crm.case.stage" id="stage_phone3">
<field name="name">Not Held</field>
<field name="section_id" ref="section_sales_department"/>
<field name="object_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
</record>
</data>
</openerp>

View File

@ -16,7 +16,6 @@
<field eval="&quot;(726) 782-0636&quot;" name="partner_mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_phone1"/>
<field name="stage_id" ref="crm.stage_phone1"/>
<field eval="&quot;(769) 703-274&quot;" name="partner_phone"/>
<field eval="2.3" name="duration"/>
</record>
@ -32,7 +31,6 @@
<field eval="&quot;(392) 895-7917&quot;" name="partner_mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_phone1"/>
<field name="stage_id" ref="crm.stage_phone2"/>
<field eval="&quot;(956) 293-2595&quot;" name="partner_phone"/>
<field eval="1.5" name="duration"/>
</record>
@ -48,7 +46,6 @@
<field eval="&quot;(820) 167-3208&quot;" name="partner_mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_phone1"/>
<field name="stage_id" ref="crm.stage_phone3"/>
<field eval="&quot;(079) 681-2139&quot;" name="partner_phone"/>
<field eval="&quot;contact@tecsas.fr&quot;" name="email_from"/>
<field eval="5.0" name="duration"/>
@ -64,7 +61,6 @@
<field eval="&quot;(077) 582-4035&quot;" name="partner_mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_phone2"/>
<field name="stage_id" ref="crm.stage_phone1"/>
<field eval="&quot;(514) 698-4118&quot;" name="partner_phone"/>
<field eval="3.45" name="duration"/>
</record>
@ -80,7 +76,6 @@
<field eval="&quot;(333) 715-1450&quot;" name="partner_mobile"/>
<field eval="1" name="active"/>
<field name="categ_id" ref="crm.categ_phone2"/>
<field name="stage_id" ref="crm.stage_phone2"/>
<field eval="&quot;(855) 924-4364&quot;" name="partner_phone"/>
<field eval="2.08" name="duration"/>
</record>
@ -96,7 +91,6 @@
<field eval="&quot;(468) 017-2684&quot;" name="partner_mobile"/>
<field eval="time.strftime('%Y-%m-28 14:15:30')" name="date"/>
<field name="categ_id" ref="crm.categ_phone2"/>
<field name="stage_id" ref="crm.stage_phone3"/>
<field eval="&quot;(373) 907-1009&quot;" name="partner_phone"/>
<field eval="&quot;info@opensides.be&quot;" name="email_from"/>
<field eval="8.56" name="duration"/>

View File

@ -31,7 +31,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm_case_phone_tree_view"/>
<field name="context">{"search_default_user_id":uid, 'search_default_section_id':section_id}</field>
<field name="context">{"search_default_user_id":uid, 'search_default_section_id': section_id}</field>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
</record>
@ -67,7 +67,7 @@
<field name="view_mode">tree,calendar</field>
<field name="view_id" ref="crm_case_phone_tree_view"/>
<field name="domain" eval="'[(\'categ_id\',\'=\','+str(ref('categ_phone1'))+')]'"/>
<field name="context" eval="'{\'set_editable\':True,\'default_state\':\'open\', \'search_default_current\':1,\'search_default_today\':1, \'default_categ_id\': ' + str(ref('categ_phone1')) +'}'"/>
<field name="context" eval="'{\'search_default_section_id\':section_id, \'set_editable\':True,\'default_state\':\'open\', \'search_default_current\':1,\'search_default_today\':1, \'default_categ_id\': ' + str(ref('categ_phone1')) +'}'"/>
<field name="search_view_id" ref="crm.view_crm_case_phonecalls_filter"/>
<field name="help">Trace easily all your Inbound calls. The Inbound menu open a search view in editable mode, so you can easily modify or add a new call record. With the actions buttons convert a lead into an opportunity or plan a meeting.</field>

View File

@ -71,7 +71,7 @@
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<label colspan="6" string=""/>
<button string="Schedule Other Call"
icon="gtk-redo"
icon="terp-call-start"
name="%(phonecall_to_phonecall_act)d"
type="action" />
@ -150,7 +150,7 @@
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
<label colspan="6" string=""/>
<button string="Schedule Other Call"
icon="gtk-redo"
icon="terp-call-start"
name="%(phonecall_to_phonecall_act)d"
type="action" />
@ -272,7 +272,7 @@
<field name="section_id"
select="1" widget="selection" string="Sales Team">
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team(s)" />
</field>
<newline/>

View File

@ -48,6 +48,10 @@
<separator string="Team Members" colspan="4"/>
<field name="member_ids" nolabel="1" colspan="4"/>
</page>
<page string="Stages">
<separator string="Select stages for this Sales Team" colspan="4"/>
<field name="stage_ids" colspan="4" nolabel="1"/>
</page>
<page string="Notes">
<field name="note" select="1" colspan="4" nolabel="1"/>
</page>
@ -97,8 +101,6 @@
<field name="sequence"/>
<field name="name"/>
<field name="probability"/>
<field name="section_id"/>
</tree>
</field>
</record>
@ -113,7 +115,6 @@
<form string="Stage">
<separator string="Stage Definition" colspan="4"/>
<field name="name" select="1"/>
<field name="section_id" select="1"/>
<field name="object_id" invisible="1" />
<field name="sequence"/>
<field name="probability"/>

View File

@ -101,9 +101,7 @@ class crm_lead_report(osv.osv):
'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="['|',('section_id','=',False),('section_id','=',section_id)]" , readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="['|',('section_id','=',False),('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]", readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True, domain="('object_id.model', '=', 'crm.lead')]"),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'opening_date': fields.date('Opening Date', readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),

View File

@ -99,13 +99,13 @@
<field name="section_id"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
<filter icon="terp-crm"
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My team" />
</field>
<field name="user_id" string="Salesman">
<filter icon="terp-personal+" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
@ -125,14 +125,16 @@
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="user" icon="terp-personal"
<filter string="Salesman" name="user" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" />
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<separator orientation="vertical" />
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
<separator orientation="vertical" />
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
@ -146,10 +148,6 @@
<filter string="State" icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}" />
<separator orientation="vertical" />
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}" help="Day on which lead/opportunity is created"/>
<filter string="Month" icon="terp-go-month"

View File

@ -100,9 +100,6 @@ class crm_phonecall_report(osv.osv):
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.phonecall')]"),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.phonecall')]", readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'opening_date': fields.date('Opening Date', readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),
@ -130,7 +127,6 @@ class crm_phonecall_report(osv.osv):
c.section_id,
c.categ_id,
c.partner_id,
c.stage_id,
c.duration,
c.company_id,
c.priority,

View File

@ -14,7 +14,6 @@
<field name="month" invisible="1"/>
<field name="section_id" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="stage_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
@ -92,14 +91,14 @@
string="Todo"
domain="[('state','in',('draft','open'))]"
help="Phone calls which are in draft and open state"/>
<filter icon="gtk-media-pause"
string="Not Held"
domain="[('state','=','pending')]"
help="Phone calls which are in pending state"/>
<filter icon="terp-camera_test"
string="Held"
domain="[('state','=','done')]"
help="Phone calls which are in closed state"/>
<filter icon="gtk-media-pause"
string="Not Held"
domain="[('state','=','pending')]"
help="Phone calls which are in pending state"/>
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
@ -110,15 +109,15 @@
help="My team" />
</field>
<field name="user_id" string="Salesman" select="1">
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id"/>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
<field name="categ_id" widget="selection" string="Type"
domain="[('object_id.model', '=', 'crm.phonecall')]" />
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
@ -128,19 +127,16 @@
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="User" icon="terp-personal"
<filter string="Salesman" name="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}" />
<separator orientation="vertical" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" />
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<separator orientation="vertical" />
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<filter string="Type" icon="terp-stock_symbol-selection"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize"
domain="[]" context="{'group_by':'state'}" />
<separator orientation="vertical" />

View File

@ -10,6 +10,17 @@
<field name="name">Sales / User</field>
</record>
<record id="base.group_sale_salesman_personal" context="{'noadmin':True}" model="res.groups">
<field name="name">Sales / User / See Personal Leads</field>
</record>
<record id="crm_rule_personal_lead" model="ir.rule">
<field name="name">Personal Leads</field>
<field ref="model_crm_lead" name="model_id"/>
<field name="domain_force">['|',('user_id','=',user.id),('user_id','=',False)]</field>
<field name="groups" eval="[(4, ref('base.group_sale_salesman_personal'))]"/>
</record>
<record model='ir.ui.menu' id='base.menu_base_partner'>
<field name="groups_id" eval="[(4,ref('base.group_sale_manager')),(4,ref('base.group_sale_salesman'))]"/>
</record>

View File

@ -57,6 +57,7 @@ class crm_send_new_email(osv.osv_memory):
'body': fields.text('Message Body', required=True),
'state': fields.selection(AVAILABLE_STATES, string='Set New State To', required=True),
'attachment_ids' : fields.one2many('crm.send.mail.attachment', 'wizard_id'),
'html': fields.boolean('HTML formatting?', help="Select this if you want to send email with HTML formatting."),
}
def action_send(self, cr, uid, ids, context=None):
@ -79,6 +80,7 @@ class crm_send_new_email(osv.osv_memory):
(x.name, base64.decodestring(x.binary)) for x in obj.attachment_ids
]
subtype = 'plain'
message_id = None
ref_id = None
@ -119,6 +121,9 @@ class crm_send_new_email(osv.osv_memory):
if message_id:
x_headers['References'] = "%s" % (message_id)
if obj.html:
subtype = 'html'
flag = tools.email_send(
email_from,
emails,
@ -126,13 +131,14 @@ class crm_send_new_email(osv.osv_memory):
body,
email_cc=email_cc,
attach=attach,
subtype=subtype,
reply_to=obj.reply_to,
openobject_id=str(case.id),
x_headers=x_headers
)
# if not flag:
# raise osv.except_osv(_('Error!'), _('Unable to send mail. Please check SMTP is configured properly.'))
if not flag:
raise osv.except_osv(_('Error!'), _('Unable to send mail. Please check SMTP is configured properly.'))
msg_dict = {'new': 'Send', 'reply': 'Reply', 'forward': 'Forward'}
case_pool.history(cr, uid, [case], _(msg_dict[context.get('mail', 'new')]), history=True, \

View File

@ -16,6 +16,7 @@
<field name="email_to" />
<field name="email_cc"/>
<field name="subject"/>
<field name="html"/>
</group>
<notebook colspan="6">
<page string="Message">

View File

@ -70,7 +70,7 @@ class crm_claim(crm.crm_case, osv.osv):
'partner_name': fields.char("Employee's Name", size=64),
'partner_mobile': fields.char('Mobile', size=32),
'partner_phone': fields.char('Phone', size=32),
'stage_id': fields.many2one ('crm.case.stage', 'Stage'),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="('object_id.model', '=', 'crm.claim')]"),
'probability': fields.float('Probability (%)'),
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\

View File

@ -71,6 +71,11 @@
<field name="section_id" ref="crm.section_sales_department"/>
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
</record>
<record model="crm.case.section" id="crm.section_sales_department">
<field name="name">Sales Department</field>
<field name="code">Sales</field>
<field name="stage_ids" eval="[(4, ref('stage_claim1')), (4, ref('stage_claim2')), (4, ref('stage_claim3')), (4, ref('stage_claim4')), (4, ref('stage_claim5'))]"/>
</record>
</data>
</openerp>

View File

@ -14,7 +14,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,calendar,form,graph</field>
<field name="view_id" ref="crm_case_claims_tree_view"/>
<field name="context">{"search_default_section_id":section_id,"search_default_current":1,"search_default_user_id":uid}</field>
<field name="context">{'search_default_section_id': section_id, "search_default_current":1,"search_default_user_id":uid}</field>
<field name="search_view_id" ref="crm_claim.view_crm_case_claims_filter"/>
<field name="help">Record and trace your customers' claims here. A claim is defined by a client name, several types, a status and a priority level. A claim can also be a preventive or repairing action. A claim can be linked to a reference like a sales order, or a lot. You can send emails with attachments and get the history of the claim treatment (emails send, interventions type, etc.). </field>
</record>

View File

@ -42,7 +42,7 @@
<field name="model">crm.claim</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Claims" colors="blue:state=='pending';black:state=='open';gray:state in ('close', 'cancel');red:date_deadline and (date_deadline &lt; current_date)">
<tree string="Claims" colors="blue:state=='pending' and not(date_deadline and (date_deadline &lt; current_date));gray:state in ('close', 'cancel');red:date_deadline and (date_deadline &lt; current_date)">
<field name="name"/>
<field name="partner_id"/>
<field name="user_id" />
@ -109,9 +109,9 @@
<field name="section_id" widget="selection"/>
<label string="Stage: " align="1.0"/>
<group colspan="1" col="3">
<field name="stage_id" nolabel="1"
<field name="stage_id" nolabel="1" readonly="1"
on_change="onchange_stage_id(stage_id)"
domain="[('section_id','=',section_id), ('object_id.model', '=', 'crm.claim')]" />
domain="[('object_id.model', '=', 'crm.claim')]" />
<button name="stage_previous" string="" type="object" icon="gtk-go-back" />
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
@ -274,7 +274,11 @@
help="Unassigned Claims" />
</field>
<field name="section_id" select="1"
widget="selection"/>
widget="selection">
<filter icon="terp-personal+"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My section" />
</field>
<newline/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-partner"

View File

@ -62,9 +62,7 @@ class crm_claim_report(osv.osv):
'create_date': fields.datetime('Create Date', readonly=True),
'day': fields.char('Day', size=128, 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),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.claim')]", readonly=True),

View File

@ -101,7 +101,7 @@
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id" string="Sales Team"
<field name="section_id" string="Sales Team"
default="context.get('section_id', False)"
context="{'invisible_section': False}">
@ -118,9 +118,9 @@
help="My company"/>
</field>
<field name="user_id" string="Salesman" select="1">
<filter icon="terp-personal+" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field>
<field name="user_id" string="Salesman" select="1">
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
@ -141,7 +141,7 @@
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="User" icon="terp-personal"
<filter string="Salesman" name="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"

View File

@ -61,9 +61,7 @@ class crm_fundraising(crm.crm_case, osv.osv):
'partner_name2': fields.char('Employee Email', 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="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.fundraising')]"),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="('object_id.model', '=', 'crm.fundraising')]"),
'type_id': fields.many2one('crm.case.resource.type', 'Campaign', \
domain="[('section_id','=',section_id)]"),
'duration': fields.float('Duration'),

View File

@ -13,7 +13,7 @@
<field name="res_model">crm.fundraising</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="crm_fundraising.crm_case_tree_view_fund"/>
<field name="context">{"search_default_user_id":uid,"search_default_current":1}</field>
<field name="context">{"search_default_user_id":uid,"search_default_current":1, 'search_default_section_id': section_id}</field>
<field name="search_view_id" ref="crm_fundraising.view_crm_case_fund_filter"/>
<field name="help">When you wish to support your organization or a campaign, trace here all your activities for collecting money. The menu open a search list where you can find funds description, email, history, probability of success. Several actions buttons allows you to easily modify your different fund status.</field>
</record>

View File

@ -89,7 +89,7 @@
<field name="user_id" string="Responsible"/>
<field name="date"/>
<field name="categ_id" select="1" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
<field name="type_id" string="Payment Mode" select="1" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
<field name="type_id" string="Payment Mode" select="1" widget="selection"/>
</group>
<notebook colspan="4">
<page string="Funds">
@ -274,7 +274,7 @@
</field>
<field name="section_id" select="1" widget="selection" string="Sales Team">
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My section" />
</field>
</group>

View File

@ -118,7 +118,7 @@
</field>
<field name="user_id" select="1" string="Salesman">
<filter icon="terp-personal+" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
@ -138,7 +138,7 @@
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="User" icon="terp-personal"
<filter string="Salesman" name="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Sales Team" icon="terp-personal+"

View File

@ -11,7 +11,7 @@
<field name="res_model">crm.helpdesk</field>
<field name="view_mode">tree,calendar,form</field>
<field name="view_id" ref="crm_case_tree_view_helpdesk"/>
<field name="context">{"search_default_user_id":uid}</field>
<field name="context">{"search_default_user_id":uid, 'search_default_section_id': section_id}</field>
<field name="search_view_id" ref="view_crm_case_helpdesk_filter"/>
<field name="help">Alike records and processing of claims, Helpdesk and Support is a good tool to trace your interventions. This menu is more adapted to an oral communication, which is not necessarily related to a claim. Select a customer, add notes and categorize your interventions with a channel and a priority level.</field>
</record>

View File

@ -249,7 +249,7 @@
<field name="user_id" select="1" widget="selection"/>
<field name="section_id" select="1" widget="selection" string="Sales Team">
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
domain="['|', ('section_id', '=', context.get('section_id')), '|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My section" />
</field>
<newline/>

View File

@ -114,23 +114,24 @@
help="My company"/>
</field>
<field name="user_id" string="Salesman">
<filter icon="terp-personal+" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
<filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<filter string="Priority" icon="terp-rating-rated"
domain="[]" context="{'group_by':'priority'}" />
<field name="priority" string="Priority"/>
<field name="categ_id"/>
<field name="date_closed" string="Close Date"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" icon="terp-personal"
<filter string="Salesman" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}"
default="1" />
<filter string="Sales Team" icon="terp-personal+"
domain="[]"
context="{'group_by':'section_id'}" />
<filter string="Partner" icon="terp-personal"
<filter string="Partner" icon="terp-partner"
domain="[]"
context="{'group_by':'partner_id'}" />

View File

@ -63,9 +63,7 @@ class crm_lead_report_assign(osv.osv):
'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id)]" , readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]", readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="('object_id.model', '=', 'crm.lead')]"),
'partner_id': fields.many2one('res.partner', 'Customer' , readonly=True),
'opening_date': fields.date('Opening Date', readonly=True),
'creation_date': fields.date('Creation Date', readonly=True),

View File

@ -45,7 +45,7 @@
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="user" icon="terp-personal"
<filter string="Salesman" name="user" icon="terp-personal"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_assigned_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />

View File

@ -24,7 +24,7 @@
</field>
</record>
<record model="ir.actions.act_window" id="action_decimal_precision_form">
<field name="name">Decimal Accuracy Definitions</field>
<field name="name">Decimal Accuracy</field>
<field name="res_model">decimal.precision</field>
</record>
<menuitem

View File

@ -58,14 +58,6 @@
</search>
</field>
</record>
<record id="open_module_tree_department_tree" model="ir.actions.act_window">
<field name="name">Departments</field>
<field name="res_model">hr.department</field>
<field name="view_type">tree</field>
<field name="domain">[('parent_id','=',False)]</field>
<field name="search_view_id" ref="view_department_filter"/>
</record>
<menuitem action="open_module_tree_department_tree" id="menu_department_tree" parent="base.menu_users"/>
<record id="open_module_tree_department" model="ir.actions.act_window">
<field name="name">Departments</field>
@ -75,10 +67,9 @@
<field name="help">Your Company's Departments Structure is used to manage all documents related to employees by departments: expenses and timesheet validation, leaves management, recruitements, etc.</field>
</record>
<menuitem action="open_module_tree_department" id="menu_department_def" parent="hr.menu_department_tree"/>
<menuitem action="open_module_tree_department" id="menu_hr_department_tree" parent="hr.menu_hr_management" sequence="6"/>
<record model="ir.ui.view" id="view_users_form_inherit">
<record model="ir.ui.view" id="view_users_form_inherit">
<field name="name">res.users.form</field>
<field name="type">form</field>
<field name="model">res.users</field>

View File

@ -9,11 +9,11 @@
<field eval="time.strftime('%Y-%m-%d', time.localtime(time.mktime(time.localtime()[0:2] + (0,)*7)-1))" name="date_to"/>
</record>
<record id="sheet1" model="hr_timesheet_sheet.sheet">
<!-- record id="sheet1" model="hr_timesheet_sheet.sheet">
<field name="name">Sheet 1</field>
<field name="user_id" ref="base.user_root"/>
<field eval="time.strftime('%Y-%m-%d')" name="date_current"/>
</record>
</record-->
</data>
</openerp>

View File

@ -34,6 +34,7 @@
"mail_gateway_view.xml",
"res_partner_view.xml",
'security/ir.model.access.csv'
],
'demo_xml': [],
'installable': True,

View File

@ -179,6 +179,50 @@ class mailgate_message(osv.osv):
'''
Mailgateway Message
'''
def open_document(self, cr, uid, ids, context):
""" To Open Document
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID of messages
@param context: A standard dictionary
"""
action_data = False
if ids:
message_id = ids[0]
mailgate_data = self.browse(cr, uid, message_id)
model = mailgate_data.model
res_id = mailgate_data.res_id
action_pool = self.pool.get('ir.actions.act_window')
action_ids = action_pool.search(cr, uid, [('res_model', '=', model)])
if action_ids:
action_data = action_pool.read(cr, uid, action_ids[0], context=context)
action_data.update({
'res_id': res_id,
'nodestroy': True
})
return action_data
def open_attachment(self, cr, uid, ids, context):
""" To Open attachments
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID of messages
@param context: A standard dictionary
"""
action_data = False
action_pool = self.pool.get('ir.actions.act_window')
action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')])
if action_ids:
action_data = action_pool.read(cr, uid, action_ids[0], context=context)
action_data.update({
'domain': [('res_id','in',ids),('res_model','=',self._name)],
'nodestroy': True
})
return action_data
def truncate_data(self, cr, uid, data, context=None):
data_list = data and data.split('\n') or []
if len(data_list) > 3:
@ -547,3 +591,5 @@ class mailgate_tool(osv.osv_memory):
return res
mailgate_tool()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -2,11 +2,11 @@
<openerp>
<data>
<record model="ir.ui.view" id="view_mailgate_message_form">
<field name="name">mailgate.message.form</field>
<field name="name">mailgate.message.form</field>
<field name="model">mailgate.message</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="mailgate message">
<form string="mailgate message">
<group colspan="4" col="6">
<field name="name" string="Subject" required="1" select="1" widget="char" size="512"/>
<field name="date" required="1" select="1"/>
@ -24,10 +24,13 @@
</group>
<group col="2" colspan="2">
<separator string="Message Details" colspan="4"/>
<field name="model" readonly="1"/>
<field name="model" readonly="1"/>
<group col="3" colspan="2">
<field name="res_id" readonly="1"/>
<field name="message_id" />
<field name="ref_id" />
<button name="open_document" string="Open Document" type="object" icon="gtk-jump-to"/>
</group>
<field name="message_id" />
<field name="ref_id" />
</group>
<separator string="Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4" />
@ -53,6 +56,8 @@
<field name="user_id" string="Owner"/>
<field name="message_id" string="Message" invisible="1"/>
<field name="partner_id" invisible="1"/>
<button name="open_document" string="Open Document" type="object" icon="gtk-jump-to"/>
<button name="open_attachment" string="Open Attachments" type="object" icon="gtk-jump-to"/>
</tree>
</field>
</record>
@ -66,12 +71,12 @@
<field name="name" string="Subject"/>
<field name="date" />
<field name="user_id" string="Owner" default="uid"/>
<field name="description" />
<field name="partner_id" string="Partner Name"/>
<newline/>
<group expand="0" string="Group By..." groups="base.group_extended">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Owner" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Owner" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Thread" icon="terp-mail-" domain="[]" context="{'group_by':'message_id'}"/>
<separator orientation="vertical"/>
<filter string="Month" help="Creation Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
@ -191,7 +196,6 @@
view_id="view_mailgate_message_tree"
/>
<menuitem name="Emails" id="menu_base_config_mail"
parent="base.menu_base_partner" sequence="5" />
@ -201,6 +205,11 @@
action="mail_gateway.action_view_mailgate_message"
/>
<act_window
id="act_res_partner_open_email" name="Attachments"
res_model="ir.attachment"
src_model="mailgate.message"
domain="[('res_id', '=', res_id),('res_model','=',model)]"/>
</data>
</openerp>

View File

@ -1 +1,2 @@
python addin.py
pause

View File

@ -1 +1,2 @@
python addin.py --unregister
pause

View File

@ -162,7 +162,8 @@ hwndChk_list=[]
global search_text
search_text='search_text'
global partner_ref
partner_ref = ''
global name
name=''
global email
@ -774,13 +775,6 @@ def CreateContact(btnProcessor,*args):
return
partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
sel = win32gui.SendMessage(combo, win32con.CB_GETCURSEL)
state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
coun_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
country_sel = win32gui.SendMessage(coun_combo, win32con.CB_GETCURSEL)
name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
office_no = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
@ -795,6 +789,7 @@ def CreateContact(btnProcessor,*args):
return
res = {
'partner_id':ustr(partner),
'name':ustr(name),
'email':ustr(email),
'phone':ustr(office_no),
@ -806,37 +801,8 @@ def CreateContact(btnProcessor,*args):
'zip':ustr(zip)
}
fs_id = c_id = -1
if not state_sel == -1 :
try:
temp = NewConn.GetAllState()
i = -1
for t in temp:
i+=1
if i == state_sel:
fs_id = t[0]
break;
res ['state_id'] = fs_id
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "New Partner", flag_error)
pass
if not country_sel == -1 :
try:
temp = NewConn.GetAllCountry()
i = -1
for t in temp:
i+=1
if i == country_sel:
c_id = t[0]
break;
res ['country_id'] = c_id
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
try:
id = NewConn.CreateContact(sel, str(res))
id = NewConn.CreateContact(str(res))
if not partner:
msg="New contact created."
else:
@ -848,9 +814,6 @@ def CreateContact(btnProcessor,*args):
win32ui.MessageBox(msg, "Create Contact", flag_info)
for i in range(0,9):
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], '')
win32gui.SendMessage(combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(state_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(coun_combo, win32con.CB_SETCURSEL, -1 )
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
def SetAllText(txtProcessor,*args):
@ -929,6 +892,8 @@ def SetDefaultContact(txtProcessor,*args):
global name
global email
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1],partner_ref)
if txtProcessor.init_done:
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
@ -941,12 +906,9 @@ def SetDefaultContact(txtProcessor,*args):
except Exception,e:
pass
fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[1])
c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[2])
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
txtProcessor.init_done = True
def setCheckList(groupProcessor,*args):
@ -1043,6 +1005,8 @@ def set_search_text(dialogProcessor,*args):
def set_name_email(dialogProcessor,*args):
global name
global email
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], ustr(partner_ref))
name = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[0])
email = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[1])
@ -1051,6 +1015,8 @@ def GetDefaultEmail(txtProcessor,*args):
from win32com.client import Dispatch
import win32con
b = check()
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0], ustr(partner_ref))
if not b:
return
#Acquiring control of the text box
@ -1070,96 +1036,67 @@ def GetDefaultEmail(txtProcessor,*args):
win32ui.MessageBox("Error In reading email ID from Email ","Open Contact", flag_error)
pass
win32gui.SendMessage(search_partner_box, win32con.WM_SETTEXT, 0, search_partner_text)
fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[10])
c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[11])
partner_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[0])
if search_partner_text.strip() == "":
search_partner_text = None
return
vals = []
#Searching the res.partner.address for contact based on Sender Mail ID.
vals = NewConn.SearchPartnerDetail(search_partner_text)
#If no user Found.
if vals == None:
for i in range(1,10):
for i in range(1,12):
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
return
else:
#If user Found than Setting the Value for the contact in fields.
for i in range(1,10):
for i in range(1,12):
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
for val in vals:
if val[0] == 'partner_id':
temp = list (NewConn.GetPartners())
i = -1
for t in temp:
i+=1
if t[1] == val[1][1] :
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0], ustr(val[1][1]))
if val[0] == 'name' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1], ustr(val[1]))
if val[0] == 'street' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], ustr(val[1]))
if val[0] == 'street2' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3], ustr(val[1]))
if val[0] == 'zip' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[9], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[9], ustr(val[1]))
if val[0] == 'city' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[4], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[4], ustr(val[1]))
if val[0] == 'state_id' and val[1] != False :
id = i = -1
temp = list(NewConn.GetAllState())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[10], ustr(val[1][1]))
if val[0] == 'country_id' and val[1] != False :
id = i = -1
temp = list(NewConn.GetAllCountry())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[11], ustr(val[1][1]))
if val[0] == 'phone' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[5], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[5], ustr(val[1]))
if val[0] == 'mobile' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[6], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[6], ustr(val[1]))
if val[0] == 'fax' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[7], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[7], ustr(val[1]))
if val[0] == 'email' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[8], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[8], ustr(val[1]))
txtProcessor.init_done=True
def SearchPartner(btnProcessor,*args):
b = check()
global partner_ref
if not b:
return
#hwnd For the List box
fs_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
c_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[12])
partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
try :
search_partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_partner:
@ -1170,79 +1107,51 @@ def SearchPartner(btnProcessor,*args):
vals = NewConn.SearchPartnerDetail(search_partner)
#if contact not found resetting all field to blank
if vals == None:
for i in range(2,11):
for i in range(1,13):
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<enter new search>")
return
#if contact found than setting the values for the contact.
else:
for i in range(2,11):
for i in range(1,13):
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
for val in vals:
if val[0] == 'partner_id':
#Finding the partner index in list and setting it.
temp = list (NewConn.GetPartners())
i = -1
for t in temp:
i+=1
if t[1] == val[1][1] :
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1], ustr(val[1][1]))
if val[0] == 'name' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], ustr(val[1]))
if val[0] == 'street' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3], ustr(val[1]))
if val[0] == 'street2' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4], ustr(val[1]))
if val[0] == 'zip' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10], ustr(val[1]))
if val[0] == 'city' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5], ustr(val[1]))
if val[0] == 'state_id' and val[1] != False :
#Finding the state index in list and setting it.
id = i = -1
temp = list(NewConn.GetAllState())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11], ustr(val[1][1]))
if val[0] == 'country_id' and val[1] != False :
#Finding the country index in list and setting it.
id = i = -1
temp = list(NewConn.GetAllCountry())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[12], ustr(val[1][1]))
if val[0] == 'phone' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6], ustr(val[1]))
if val[0] == 'mobile' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7], ustr(val[1]))
if val[0] == 'fax' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8], ustr(val[1]))
if val[0] == 'email' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9], ustr(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<Enter new search>")
except Exception,e:
@ -1253,6 +1162,7 @@ def SearchPartner(btnProcessor,*args):
def WritePartner(btnProcessor,*args):
new_vals=[]
#Reading new value of the fields.
partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
contect_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
@ -1262,70 +1172,14 @@ def WritePartner(btnProcessor,*args):
fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
country_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
country_sel = win32gui.SendMessage(country_combo, win32con.CB_GETCURSEL)
state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
partner_sel = win32gui.SendMessage(partner_combo, win32con.CB_GETCURSEL)
#Checking that record not being saved without name or Partner
if contect_name.strip() == "":
win32ui.MessageBox("Please enter partner Contact Name name.", "Open Contact", flag_excl)
return
if partner_sel < 1:
win32ui.MessageBox("Please Select Partner From list.", "Open Contact", flag_excl)
return
fs_id = c_id = p_id = -1
#Finding the partner index in list finding it record ID.
if not partner_sel < 0 :
try:
temp = NewConn.GetPartners()
i = -1
for t in temp:
i+=1
if i == partner_sel:
p_id = t[0]
break;
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
#Finding the State index in list finding it record ID.
if not state_sel == -1 :
try:
temp = NewConn.GetAllState()
i = -1
for t in temp:
i+=1
if i == state_sel:
fs_id = t[0]
break;
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
#Finding the country index in list finding it record ID.
if not country_sel == -1 :
try:
temp = NewConn.GetAllCountry()
i = -1
for t in temp:
i+=1
if i == country_sel:
c_id = t[0]
break;
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
# Creating a list to write the values to the OpenERP
new_vals.append(['partner_id',p_id])
new_vals.append(['partner',partner])
new_vals.append(['name',contect_name])
new_vals.append(['street',street])
new_vals.append(['street2',street2])
new_vals.append(['city',city])
new_vals.append(['state_id',fs_id])
new_vals.append(['country_id',c_id])
new_vals.append(['phone',phone])
new_vals.append(['mobile',mobile])
new_vals.append(['email',email])
@ -1346,6 +1200,80 @@ def WritePartner(btnProcessor,*args):
elif flag == -1:
win32ui.MessageBox("Contact can not be Save.\nFirst select contact using Search.","Open Contact", flag_info)
def SetPartnerNameColumn(listProcessor,*args):
hwndList = listProcessor.GetControl()
child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
# set header row
lvc = LVCOLUMN(
mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
)
lvc.fmt = commctrl.LVCFMT_LEFT
lvc.iSubItem = 1
lvc.text = "Partner Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
listProcessor.init_done = True
def SelectPartnerFromList(btnProcessor,*args):
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
sel_text = ''
if sel_count == 1:
sel=-1
for i in range(0,sel_count):
sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, sel, commctrl.LVNI_SELECTED)
buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
size = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
sel_text = ''
for n in extra:
nombre = n.tostring()
sel_text = nombre[0:size]
global partner_ref
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid Partner Selected.","Search Partner")
return
try:
partner_ref = str(sel_text)
except Exception,e:
pass
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
return
elif sel_count < 1:
win32ui.MessageBox("You should Select atleast one partner.","Search Partner")
return
else:
win32ui.MessageBox("Multiple Selection is not allowded.","Search Partner")
return
def SearchPartnerList(btnProcessor,*args):
b = check()
if not b:
return
try :
search_partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_partner:
win32ui.MessageBox("Please enter Partner name to search for.", "Search Partner", flag_excl)
return
#Searching the contact.
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
partners = list(NewConn.GetPartners(search_partner))
win32gui.SendMessage(hwndList, commctrl.LVM_DELETEALLITEMS)
if not partners:
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],"<enter text to search>")
win32ui.MessageBox("No Partner found with name {0}.".format(search_partner),"Search Partner",flag_error)
for partner in partners:
num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
item = LVITEM(text=partner[1],iItem = num_items)
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
except Exception,e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Search Partner", flag_error)
pass
dialog_map = {
@ -1399,13 +1327,10 @@ dialog_map = {
),
"IDD_NEW_CONTACT_DIALOG" : (
(PartnersComboProcessor, "ID_PARTNER_DROPDOWNLIST", GetConn, ()),
(CountryComboProcessor, "ID_COUNTRY_DROPLIST", GetConn, ()),
(StateComboProcessor, "ID_FED_STATE_DROPLIST", GetConn, ()),
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_DROPDOWNLIST ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST", CreateContact, ()),
(TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST" , SetDefaultContact, ()),
(DialogCommand, "ID_NEW_PARTNER_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT", "IDD_NEW_PARTNER_DIALOG", set_name_email, ()),
(CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_TEXT", CreateContact, ()),
(TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_PARTNER_TEXT" , SetDefaultContact, ()),
(DialogCommand, "ID_NEW_PARTNER_BUTTON", "IDD_SELECT_PARTNER"),
),
"IDD_NEW_PARTNER_DIALOG" : (
@ -1414,14 +1339,18 @@ dialog_map = {
),
"IDD_VIEW_PARTNER_DIALOG" : (
(PartnersComboProcessor, "ID_PARTNER_DROPLIST", GetConn, ()),
(StateComboProcessor, "ID_ALL_STATE_DROPDOWNLIST", GetConn, ()),
(CountryComboProcessor, "ID_ALL_COUNTRY_DROPDOWNLIST", GetConn, ()),
(TextProcessor, "IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", GetDefaultEmail, ()),
(CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", SearchPartner, ()),
(CommandButtonProcessor, "IDPB_WRITE_CHANGES ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
(TextProcessor, "IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", GetDefaultEmail, ()),
(CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", SearchPartner, ()),
(CommandButtonProcessor, "IDPB_WRITE_CHANGES IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_STATE IDET_PARTNER_COUNTRY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
(CloseButtonProcessor, "IDCANCEL"),
(DialogCommand, "ID_NEW_PART_BUTTON", "IDD_NEW_PARTNER_DIALOG" ),
(DialogCommand, "ID_NEW_PART_BUTTON", "IDD_SELECT_PARTNER" ),
(DialogCommand, "IDPB_NEWPARTNER_BUTTON" , "IDD_NEW_CONTACT_DIALOG")
),
"IDD_SELECT_PARTNER" : (
(CloseButtonProcessor, "IDCANCEL"),
(ListBoxProcessor, "IDC_LIST_PARTNER" ,SetPartnerNameColumn, ()),
(CommandButtonProcessor, "IDPB_PARTNER_SEARCH IDET_PARTNER_SEARCH_NAME IDC_LIST_PARTNER", SearchPartnerList,()),
(CommandButtonProcessor, "IDPB_SELECT_PARTNER IDC_LIST_PARTNER IDD_SELECT_PARTNER" , SelectPartnerFromList,()),
(DialogCommand, "IDPB_CREATE_NEW_PARTNER" , "IDD_NEW_PARTNER_DIALOG")
),
}

View File

@ -156,6 +156,9 @@
#define IDPB_WRITE_CHANGES 2059
#define ID_ALL_STATE_DROPDOWNLIST 2060
#define ID_ALL_COUNTRY_DROPDOWNLIST 2061
#define IDET_PARTNER_STATE 2062
#define IDET_PARTNER_COUNTRY 2063
#define IDET_PARTNER 2064
//
#define ID_STREET_TEXT 2062
#define ID_STREET2_TEXT 2063
@ -167,6 +170,13 @@
#define ID_PARTNER_DROPLIST 2069
#define ID_NEW_PART_BUTTON 2070
#define IDPB_NEWPARTNER_BUTTON 2071
#define IDD_SELECT_PARTNER 2073
#define IDC_LIST_PARTNER 2072
#define IDPB_SELECT_PARTNER 2075
#define IDET_PARTNER_SEARCH_NAME 2076
#define IDPB_PARTNER_SEARCH 2077
#define IDPB_CREATE_NEW_PARTNER 2078
#define ID_PARTNER_TEXT 2079
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED

File diff suppressed because one or more lines are too long

View File

@ -111,7 +111,7 @@ EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Push to OpenERP"
FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
GROUPBOX " Link to an Existing Documents ", IDC_STATIC_GROUP, 8,5,250,290,WS_TABSTOP
GROUPBOX "Link to an Existing Documents ", IDC_STATIC_GROUP, 8,5,250,290,WS_TABSTOP
LTEXT "Search for : ",IDC_STATIC,15,17,40,12
EDITTEXT ID_SEARCH_TEXT,60,15,120,12,ES_AUTOHSCROLL | WS_TABSTOP// left top width height
PUSHBUTTON "Search",ID_SEARCH,187,15,40,14,WS_TABSTOP
@ -131,7 +131,7 @@ BEGIN
PUSHBUTTON "Close",IDCANCEL,385,300,60,14,WS_TABSTOP
END
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 190
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 150
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Create a New Contact"
@ -139,26 +139,23 @@ FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
LTEXT "Select Partner : ",IDC_STATIC,13,20,50,17
COMBOBOX ID_PARTNER_DROPDOWNLIST, 70, 18, 200, 80 ,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "New Partner",ID_NEW_PARTNER_BUTTON,280,17,55,14, WS_TABSTOP
EDITTEXT ID_PARTNER_TEXT, 70, 18, 200, 12 , ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PARTNER_BUTTON,280,17,60,14, WS_TABSTOP
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,125
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,90
LTEXT "Contact Name : ",IDC_STATIC, 18, 53, 100, 17
EDITTEXT ID_CONTACT_NAME_TEXT, 76, 52, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Street : ",IDC_STATIC, 18, 67, 40, 17
EDITTEXT ID_STREET_TEXT, 76, 66, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Street2 : ",IDC_STATIC, 18, 81, 40, 17
EDITTEXT ID_STREET2_TEXT, 76, 80, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Zip : ",IDC_STATIC,18, 94, 50, 17
LTEXT "Zip : ",IDC_STATIC, 18, 94, 50, 17
EDITTEXT ID_ZIP_TEXT,76, 93, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "City : ",IDC_STATIC,18,108,50,17
LTEXT "City : ",IDC_STATIC, 18,106, 50, 17
EDITTEXT ID_PARTNER_CITY_TEXT,76,107,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Fed. State : ",IDC_STATIC, 18, 123, 40, 17
COMBOBOX ID_FED_STATE_DROPLIST, 76, 122, 100, 80,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
LTEXT "Country : ",IDC_STATIC, 18, 137, 40, 17
COMBOBOX ID_COUNTRY_DROPLIST, 76, 136, 100, 80,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 125
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 90
LTEXT "Office : ",IDC_STATIC,194, 53, 30, 17
EDITTEXT ID_CONTACT_OFFICE_TEXT, 224, 52, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Mobile : ",IDC_STATIC,194, 67, 30, 17
@ -168,8 +165,8 @@ BEGIN
LTEXT "Email : ",IDC_STATIC, 194, 95, 30, 17
EDITTEXT ID_CONTACT_EMAIL_TEXT, 224, 94, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,290,170,45,14, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,170,45,14, WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,290,130,45,14, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,130,45,14, WS_TABSTOP
END
IDD_NEW_PARTNER_DIALOG DIALOGEX 0, 0, 140,40
@ -192,11 +189,11 @@ FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Email ID : ",IDC_STATIC,32,17,40,12
EDITTEXT IDET_SEARCH_PARTNER, 70, 15, 200, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search Partner ",IDPB_SEARCH_PARTNER,280,15,60,14,WS_TABSTOP
PUSHBUTTON "Search Contact ",IDPB_SEARCH_PARTNER,280,15,60,14,WS_TABSTOP
LTEXT "Partner Name : ",IDC_STATIC,13,42,50,17
COMBOBOX ID_PARTNER_DROPLIST, 70, 42, 200, 80 ,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "New Partner",ID_NEW_PART_BUTTON,280,41,60,14, WS_TABSTOP
EDITTEXT IDET_PARTNER,70, 42, 200, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PART_BUTTON,280,41,60,14, WS_TABSTOP
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,65,175,125
LTEXT "Contact Name : ",IDC_STATIC,18,83,50,17
@ -210,9 +207,9 @@ BEGIN
LTEXT "City : ",IDC_STATIC,18,140,50,17
EDITTEXT IDET_PARTNER_CITY,76,139,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Fed. State : ",IDC_STATIC,18,154,50,17
COMBOBOX ID_ALL_STATE_DROPDOWNLIST, 76, 153, 100, 50,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
EDITTEXT IDET_PARTNER_STATE, 76, 153, 100, 12,ES_AUTOHSCROLL |ES_READONLY
LTEXT "Country :",IDC_STATIC, 18, 169, 35, 17
COMBOBOX ID_ALL_COUNTRY_DROPDOWNLIST, 76, 168,100,50,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
EDITTEXT IDET_PARTNER_COUNTRY, 76, 168, 100, 12,ES_AUTOHSCROLL |ES_READONLY
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 65, 152, 125
LTEXT "Phone : ",IDC_STATIC, 194, 83, 30, 17
@ -228,3 +225,22 @@ BEGIN
PUSHBUTTON "Save", IDPB_WRITE_CHANGES, 213, 195, 60, 14, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 281, 195, 60, 14, WS_TABSTOP
END
IDD_SELECT_PARTNER DIALOGEX 0, 0, 220, 250
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Search Partner"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Enter Name : ",IDC_STATIC,8,12,80,17
EDITTEXT IDET_PARTNER_SEARCH_NAME, 55, 10, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search", IDPB_PARTNER_SEARCH, 160, 10, 50, 14, WS_TABSTOP
CONTROL "List1",IDC_LIST_PARTNER,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Create New Partner", IDPB_CREATE_NEW_PARTNER, 10, 230, 100, 14, WS_TABSTOP
PUSHBUTTON "Select", IDPB_SELECT_PARTNER, 130, 230, 40, 14, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 175, 230, 40, 14, WS_TABSTOP
END

View File

@ -209,12 +209,12 @@ class XMLRpcConn(object):
obj_list = [ustr(item['name']).encode('iso-8859-1') for item in objects]
return obj_list
def GetPartners(self):
def GetPartners(self, search_partner=''):
import win32ui
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[('name','ilike',ustr(search_partner))])
if ids:
ids.sort()
obj_list.append((-999, ustr('')))
@ -302,13 +302,13 @@ class XMLRpcConn(object):
result[obj].update({obj_id: attachment_ids})
return result
def CreateContact(self, sel=None, res=None):
def CreateContact(self, res=None):
import win32ui
res=eval(str(res))
self.partner_id_list=eval(str(self.partner_id_list))
if self.partner_id_list.get(sel,-999) != -999:
res['partner_id'] = self.partner_id_list[sel]
partner = res['partner_id']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
res.update({'partner_id' : partner_id[0]})
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
@ -339,12 +339,16 @@ class XMLRpcConn(object):
flag = -1
new_dict = dict(new_vals)
email=new_dict['email']
partner = new_dict['partner']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_id:
return flag
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','state_id','country_id'])
vals_res_address={ 'name' : new_dict['name'],
vals_res_address={
'partner_id' : partner_id[0],
'name' : new_dict['name'],
'street':new_dict['street'],
'street2' : new_dict['street2'],
'city' : new_dict['city'],
@ -353,12 +357,6 @@ class XMLRpcConn(object):
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
}
if new_dict['partner_id'] != -1:
vals_res_address['partner_id'] = new_dict['partner_id']
if new_dict['state_id'] != -1:
vals_res_address['state_id'] = new_dict['state_id']
if new_dict['country_id'] != -1:
vals_res_address['country_id'] = new_dict['country_id']
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
flag=1

View File

@ -4,7 +4,7 @@
<menuitem
id="menu_process"
name="Enterprise Processes"
name="Enterprise Process"
parent="base.menu_custom"
groups="base.group_extended"/>
@ -121,7 +121,7 @@
</record>
<record model="ir.actions.act_window" id="action_process_form">
<field name="name">Process</field>
<field name="name">Processes</field>
<field name="res_model">process.process</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

View File

@ -174,10 +174,10 @@ class project(osv.osv):
'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'tasks': fields.one2many('project.task', 'project_id', "Project tasks"),
'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects."),
'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects."),
'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects."),
'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo."),
'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.", store=True),
'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects.", store=True),
'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.", store=True),
'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo.", store=True),
'warn_customer': fields.boolean('Warn Partner', help="If you check this, the user will have a popup when closing a task that propose a message to send by email to the customer.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
@ -441,6 +441,7 @@ class task(osv.osv):
'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'),
'manager_id': fields.related('project_id', 'analytic_account_id', 'user_id', type='many2one', relation='res.users', string='Project Manager'),
'company_id': fields.many2one('res.company', 'Company'),
'id': fields.integer('ID'),
}
_defaults = {

View File

@ -302,7 +302,8 @@
<field name="type">tree</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0 and state in ('pending');red:bool(date_deadline) and (date_deadline&lt;current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
<tree colors="grey:state in ('cancelled','done');blue:remaining_hours&lt;0 and state in ('pending');red:date_deadline and (date_deadline&gt;current_date) and (state in ('draft','open'));black:state not in ('cancelled','done')" string="Tasks">
<field name="id"/>
<field name="sequence" invisible="not context.get('seq_visible', False)"/>
<field name="name"/>
<field name="project_id" icon="gtk-indent" domain="['|',('user_id','=',uid),('members','=',uid)]"/>

View File

@ -72,7 +72,7 @@ class report_project_task_user(osv.osv):
date_trunc('day',t.date_end) as date_end,
to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_deadline,
-- sum(cast(to_char(date_trunc('day',t.date_end) - date_trunc('day',t.date_start),'DD') as int)) as no_of_days,
(extract('epoch' from (t.date_end-t.date_start)))/(3600*24) as no_of_days,
abs((extract('epoch' from (t.date_end-t.date_start)))/(3600*24)) as no_of_days,
t.user_id,
progress as progress,
t.project_id,

View File

@ -155,7 +155,7 @@
<field name="model">project.vs.hours</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Project and remaining hours" colors="pink:state=='draft';blue:state=='pending';black:state=='open';red:state=='cancelled';grey:state=='close';yellow:state=='template'">
<tree string="Remaining Hours Per Project" colors="pink:state=='draft';blue:state=='pending';black:state=='open';red:state=='cancelled';grey:state=='close';yellow:state=='template'">
<field name="project"/>
<field name="remaining_hours"/>
<field name="state"/>
@ -177,7 +177,7 @@
</record>
<record id="action_project_vs_remaining_hours_graph" model="ir.actions.act_window">
<field name="name">Project and remaining hours</field>
<field name="name">Remaining Hours Per Project</field>
<field name="res_model">project.vs.hours</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
@ -187,8 +187,8 @@
<record id="open_view_project_vs_remaining_hours_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_project_vs_remaining_hours_tree"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_project_vs_remaining_hours_graph"/>
<field name="act_window_id" ref="action_project_vs_remaining_hours_graph"/>
</record>
<record id="open_view_project_vs_remaining_hours_graph" model="ir.actions.act_window.view">
@ -262,7 +262,7 @@
</record>
<record id="action_project_vs_planned_total_hours_graph" model="ir.actions.act_window">
<field name="name">My projects: Planned Vs Total hours</field>
<field name="name">Projects: Planned Vs Total hours</field>
<field name="res_model">project.vs.hours</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
@ -272,8 +272,8 @@
<record id="open_view_project_vs_planned_total_hours_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_project_vs_planned_total_hours_tree"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_project_vs_planned_total_hours_graph"/>
<field name="act_window_id" ref="action_project_vs_planned_total_hours_graph"/>
</record>
<record id="open_view_project_vs_planned_total_hours_graph" model="ir.actions.act_window.view">

View File

@ -141,7 +141,7 @@ class project_issue(crm.crm_case, osv.osv):
else:
res[issue.id][field] = abs(float(duration))
return res
_columns = {
'id': fields.integer('ID'),
'name': fields.char('Name', size=128, required=True),
@ -185,7 +185,7 @@ class project_issue(crm.crm_case, osv.osv):
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="float", store=True),
'assigned_to': fields.many2one('res.users', 'Assigned to', help='This is the current user to whom the related task have been assigned'),
'assigned_to': fields.related('task_id', 'user_id', string = 'Assigned to', type="many2one", relation="res.users", store=True, help='This is the current user to whom the related task have been assigned'),
'working_hours_open': fields.function(_compute_day, string='Working Hours to Open the Issue', \
method=True, multi='working_days_open', type="float", store=True),
'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \
@ -193,6 +193,7 @@ class project_issue(crm.crm_case, osv.osv):
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'progress': fields.related('task_id', 'progress', string='Progress (%)',group_operator="avg", store=True),
}
def _get_project(self, cr, uid, context):
@ -245,6 +246,7 @@ class project_issue(crm.crm_case, osv.osv):
vals = {
'task_id': new_task_id,
'state':'open'
}
case_obj.write(cr, uid, [bug.id], vals)
@ -286,6 +288,15 @@ class project_issue(crm.crm_case, osv.osv):
if not stage.on_change:
return {'value':{}}
return {'value':{}}
def onchange_task_id(self, cr, uid, ids, task_id, context=None):
if context is None:
context = {}
result = {}
if not task_id:
return {'value':{}}
task = self.pool.get('project.task').browse(cr, uid, task_id, context)
return {'value':{'assigned_to': task.user_id.id,}}
def case_escalate(self, cr, uid, ids, *args):
"""Escalates case to top level
@ -307,6 +318,7 @@ class project_issue(crm.crm_case, osv.osv):
else:
raise osv.except_osv(_('Warning !'), _('You cannot escalate this issue.\nThe relevant Project has not configured the Escalation Project!'))
self.write(cr, uid, [case.id], data)
self._history(cr, uid, cases, _('Escalate'))
return True
def message_new(self, cr, uid, msg, context):
@ -358,6 +370,31 @@ class project_issue(crm.crm_case, osv.osv):
return res
def get_stage_dict(self, cr, uid, ids, context=None):
"""This function gives dictionary for stage according to stage levels
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
stage_obj = self.pool.get('crm.case.stage')
domain = [('object_id.model', '=', self._name)]
if 'force_domain' in context and context['force_domain']:
domain += context['force_domain']
sid = stage_obj.search(cr, uid, domain, context=context)
s = {}
previous = {}
section = self._name
for stage in stage_obj.browse(cr, uid, sid, context=context):
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
return s
def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context=None):
if context is None:
context = {}
@ -405,6 +442,17 @@ class project_issue(crm.crm_case, osv.osv):
@param **args: Return Dictionary of Keyword Value
"""
return True
def copy(self, cr, uid, id, default=None, context=None):
if not context:
context={}
issue = self.read(cr, uid, id, ['name'], context=context)
if not default:
default = {}
default = default.copy()
default['name'] = issue['name'] + _(' (copy)')
return super(project_issue, self).copy(cr, uid, id, default=default,
context=context)
project_issue()

View File

@ -68,7 +68,7 @@
<field name="user_id"/>
<field name="assigned_to" />
<group colspan="2" col="4">
<field name="stage_id" on_change="onchange_stage_id(stage_id)" domain="[('object_id.model', '=', 'project.issue')]" widget="selection"/>
<field name="stage_id" on_change="onchange_stage_id(stage_id)" domain="[('object_id.model', '=', 'project.issue')]" widget="selection" readonly="1"/>
<button icon="gtk-go-back" string="" name="stage_previous" type="object"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
@ -85,9 +85,10 @@
<separator colspan="3" string="Status"/>
<field name="version_id" colspan="3" widget="selection"/>
<field name="priority" colspan="3"/>
<field name="task_id" />
<field name="task_id" on_change="onchange_task_id(task_id)"/>
<button string="Convert To Task" name="convert_issue_task" icon="gtk-index" type="object"
attrs="{'invisible':[('task_id','!=',False)]}" />
<field name="progress" colspan="3" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
</group>
<separator string= "Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4"/>
@ -201,6 +202,7 @@
<field name="version_id" widget="selection"/>
<field name="user_id"/>
<field name="assigned_to"/>
<field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/>
<field name="state"/>
<button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/>
<button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" help="To Do"/>
@ -224,9 +226,9 @@
<filter string="To Do" domain="[('state','=','open')]" help="To Do Issues" icon="terp-camera_test"/>
<filter string="Pending" domain="[('state','=','pending')]" help="Pending Issues" icon="terp-gtk-media-pause"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Today" separator="1" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]" help="Today's bugs" />
<filter icon="terp-go-today" string="Today" separator="1" domain="[('create_date','=',time.strftime('%%Y-%%m-%%d'))]" help="Today's bugs" />
<filter icon="terp-go-week" string="7 Days" separator="1"
domain="[('date','&lt;', time.strftime('%%Y-%%m-%%d')), ('date', '&gt;=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d')), ('create_date', '&gt;=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Bugs during last 7 days"
/>
<separator orientation="vertical"/>

View File

@ -135,7 +135,7 @@
<separator orientation="vertical"/>
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical" />
<filter string="Day" icon="terp-go-today"
domain="[]" context="{'group_by':'day'}" help="Current Day"/>

View File

@ -20,6 +20,7 @@
##############################################################################
from datetime import datetime
from dateutil.relativedelta import relativedelta
from tools.translate import _
from osv import fields, osv
from resource.faces import task as Task
@ -90,13 +91,26 @@ class project_phase(osv.osv):
model_data_obj = self.pool.get('ir.model.data')
model_data_id = model_data_obj._get_id(cr, uid, 'product', 'uom_hour')
return model_data_obj.read(cr, uid, [model_data_id], ['res_id'])[0]['res_id']
def _compute(self, cr, uid, ids, context=None):
res = {}
if not ids:
return res
for phase in self.browse(cr, uid, ids, context=context):
tot = 0.0
for task in phase.task_ids:
tot += task.planned_hours
res[phase.id] = {
'total_hours' : tot
}
return res
_columns = {
'name': fields.char("Name", size=64, required=True),
'date_start': fields.date('Start Date', help="Starting Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'date_end': fields.date('End Date', help="Ending Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_start': fields.date('Start Date', help='force the phase to start after this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_end': fields.date('End Date', help='force the phase to finish before this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_start': fields.date('Minimum Start Date', help='force the phase to start after this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_end': fields.date('Deadline', help='force the phase to finish before this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'project_id': fields.many2one('project.project', 'Project', required=True),
'next_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'prv_phase_id', 'next_phase_id', 'Next Phases', states={'cancelled':[('readonly',True)]}),
'previous_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'next_phase_id', 'prv_phase_id', 'Previous Phases', states={'cancelled':[('readonly',True)]}),
@ -108,7 +122,8 @@ class project_phase(osv.osv):
'responsible_id': fields.many2one('res.users', 'Responsible', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
help='If the phase is created the state \'Draft\'.\n If the phase is started, the state becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' state.\
\n If the phase is over, the states is set to \'Done\'.')
\n If the phase is over, the states is set to \'Done\'.'),
'total_hours': fields.function(_compute, method=True, string='Total Hours'),
}
_defaults = {
'responsible_id': lambda obj,cr,uid,context: uid,
@ -130,6 +145,14 @@ class project_phase(osv.osv):
project_id = project_obj.browse(cr, uid, project, context=context)
result['date_start'] = project_id.date_start
return {'value': result}
def onchange_days(self, cr, uid, ids, project, context=None):
result = {}
for id in ids:
project_id = self.browse(cr, uid, id, context=context)
newdate = datetime.strptime(project_id.date_start, '%Y-%m-%d') + relativedelta(days=project_id.duration or 0.0)
result['date_end'] = newdate.strftime('%Y-%m-%d')
return {'value': result}
def _check_date_start(self, cr, uid, phase, date_end, context=None):
if context is None:
@ -277,7 +300,6 @@ class project_phase(osv.osv):
context = {}
resource_pool = self.pool.get('resource.resource')
uom_pool = self.pool.get('product.uom')
phase_resource = False
if context is None:
context = {}
default_uom_id = self._get_default_uom_id(cr, uid)
@ -290,11 +312,11 @@ class project_phase(osv.osv):
duration = str(avg_hours) + 'H'
# Create a new project for each phase
def Project():
# If project has working calendar then that
# else the default one would be considered
start = start_date
minimum_time_unit = 1
resource = phase_resource_obj
# If project has working calendar then that
# else the default one would be considered
if calendar_id:
working_days = resource_pool.compute_working_calendar(cr, uid, calendar_id, context=context)
vacation = tuple(resource_pool.compute_vacation(cr, uid, calendar_id))
@ -372,8 +394,10 @@ class project_resource_allocation(osv.osv):
_columns = {
'resource_id': fields.many2one('resource.resource', 'Resource', required=True),
'phase_id': fields.many2one('project.phase', 'Project Phase', ondelete='cascade', required=True),
'phase_id_date_start': fields.related('phase_id', 'date_start', type='date', string='Starting Date of the phase'),
'phase_id_date_end': fields.related('phase_id', 'date_end', type='date', string='Ending Date of the phase'),
'project_id': fields.related('phase_id', 'project_id', type='many2one', relation="project.project", string='Project', store=True),
'user_id': fields.related('resource_id', 'user_id', type='many2one', relation="res.users", string='User'),
'date_start': fields.date('Start Date', help="Starting Date"),
'date_end': fields.date('End Date', help="Ending Date"),
'useability': fields.float('Usability', help="Usability of this resource for this project phase in percentage (=50%)"),
}
_defaults = {

View File

@ -13,14 +13,27 @@
<field name="model">project.resource.allocation</field>
<field name="type">gantt</field>
<field name="arch" type="xml">
<gantt color="phase_id" date_start="phase_id_date_start" date_stop="phase_id_date_end" string="R.A." mode="year">
<level object="project.resource" link="resource_id" domain="[]">
<field name="useability"/>
<gantt color="phase_id" date_start="date_start" date_stop="date_end" string="R.A." mode="year">
<level object="res.users" link="user_id" domain="[]">
<field name="useability" string="Availability"/>
</level>
</gantt>
</field>
</record>
<record id="view_project_resource_allocation_calendar" model="ir.ui.view">
<field name="name">project.resource.allocation.calendar</field>
<field name="model">project.resource.allocation</field>
<field name="type">calendar</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<calendar color="user_id" date_start="date_start" date_stop="date_end" day_length="12" string="Resources">
<field name="phase_id"/>
<field name="project_id"/>
</calendar>
</field>
</record>
<record id="view_project_resource_allocation_form" model="ir.ui.view">
<field name="name">project.resource.allocation.form</field>
@ -28,9 +41,14 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Project Resource Allocation">
<field name="resource_id" select="1"/>
<field name="phase_id"/>
<field name="useability" string="Availability"/>
<group colspan="4" col="6">
<field name="resource_id"/>
<field name="phase_id"/>
<field name="project_id"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="useability" string="Availability"/>
</group>
</form>
</field>
</record>
@ -44,6 +62,7 @@
<tree editable="bottom" string="Project Resource Allocation">
<field name="resource_id"/>
<field name="phase_id"/>
<field name="project_id"/>
<field name="useability"/>
</tree>
</field>
@ -58,11 +77,13 @@
<group colspan="4" col="20">
<field name="resource_id"/>
<field name="phase_id"/>
<field name="project_id"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="20">
<filter name="resource" string="Resource" icon="terp-folder-blue" domain="[]" context="{'group_by':'resource_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}"/>
<filter string="Phase" icon="terp-project" domain="[]" context="{'group_by':'phase_id'}"/>
</group>
</search>
@ -73,7 +94,7 @@
<field name="name">Resource Allocations</field>
<field name="res_model">project.resource.allocation</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,gantt</field>
<field name="view_mode">gantt,tree,form,calendar</field>
<field name="context">{}</field>
<field name="search_view_id" ref="view_project_resource_allocation_search"/>
</record>
@ -97,7 +118,7 @@
<group colspan="2" col="4">
<field name="project_id" on_change="onchange_project(project_id)" colspan="4"/>
<newline/>
<field name="duration" colspan="1"/>
<field name="duration" colspan="1" on_change="onchange_days(project_id)" />
<field name="product_uom" nolabel="1" domain="[('category_id.name', '=', 'Working Time')]"/>
</group>
<group colspan="2" col="2">
@ -110,10 +131,14 @@
<field colspan="4" name="resource_ids" nolabel="1">
<tree editable="bottom" string="Project Resource Allocation">
<field name="resource_id" context="{'project_id':parent.project_id}"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="useability"/>
</tree>
<form string="Project Resource Allocation">
<field name="resource_id" context="{'project_id':parent.project_id}"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="useability"/>
</form>
</field>
@ -134,6 +159,7 @@
<field name="user_id"/>
<field name="planned_hours" widget="float_time"/>
<field name="project_id" invisible="1"/>
<field name="total_hours" sum='Total Hours'/>
</tree>
<form string="Project's Tasks">
<notebook colspan="4">
@ -151,6 +177,7 @@
<group colspan="2" col="2">
<separator string="Planning" colspan="2"/>
<field name="planned_hours" widget="float_time"/>
<field name="total_hours" widget="float_time"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours"/>
<field name="effective_hours" invisible="1"/>
</group>
@ -263,7 +290,7 @@
<field name="name">Project Phases</field>
<field name="res_model">project.phase</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,gantt,calendar</field>
<field name="view_mode">gantt,tree,form,calendar</field>
<field name="context">{'search_default_responsible_id':uid}</field>
<field name="search_view_id" ref="view_project_phase_search"/>
<field name="help">You can subdivide your larger projects into several phases. For each phase, you can define your resources allocation (humans or engine), describe de differend task and link your phase with previous and next one, add constraints date and scheduling. A gantt view of your project phase is also available from this menu. Gantt view is a graphically draw of the project plan; it includes any task dependencies by visually adjusting task durations and priorities, and by linking tasks to each other.</field>
@ -299,7 +326,30 @@
# ------------------------------------------------------
# Project Task
# ------------------------------------------------------
<record id="view_phase_task_form2" model="ir.ui.view">
<field name="name">phase.task.form2</field>
<field name="model">project.task</field>
<field name="type">form</field>
<field name="inherit_id" ref="project.view_task_form2"/>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field name="phase_id"/>
</field>
</field>
</record>
<record id="view_phase_task_search_form" model="ir.ui.view">
<field name="name">phase.task.search.form</field>
<field name="model">project.task</field>
<field name="type">search</field>
<field name="inherit_id" ref="project.view_task_search_form"/>
<field name="arch" type="xml">
<field name="project_id" position="after">
<field name="phase_id" select="1"/>
</field>
</field>
</record>
<act_window
id="project_phase_task_list"
name="Related Tasks"

View File

@ -30,6 +30,7 @@ class messages(osv.osv):
logger = netsvc.Logger()
_columns = {
'create_date': fields.datetime('Creation Date', readonly=True),
'from_id': fields.many2one('res.users', 'From', required=True, ondelete="CASCADE"),
'to_id': fields.many2one('res.users', 'To', ondelete="CASCADE", help="Keep this empty to broadcast the message."),
'project_id': fields.many2one('project.project', 'Project',

View File

@ -55,6 +55,7 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Messages">
<field name="create_date"/>
<field name="project_id"/>
<field name="from_id"/>
<field name="to_id"/>
@ -67,8 +68,10 @@
<field name="model">project.messages</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Communication Messages">
<search string="Project Messages">
<group>
<filter icon="terp-go-today" string="Today" separator="1" domain="[('create_date','=',time.strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical"/>
<field name="project_id"/>
<field name="from_id"/>
<field name="to_id"/>
@ -86,7 +89,7 @@
</record>
<record id="messages_form" model="ir.actions.act_window">
<field name="name">Communication Messages</field>
<field name="name">Project Messages</field>
<field name="res_model">project.messages</field>
<field name="view_type">form</field>
<field name="search_view_id" ref="view_project_messages_search"/>

View File

@ -278,7 +278,6 @@
<search string="Planning statistics">
<group col="10" colspan="4">
<filter icon="gtk-execute" string="My" domain="[('user_id','=',uid),('planning_id.state','&lt;&gt;','cancel')]" help="My Plannings Statistics"/>
<filter icon="gtk-execute" string="My Project" domain="[('manager_id','=',uid),('planning_id.state','&lt;&gt;','cancel')]" help="Planning Statistics of My Projects"/>
<separator orientation="vertical"/>
<field name="planning_id" select="1"/>
<field name="user_id" select="1"/>
@ -294,6 +293,7 @@
<field name="res_model">report_account_analytic.planning.stat</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="account_analytic_planning_stat_view_search"/>
</record>
<menuitem id="next_id_85" name="Planning"

View File

@ -18,13 +18,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from mx import DateTime
from osv import fields, osv
from tools.translate import _
import re
import time
import tools
from datetime import datetime
from dateutil.relativedelta import relativedelta
class project_scrum_project(osv.osv):
_inherit = 'project.project'
@ -147,7 +147,7 @@ class project_scrum_sprint(osv.osv):
proj = self.pool.get('project.project').browse(cr, uid, [project_id])[0]
v['product_owner_id']= proj.product_owner_id and proj.product_owner_id.id or False
v['scrum_master_id']= proj.user_id and proj.user_id.id or False
v['date_stop'] = (DateTime.now() + DateTime.RelativeDateTime(days=int(proj.sprint_size or 14))).strftime('%Y-%m-%d')
v['date_stop'] = (datetime.now() + relativedelta(days=int(proj.sprint_size or 14))).strftime('%Y-%m-%d')
return {'value':v}
project_scrum_sprint()
@ -257,14 +257,14 @@ class project_scrum_product_backlog(osv.osv):
'name' : fields.char('Feature', size=64, required=True),
'note' : fields.text('Note'),
'active' : fields.boolean('Active', help="If Active field is set to true, it will allow you to hide the product backlog without removing it."),
'project_id': fields.many2one('project.project', 'Project', required=True, domain=[('scrum','=',1)], help="If you have [?] in the project name, it means there are no analytic account linked to this project."),
'project_id': fields.many2one('project.project', 'Project', required=True, domain=[('scrum','=',1)]),
'user_id': fields.many2one('res.users', 'Author'),
'sprint_id': fields.many2one('project.scrum.sprint', 'Sprint'),
'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of product backlog."),
'tasks_id': fields.one2many('project.task', 'product_backlog_id', 'Tasks Details'),
'state': fields.selection([('draft','Draft'),('open','Open'),('pending','Pending'),('done','Done'),('cancel','Cancelled')], 'State', required=True),
'progress': fields.function(_compute, multi="progress", group_operator="avg", type='float', method=True, string='Progress', help="Computed as: Time Spent / Total Time."),
'effective_hours': fields.function(_compute, multi="effective_hours", method=True, string='Spent Hours', help="Computed using the sum of the time spent on every related tasks"),
'effective_hours': fields.function(_compute, multi="effective_hours", method=True, string='Spent Hours', help="Computed using the sum of the time spent on every related tasks", store=True),
'expected_hours': fields.float('Planned Hours', help='Estimated total time to do the Backlog'),
'create_date': fields.datetime("Creation Date", readonly=True),
'task_hours': fields.function(_compute, multi="task_hours", method=True, string='Task Hours', help='Estimated time of the total hours of the tasks')

View File

@ -41,7 +41,7 @@
<field name="user_id"/>
<field name="progress" widget="progressbar"/>
<field name="expected_hours" sum="Planned hours" widget="float_time" string="Total Planned Hours"/>
<field name="effective_hours" sum="Effective hours" widget="float_time" string="Total Spent Hours"/>
<field name="effective_hours" sum="Spent hours" widget="float_time" string="Total Spent Hours"/>
<field name="state"/>
<button type="object" string="Open" name="button_open" states="draft,pending" icon="terp-camera_test"/>
<button type="object" string="Pending" name="button_pending" states="open" icon="gtk-media-pause"/>
@ -192,7 +192,19 @@
<!--
Scrum Sprint
-->
<record id="view_scrum_sprint_calendar" model="ir.ui.view">
<field name="name">project.scrum.sprint.calendar</field>
<field name="model">project.scrum.sprint</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar string="Scrum Sprint" date_start="date_start">
<field name="name"/>
<field name="project_id"/>
</calendar>
</field>
</record>
<record id="view_scrum_sprint_tree" model="ir.ui.view">
<field name="name">project.scrum.sprint.tree</field>
<field name="model">project.scrum.sprint</field>
@ -333,7 +345,7 @@
<field name="name">Sprints</field>
<field name="res_model">project.scrum.sprint</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="view_id" ref="view_scrum_sprint_tree"/>
<field name="context">{"search_default_filter_current": 1, "search_default_scrum_master_id":uid}</field>
<field name="search_view_id" ref="view_scrum_sprint_search"/>
@ -345,7 +357,19 @@
<!--
Daily Meeting
-->
<record id="view_scrum_meeting_calendar" model="ir.ui.view">
<field name="name">project.scrum.meeting.calendar</field>
<field name="model">project.scrum.meeting</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar string="Scrum Meeting" date_start="date" color="user_id">
<field name="sprint_id"/>
<field name="project_id"/>
</calendar>
</field>
</record>
<record id="view_scrum_meeting_tree" model="ir.ui.view">
<field name="name">project.scrum.meeting.tree</field>
<field name="model">project.scrum.meeting</field>
@ -424,7 +448,7 @@
<field name="name">Scrum Meetings</field>
<field name="res_model">project.scrum.meeting</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="context">{'search_default_scrum_daily':1,'search_default_project_id':project_id}</field>
<field name="search_view_id" ref="view_scrum_meeting_search"/>
</record>

View File

@ -31,6 +31,7 @@ class backlog_create_task(osv.osv_memory):
mod_obj = self.pool.get('ir.model.data')
task = self.pool.get('project.task')
backlog_id = self.pool.get('project.scrum.product.backlog')
document_pool = self.pool.get('ir.attachment')
ids_task = []
if context is None:
@ -39,9 +40,9 @@ class backlog_create_task(osv.osv_memory):
backlogs = backlog_id.browse(cr, uid, context['active_ids'], context=context)
result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form')
id = mod_obj.read(cr, uid, result, ['res_id'])
for backlog in backlogs:
ids_task.append(task.create(cr, uid, {
task_id = task.create(cr, uid, {
'product_backlog_id': backlog.id,
'name': backlog.name,
'description': backlog.note,
@ -50,8 +51,11 @@ class backlog_create_task(osv.osv_memory):
'planned_hours': backlog.expected_hours,
'remaining_hours':backlog.expected_hours,
'sequence':backlog.sequence,
}))
})
document_ids = document_pool.search(cr, uid, [('res_id', '=', backlog.id), ('res_model', '=', backlog_id._name)])
for document_id in document_ids:
document_pool.copy(cr, uid, document_id, default={'res_id':task_id, 'res_model':task._name})
ids_task.append(task_id)
return {
'domain': "[('product_backlog_id','in',["+','.join(map(str, context['active_ids']))+"])]",
'name': 'Tasks',

View File

@ -86,17 +86,17 @@
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="date"/>
<field name="date_confirm"/>
<separator orientation="vertical"/>
<field name="shop_id" widget="selection"/>
<field name="categ_id" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<newline/>
<field name="date"/>
<field name="date_confirm"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Salesman" icon="terp-personal" name="User" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}"/>
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id','set_visible':True}"/>
<filter string="Default UoM" icon="terp-mrp" context="{'group_by':'uom_name'}"/>

View File

@ -37,7 +37,10 @@ class sale_shop(osv.osv):
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist'),
'project_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('parent_id', '!=', False)]),
'company_id': fields.many2one('res.company', 'Company', required=True),
'company_id': fields.many2one('res.company', 'Company', required=False),
}
_defaults = {
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'sale.shop', context=c),
}
sale_shop()
@ -865,13 +868,6 @@ class sale_order_line(osv.osv):
'product_packaging': False
}
def create_sale_order_line_invoice(self, cr, uid, ids, context=None):
if context is None:
context = {}
context.update({'active_ids' : ids,'active_id' : ids})
self.pool.get('sale.order.line.make.invoice').make_invoices(cr, uid, ids, context=context)
return True
def invoice_line_create(self, cr, uid, ids, context=None):
if context is None:
context = {}

View File

@ -157,10 +157,10 @@
<field name="invoiced"/>
<group attrs="{'invisible':[('invoiced','=',True)]}">
<button colspan="1"
name="create_sale_order_line_invoice"
name="%(action_view_sale_order_line_make_invoice)d"
states="confirmed"
string="Create Invoice"
type="object"
string="Make Invoices"
type="action"
icon="terp-document-new" />
</group>
</group>
@ -364,6 +364,7 @@ to your configuration: from the sales order, from the pickings, etc.
<field name="salesman_id"/>
<field name="price_subtotal"/>
<field name="state"/>
<field name="invoiced"/>
</tree>
</field>
</record>
@ -373,7 +374,6 @@ to your configuration: from the sales order, from the pickings, etc.
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales Order Lines">
<separator colspan="4" string="General Information"/>
<group colspan="4" col="6">
<field name="order_id"/>
<field name="product_id" readonly="1"/>
@ -381,50 +381,36 @@ to your configuration: from the sales order, from the pickings, etc.
<field name="product_uom_qty" readonly="1"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field name="product_uom"/>
<field colspan="4" name="name" groups="base.group_extended"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
<field name="order_partner_id" readonly="1" invisible="1"/>
</group>
<notebook>
<page string="Order Lines">
<separator colspan="4" string="Manual Designation"/>
<group colspan="4" col="6">
<field name="type" groups="base.group_extended"/>
<field name="delay" groups="base.group_extended"/>
<field name="th_weight" groups="base.group_extended"/>
<field name="price_unit"/>
<field name="discount"/>
<field name="price_subtotal"/>
</group>
<separator colspan="4" string="Description"/>
<field colspan="4" name="name" groups="base.group_extended"/>
<separator colspan="4" string="Taxes"/>
<field colspan="4" name="tax_id" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]" nolabel="1"/>
<separator colspan="4"/>
<field name="state"/>
<group col="3" colspan="2">
<button colspan="1"
name="create_sale_order_line_invoice"
string="Create Invoice"
type="object"
icon="terp-document-new"
attrs="{'invisible': ['|',('state', 'in', ('draft','cancel')),('invoiced', '=', 1)]}"/>
<button name="button_cancel"
string="Cancel" type="object"
icon="gtk-cancel"
attrs="{'invisible': ['|',('state', 'not in', ('confirmed', 'exception')),('invoiced', '=', 1)]}"/>
<button name="button_done"
string="Done" type="object"
icon="gtk-jump-to"
attrs="{'invisible': ['|',('state', 'not in', ('confirmed','exception')),('invoiced', '=', 0)]}"/>
</group>
</page>
<page string="Invoice Lines" groups="base.group_extended">
<field colspan="4" name="invoice_lines" nolabel="1"/>
</page>
<page string="Notes">
<field colspan="4" name="notes" nolabel="1"/>
</page>
</notebook>
<separator colspan="4" string="Price"/>
<group colspan="4" col="6">
<field name="price_unit"/>
<field name="discount"/>
<field name="price_subtotal"/>
</group>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="notes" nolabel="1"/>
<separator colspan="4"/>
<field name="state"/>
<group col="3" colspan="2">
<!-- <button colspan="1"
name="%(action_view_sale_order_line_make_invoice)d"
string="Make Invoice"
type="action"
icon="terp-document-new"
attrs="{'invisible': ['|',('state', 'in', ('draft','cancel')),('invoiced', '=', 1)]}"/>-->
<button name="button_cancel"
string="Cancel" type="object"
icon="gtk-cancel"
attrs="{'invisible': ['|',('state', 'not in', ('confirmed', 'exception')),('invoiced', '=', 1)]}"/>
<button name="button_done"
string="Done" type="object"
icon="gtk-jump-to"
attrs="{'invisible': ['|',('state', 'not in', ('confirmed','exception')),('invoiced', '=', 0)]}"/>
</group>
</form>
</field>
</record>

View File

@ -41,15 +41,20 @@
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so3}
-
I click on the "Create Invoice" button of sale order line
I click on the "Make Invoice" button of sale order line
-
!record {model: sale.order.line.make.invoice, id: sale_order_line_make_invoice_0}:
{}
-
I click on the "Create Invoice" button of wizard
-
!python {model: sale.order.line}: |
!python {model: sale.order.line.make.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
sol = so.order_line[0]
self.create_sale_order_line_invoice(cr, uid, [sol.id], {"lang": "en_US",
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale.menu_invoicing_sales_order_lines")],
"search_default_uninvoiced": 1, "active_id": ref("sale.menu_invoicing_sales_order_lines"),
self.make_invoices(cr, uid, [ref("sale_order_line_make_invoice_0")], {"lang": "en_US",
"tz": False, "active_model": "sale.order.line", "active_ids": [sol.id],
"search_default_uninvoiced": 1, "active_id": sol.id,
})
-
I verify that "Invoiced" has been set to True.
@ -115,17 +120,20 @@
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I click on the "Create Invoice" button of sale order and verify that it gives a warning message
I create an invoice for another sale order line. I click on the "Make Invoice" button of sale order line
-
I create an invoice for another sale order line. I click on the "Create Invoice" button of sale order line
-
!python {model: sale.order.line}: |
!record {model: sale.order.line.make.invoice, id: sale_order_line_make_invoice_1}:
{}
-
I click on the "Create Invoice" button of wizard
-
!python {model: sale.order.line.make.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
sol = so.order_line[1]
self.create_sale_order_line_invoice(cr, uid, [sol.id], {"lang": "en_US",
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale.menu_invoicing_sales_order_lines")],
"search_default_uninvoiced": 1, "active_id": ref("sale.menu_invoicing_sales_order_lines"),
self.make_invoices(cr, uid, [ref("sale_order_line_make_invoice_1")], {"lang": "en_US",
"tz": False, "active_model": "sale.order.line", "active_ids": [sol.id],
"search_default_uninvoiced": 1, "active_id": sol.id,
})
-
I verify that invoice for sale order line has been created.

View File

@ -20,7 +20,18 @@
<field name="res_model">sale.order.line.make.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_sale_order_line_make_invoice"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="sale_order_line_make_invoice">
<field name="model_id" ref="sale.model_sale_order_line" />
<field name="object" eval="1" />
<field name="name">Make Invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_view_sale_order_line_make_invoice'))" />
<field name="key">action</field>
<field name="model">sale.order.line</field>
</record>
</data>
</openerp>

View File

@ -24,8 +24,18 @@
<field name="res_model">sale.make.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_sale_order_make_invoice"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="sale_order_make_invoice">
<field name="model_id" ref="sale.model_sale_order" />
<field name="object" eval="1" />
<field name="name">Make Invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_sale_order_make_invoice'))" />
<field name="key">action</field>
<field name="model">sale.order</field>
</record>
</data>
</openerp>

View File

@ -1,8 +1,9 @@
<openerp>
<data>
<menuitem id="base.menu_base_config" name="Configuration" parent="base.menu_base_partner" sequence="30"
groups="base.group_system,base.group_sale_salesman"/>
<menuitem id="menu_sale_journal_config" name="Sale Journals"
parent="base.menu_base_config" sequence="5" groups="base.group_system"/>
parent="base.menu_base_config" sequence="5" groups="base.group_system,base.group_sale_salesman"/>
<!-- sale journal invoice Type's Form view -->

View File

@ -56,9 +56,9 @@ class sale_order_dates(osv.osv):
return res
_columns = {
'commitment_date': fields.function(_get_commitment_date, method=True,store=True, type='date', string='Commitment Date'),
'requested_date': fields.date('Requested Date'),
'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True,string='Effective Date'),
'commitment_date': fields.function(_get_commitment_date, method=True,store=True, type='date', string='Commitment Date', help="Date on which delivery of products is to be made"),
'requested_date': fields.date('Requested Date', help="Date on which customer has requested for sales"),
'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True,string='Effective Date',help="Date on which picking is created"),
}
sale_order_dates()

View File

@ -159,9 +159,6 @@ class thunderbird_partner(osv.osv_memory):
msg_ids = []
res = {}
res_ids = []
if message_id:
msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)])
if msg_ids and len(msg_ids): return 0
for ref_id in ref_ids:
msg_new = dictcreate.get('message')
ref = ref_id.split(',')
@ -181,6 +178,24 @@ class thunderbird_partner(osv.osv_memory):
message = dictcreate.get('message')
return self.pool.get('email.server.tools').process_email(cr, uid, model, message, attach=True, context=None)
def search_message(self, cr, uid, message, context=None):
#@param message: string of mail which is read from EML File
#@return model,res_id
dictcreate = dict(message)
message = dictcreate.get('message')
msg_pool = self.pool.get('mailgate.message')
msg = self.pool.get('email.server.tools').parse_message(message)
message_id = msg.get('message-id', False)
model = False
res_id = False
if message_id:
msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)])
if msg_ids and len(msg_ids):
msg = msg_pool.browse(cr, uid, msg_ids[0])
model = msg.model
res_id = msg.res_id
return (model,res_id)
def search_contact(self, cr, user, email):
address_pool = self.pool.get('res.partner.address')
address_ids = address_pool.search(cr, user, [('email','=',email)])

View File

@ -25,7 +25,6 @@
<label align="right" id="name" value="&name.value;" width="80" />
<textbox id="txtselectpartner" align="right" width="270" readonly="true"/>
<spacer width="5"/>
<button label="New Partner" image="&imagecreate.value;" oncommand="CreatePartner.onMenuItemCommand(event);" width="133"/>
</hbox>
<separator class="groove-thin" orient="horizontal" width="94"/>
</groupbox>

View File

@ -175,6 +175,8 @@ function searchmail()
window.open("chrome://openerp_plugin/content/plugin.xul", "", "chrome, resizable=yes");
}
}
var openPartnerHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
@ -190,16 +192,17 @@ var openPartnerHandler = {
alert("Partner is not Available.");
return;
}
if(strlSearchResult=="partner_id"){
partner_id = strlSearchResultValue;
weburl = getWebServerURL();
var branchobj = getPref();
db_name = branchobj.getCharPref("serverdbname");
if (weburl == false){
weburl = 'http://localhost:8080'
}
if (partner_id > 0){
window.open(weburl + "/model=res.partner&id=" + partner_id)
if(strlSearchResult=="partner_id"){
partner_id = strlSearchResultValue;
weburl = getWebServerURL();
webport = getwebPort();
var urlport = weburl+':'+webport
if (parseInt(partner_id) > 0){
var t = urlport + "/openerp/form/view?model=res.partner&id="+partner_id;
alert(t + ":" + " " + "\n\n" + "If you can not open this link directly in web browser then you can copy the link and paste in web browser.");
window.open(t);
}
else{
alert("Partner is not Available.");
@ -292,19 +295,21 @@ function open_partner()
}
searchPartner(senderemail);
}
var listDocumentHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var res = result.QueryInterface(Components.interfaces.nsISupportsArray);
res_id = res.QueryElementAt(1, Components.interfaces.nsISupportsPRInt32);
model = res.QueryElementAt(0, Components.interfaces.nsISupportsCString);
weburl = getWebServerURL()
if (weburl == false){
weburl = 'http://localhost:8080'
}
var branchobj = getPref();
db_name = branchobj.getCharPref("serverdbname");
window.open(weburl + "/model=" + model +"&id=" + res_id)
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var res = result.QueryInterface(Components.interfaces.nsISupportsArray);
res_id = res.QueryElementAt(1, Components.interfaces.nsISupportsPRInt32);
model = res.QueryElementAt(0, Components.interfaces.nsISupportsCString);
weburl = getWebServerURL();
webport = getwebPort();
var urlport = weburl+':'+webport;
var t = urlport + "/openerp/form/view?model=" + model +"&id=" + res_id;
alert(t + ":" + " " + "\n\n" + "If you can not open this link directly in web browser then you can copy the link and paste in web browser.");
window.open(t);
},
onFault: function (client, ctxt, fault) {
@ -313,12 +318,14 @@ var listDocumentHandler = {
onError: function (client, ctxt, status, errorMsg) {
}
}
}
function open_document()
{
{
if (check() == false){
return true
}
}
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var version_obj = prefService.getBranch("extensions.");
version_obj.QueryInterface(Components.interfaces.nsIPrefBranch2);
@ -355,12 +362,14 @@ function open_document()
strmethod.data = 'search_message';
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strobj.data = 'thunderbird.partner';
var eml_string = parse_eml()
var a = ['model', 'message'];
var b = [object, eml_string];
var arrofarr = dictcontact(a,b);
var eml_string = parse_eml()
var a = ['message'];
var b = [eml_string];
var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listDocumentHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
}
}
function open_contact()
{
if (check() == false){
@ -428,6 +437,64 @@ function open_contact()
searchContact();
}
function search_document()
{
if (check() == false){
return true
}
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var version_obj = prefService.getBranch("extensions.");
version_obj.QueryInterface(Components.interfaces.nsIPrefBranch2);
version = version_obj.getCharPref("lastAppVersion");
version = parseInt(version[0])
file = getPredefinedFolder(2);
if (version > 2)
{
var emlsArray = gFolderDisplay.selectedMessages;
}
else
{
var emlsArray = GetSelectedMessages();
}
IETtotal = emlsArray.length;
IETexported = 0;
var msguri = emlsArray[0];
//gives the selected email uri
var messageUri= gDBView.URIForFirstSelectedMessage;
var messenger = Components.classes['@mozilla.org/messenger;1'].createInstance(Components.interfaces.nsIMessenger);
//gives the selected email object
var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri);
//functionality to split the author name and email
if(message.author.charAt(0) == '"'){
sendername = message.author.split('"')[1].split('"')[0];
}
else if(message.author.indexOf('<')!=-1){
sendername = message.author.split('<')[0];
}
else{
sendername = message.author;
}
if(message.author.indexOf('<')!=-1){
senderemail = message.author.split('<')[1].split('>')[0];
}
else{
senderemail = message.author
}
//set the initial information for the selected email
setSenderEmail(senderemail);
setSenderName(sendername);
searchdocument();
}
//function to open the configuration window
var Config = {

View File

@ -42,18 +42,11 @@
oncommand="searchmail();" />
</toolbarpalette>
<toolbarpalette id="MailToolbarPalette">
<toolbarbutton id="GA-button1"
class="toolbarbutton-1"
image="&partnericon.value;"
label= "Open Contact"
oncommand="Address.onMenuItemCommand(event);" />
</toolbarpalette>
<toolbarpalette id="MailToolbarPalette">
<toolbarbutton id="GA-button2"
class="toolbarbutton-1"
image="&partnericon.value;"
label= "Open Partner"
label= "Open Partner"
oncommand="open_partner();"
/>
</toolbarpalette>
@ -62,7 +55,7 @@
class="toolbarbutton-1"
image="&imagearchive.value;"
label= "Open Document"
oncommand="open_document();" />
oncommand="search_document();" />
</toolbarpalette>

View File

@ -408,6 +408,11 @@ function getWebServerURL(){
return getPref().getCharPref('webserverurl');
}
//get webserver port
function getwebPort(){
return getPref().getCharPref('webserverport');
}
//get username from config settings
function getUsername(){
return getPref().getCharPref('username');
@ -961,6 +966,41 @@ function module_install()
xmlRpcClient.asyncCall(listinstallmodulehandler,null,'execute',[ strDbName,struid,strpass,strobj,strmethod, strvalue],6);
}
var listSearchwebdocumentHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var sendername = getSenderEmail();
var arrIdList = result.QueryInterface(Components.interfaces.nsISupportsArray);
var count = arrIdList.Count();
for (i = 0; i < count; i++) {
var strlResult = arrIdList.QueryElementAt(i, Components.interfaces.nsISupportsArray);
var strlSearchResult = strlResult.QueryElementAt(0, Components.interfaces.nsISupportsCString);
var strlSearchResultValue = strlResult.QueryElementAt(1, Components.interfaces.nsISupportsCString);
}
if(strlSearchResult=="email" && strlSearchResultValue!=''){
setSenderEmail(strlSearchResultValue);
var t = getSenderEmail();
open_document();}
if(strlSearchResult=="email" && strlSearchResultValue==''){
alert("Contact is not available.so not open any document.");
}
if(strlSearchResult=="res_id"){
setResourceId(strlSearchResultValue);
var t = getResourceId();}
},
onFault: function (client, ctxt, fault) {
},
onError: function (client, ctxt, status, errorMsg) {
}
}
var listSearchContactHandler = {
onResult: function(client, context, result) {
@ -1031,6 +1071,7 @@ var listSearchContactHandler = {
}
}
var listSearchContactdetailHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
@ -1271,6 +1312,31 @@ function searchCheckbox()
xmlRpcClient.asyncCall(listSearchCheckboxHandler,cmbSearchList,'execute',[ strDbName,struid,strpass,strobj,strmethod,arrofarr ],6);
}
function searchdocument()
{
var branchobj = getPref();
setServerService('xmlrpc/object');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
arrFinalList = [];
var xmlRpcClient = getXmlRpc();
var cmbSearchList = document.getElementById('listSearchBox');
var strDbName = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strDbName.data = branchobj.getCharPref("serverdbname");
var struid = xmlRpcClient.createType(xmlRpcClient.INT,{});
struid.data = branchobj.getIntPref('userid');
var strpass = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strpass.data = branchobj.getCharPref("password");
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strobj.data = 'thunderbird.partner';
var strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strmethod.data = 'search_contact';
var strname = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strname.data = getSenderEmail();
xmlRpcClient.asyncCall(listSearchwebdocumentHandler,cmbSearchList,'execute',[ strDbName,struid,strpass,strobj,strmethod,strname ],6);
}
function searchContact()
{
var branchobj = getPref();
@ -1484,9 +1550,7 @@ function upload_archivemail()
var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listArchiveHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
// alert("Mail Archived Successfully to" +" " + ":" + " "+ list_documents.value);
//window.close();
}
var listArchiveDocumentHandler = {
@ -1762,12 +1826,7 @@ var listLoginHandler = {
setUserId(login.data);
module_install();
alert('Successfully Login To OpenERP.');
if (check_module_install(5) == false){
alert("Please install the thunderbird module on your '" + getDbName() +"' database and try again !");
}
else{
window.close();
}
window.close();
}
else{
alert("Login Failed");

View File

@ -3,7 +3,7 @@
<!ENTITY tinyarchive "Push to OpenERP">
<!ENTITY imageicon.value "chrome://openerp_plugin/skin/NEWT1.png">
<!ENTITY menuicon.value "chrome://openerp_plugin/skin/openerp-icon.png">
<!ENTITY partnericon.value "chrome://openerp_plugin/skin/partner.png">
<!ENTITY partnericon.value "chrome://openerp_plugin/skin/partner_icon.png">
<!ENTITY imagearchive.value "chrome://openerp_plugin/skin/document-new.png">
<!ENTITY tooltip.value "Add To Archive">
<!ENTITY pluginconfig.value "OpenERP Configuration Settings">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,6 +1,9 @@
pref("network.protocol-handler.app.http","/usr/bin/firefox");
pref("network.protocol-handler.app.https","/usr/bin/firefox");
pref("extensions.tiny.serverurl", "http://localhost");
pref("extensions.tiny.serverport", "8069");
pref("extensions.tiny.webserverurl", "http://localhost");
pref("extensions.tiny.webserverport", "8080");
pref("extensions.tiny.serverdbname", "terp");
pref("extensions.tiny.username","admin");
pref("extensions.tiny.password","admin");