[MERGE]: Merge with lp:openobject-trunk-dev-addons2

bzr revid: ksa@tinyerp.co.in-20101004044724-y9e5pz53vkx3l2ki
This commit is contained in:
ksa (Open ERP)
2010-10-04 10:17:24 +05:30
61 changed files with 890 additions and 723 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ class report_aged_receivable(osv.osv):
while (last_month_date > fy_start_date):
LIST_RANGES.append(today + " to " + last_month_date.strftime('%Y-%m-%d'))
today = (last_month_date- 1).strftime('%Y-%m-%d')
today = (last_month_date- relativedelta(days=1)).strftime('%Y-%m-%d')
last_month_date = datetime.strptime(today, '%Y-%m-%d') - relativedelta(months=1)
LIST_RANGES.append(today +" to " + fy_start_date.strftime('%Y-%m-%d'))
+2 -11
View File
@@ -42,11 +42,7 @@
if l.reconcile_id:
reconciled = True
break
if not reconciled:
print "Info: Voucher is not paid"
else:
print "Info: Voucher is paid"
assert (not reconciled), "Found reconciled move lines, should not be"
-
I create and post a voucher payment of amount 30000.0 for the partner Seagate
-
@@ -74,8 +70,6 @@
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
-
I check that move lines are reconciled meaning voucher is paid
-
@@ -85,7 +79,4 @@
if l.reconcile_id:
reconciled = True
break
if not reconciled:
print "Info: Voucher is not paid"
else:
print "Info: Voucher is paid"
assert reconciled, "Found unreconciled move lines/unpaid voucher"
+13 -4
View File
@@ -113,6 +113,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
'filter_id':fields.many2one('ir.filters', 'Filter', required=False),
'act_email_from' : fields.char('Email From', size=64, required=False,
help="Use a python expression to specify the right field on which one than we will use for the 'From' field of the header"),
'act_email_to' : fields.char('Email To', size=64, required=False,
help="Use a python expression to specify the right field on which one than we will use for the 'To' field of the header"),
}
_defaults = {
@@ -356,13 +358,20 @@ the rule to mark CC(mail to any other person defined in actions)."),
emails += (action.act_email_cc or '').split(',')
if action.act_mail_to_email:
emails += (action.act_mail_to_email or '').split(',')
locals_for_emails = {
'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context),
'obj' : obj,
}
if action.act_email_to:
emails.append(safe_eval(action.act_email_to, {}, locals_for_emails))
emails = filter(None, emails)
if len(emails) and action.act_mail_body:
emails = list(set(emails))
email_from = safe_eval(action.act_email_from, {}, {
'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context),
'obj' : obj,
})
email_from = safe_eval(action.act_email_from, {}, locals_for_emails)
def to_email(text):
return re.findall(r'([^ ,<@]+@[^> ,]+)', text or '')
emails = to_email(','.join(filter(None, emails)))
@@ -65,12 +65,13 @@
<group col="2" colspan="2" attrs="{'invisible': [('act_remind_user','=',False)]}">
<field name="act_reply_to" attrs="{'required':[('act_remind_user','=',True)]}"/>
</group>
<separator colspan="4" string="Email Information"/>
<separator colspan="4" string="Email Information"/>
<field name="act_email_from" />
<field name="act_mail_to_user"/>
<field colspan="4" name="act_mail_to_email"/>
<field name="act_mail_to_watchers"/>
<field colspan="4" name="act_email_cc"/>
<field name="act_email_to" />
<field name="act_mail_to_user"/>
<field colspan="4" name="act_mail_to_email"/>
<field name="act_mail_to_watchers"/>
<field colspan="4" name="act_email_cc"/>
<separator colspan="4" string="Email Body"/>
<field colspan="4" name="act_mail_body" height="250"
nolabel="1" attrs="{'required':[('act_remind_user','=',True)]}" />
@@ -36,11 +36,11 @@ class base_calendar_invite_attendee(osv.osv_memory):
_columns = {
'type': fields.selection([('internal', 'Internal User'), \
('external', 'External Email'), \
('partner', 'Partner Contacts')], 'Type', required=True),
('partner', 'Partner Contacts')], 'Type', required=True, help="Select whom you want to Invite"),
'user_ids': fields.many2many('res.users', 'invite_user_rel',
'invite_id', 'user_id', 'Users'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'email': fields.char('Email', size=124),
'email': fields.char('Email', size=124, help="Provide external email address who will receive this invitation."),
'contact_ids': fields.many2many('res.partner.address', 'invite_contact_rel',
'invite_id', 'contact_id', 'Contacts'),
'send_mail': fields.boolean('Send mail?', help='Check this if you want to \
@@ -10,42 +10,31 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invite People">
<separator string="Invite People" colspan="4" />
<field name="type" />
<field name="send_mail" />
<newline />
<group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'external')]}">
<field name="email" colspan="4"
attrs="{'required': [('type', '=', 'external')]}" />
</group>
<group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'internal')]}">
<separator string="Users" colspan="4" />
<field name="user_ids" select="1" colspan="4"
nolabel="1" />
<newline />
</group>
<group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'partner')]}">
<field name="partner_id" colspan="2"
on_change="onchange_partner_id(partner_id)"
attrs="{'required': [('type', '=', 'partner')]}" />
<newline />
<separator string="Partner Contacts"
colspan="6" />
<field name="contact_ids" select="1" colspan="4"
nolabel="1" domain="[('partner_id', '=', partner_id)]"
attrs="{'readonly': [('type', '!=', 'partner')]}" />
</group>
<newline />
<separator string="" colspan="6" />
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="do_invite" string="Invite"
type="object" icon="gtk-ok" />
</group>
<separator string="Invite People" colspan="4"/>
<field name="type"/>
<field name="send_mail"/>
<notebook colspan="4">
<page string="Data">
<group col="2" colspan="6" attrs="{'invisible': [('type', '!=', 'external')]}">
<field name="email" colspan="4" attrs="{'required': [('type', '=', 'external')]}"/>
</group>
<group col="2" colspan="6" attrs="{'invisible': [('type', '!=', 'internal')]}">
<separator string="Users" colspan="4"/>
<field name="user_ids" select="1" colspan="4" nolabel="1" height="180"/>
<newline/>
</group>
<group col="2" colspan="6" attrs="{'invisible': [('type', '!=', 'partner')]}">
<field name="partner_id" colspan="2" on_change="onchange_partner_id(partner_id)" attrs="{'required': [('type', '=', 'partner')]}"/>
<newline/>
<separator string="Partner Contacts" colspan="6"/>
<field name="contact_ids" select="1" colspan="4" nolabel="1" domain="[('partner_id', '=', partner_id)]" attrs="{'readonly': [('type', '!=', 'partner')]}"/>
</group>
</page>
</notebook>
<group col="4" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button name="do_invite" string="Invite" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
@@ -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>
@@ -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>
+4 -1
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,
}
+5 -1
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:
+72 -10
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>
@@ -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>
@@ -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
+1
View File
@@ -19,4 +19,5 @@
#
##############################################################################
import base_synchro
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+63 -73
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:
@@ -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>
+7 -16
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"
+81 -97
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 user’s 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 user’s 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 user’s 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
+8 -6
View File
@@ -185,14 +185,16 @@ class crm_lead(crm_case, osv.osv):
@param *args: Give Tuple Value
"""
old_state = self.read(cr, uid, ids, ['state'])[0]['state']
old_stage_id = self.read(cr, uid, ids, ['stage_id'])[0]['stage_id']
res = super(crm_lead, self).case_open(cr, uid, ids, *args)
if old_state == 'draft':
stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args)
if stage_id:
value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']
else:
value = {}
value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id})
value = {}
if not old_stage_id:
stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args)
if stage_id:
value.update({'stage_id': stage_id})
value.update(self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value'])
value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
+6 -6
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>
+3 -4
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"
@@ -111,7 +110,7 @@
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Close"
<button name="case_mark_lost" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button name="case_pending" string="Pending"
@@ -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"
+3 -2
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="" />
-18
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>
-6
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"/>
+4 -3
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"/>
+1 -3
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),
+26 -26
View File
@@ -107,32 +107,32 @@
<field name="user_id" string="Salesman">
<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.lead')]" />
<field name="categ_id" widget="selection"/>
<field name="type_id" widget="selection"/>
<field name="channel_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
<newline/>
<group expand="1" string="Group By...">
</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.lead')]" />
<field name="categ_id" widget="selection"/>
<field name="type_id" widget="selection"/>
<field name="channel_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="creation_date"/>
<field name="opening_date"/>
<field name="date_closed"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<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-partner" context="{'group_by':'partner_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<filter string="Company" icon="terp-go-home"
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" />
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
<filter string="Company" icon="terp-go-home"
domain="[]"
context="{'group_by':'company_id'}" />
<separator orientation="vertical" />
@@ -154,14 +154,14 @@
domain="[]" context="{'group_by':'month'}" help="Month in which lead/opportunity is created"/>
<filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'name'}" help="Year in which lead/opportunity is created"/>
</group>
</search>
</group>
</search>
</field>
</record>
<!-- Opportunity tree view -->
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
<field name="name">crm.lead.report.tree</field>
<field name="model">crm.lead.report</field>
<field name="type">tree</field>
@@ -246,11 +246,11 @@
<menuitem name="Leads Analysis" id="menu_report_crm_leads_tree"
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_lead" sequence="3"/>
parent="base.next_id_64" action="action_report_crm_lead" sequence="3"/>
<menuitem name="Opportunities Analysis" id="menu_report_crm_opportunities_tree"
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_opportunity" sequence="4"/>
parent="base.next_id_64" action="action_report_crm_opportunity" sequence="4"/>
</data>
</openerp>
+3 -3
View File
@@ -11,7 +11,7 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="History" position="inside">
<field name="opportunity_ids" colspan="4" nolabel="1">
<field name="opportunity_ids" colspan="4" nolabel="1" context="{'default_partner_id': active_id}">
<tree string="Leads and Opportunities" colors="blue:state=='pending';gray:state=='cancel'">
<field name="create_date"/>
<field name="name"/>
@@ -44,7 +44,7 @@
icon="gtk-cancel" />
</tree>
</field>
<field name="meeting_ids" colspan="4" nolabel="1" >
<field name="meeting_ids" colspan="4" nolabel="1" context="{'default_partner_id': active_id}">
<tree string="Meetings" colors="gray:state in ('draft', 'cancel','done','pending')">
<field name="user_id" string="Responsible"/>
<field name="name" string="Subject" />
@@ -52,7 +52,7 @@
<field name="date_deadline" string="End Date"/>
</tree>
</field>
<field name="phonecall_ids" colspan="4" nolabel="1">
<field name="phonecall_ids" colspan="4" nolabel="1" context="{'default_partner_id': active_id}">
<tree string="Phone Calls" colors="gray:state in ('draft', 'cancel','done','pending')">
<field name="date" string="Date"/>
<field name="name" string="Call Summary"/>
+1 -1
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.\
+6 -1
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>
+2 -2
View File
@@ -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>
+1 -3
View File
@@ -61,9 +61,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),
+1 -3
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'),
@@ -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">
@@ -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),
@@ -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
+1 -10
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>
@@ -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>
+1
View File
@@ -34,6 +34,7 @@
"mail_gateway_view.xml",
"res_partner_view.xml",
'security/ir.model.access.csv'
],
'demo_xml': [],
'installable': True,
+53 -1
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:
@@ -327,7 +371,7 @@ class mailgate_tool(osv.osv_memory):
msg['to'] = email_error
tools.misc._email_send(smtp_from, self.to_email(email_error), msg, openobject_id=res.id)
def process_email(self, cr, uid, model, message, attach=True, context=None):
def process_email(self, cr, uid, model, message, custom_values=None, attach=True, context=None):
"""This function Processes email and create record for given OpenERP model
@param self: The object pointer
@param cr: the current row, from the database cursor,
@@ -345,6 +389,10 @@ class mailgate_tool(osv.osv_memory):
if not context:
context = {}
if custom_values is None or not isinstance(custom_values, dict):
custom_values = {}
model_pool = self.pool.get(model)
res_id = False
# Create New Record into particular model
@@ -352,6 +400,8 @@ class mailgate_tool(osv.osv_memory):
att_ids = []
if hasattr(model_pool, 'message_new'):
res_id = model_pool.message_new(cr, uid, msg, context)
if custom_values:
model_pool.write(cr, uid, [res_id], custom_values, context=context)
else:
data = {
'name': msg.get('subject'),
@@ -539,3 +589,5 @@ class mailgate_tool(osv.osv_memory):
return res
mailgate_tool()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+18 -9
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>
@@ -28,7 +28,7 @@ import xmlrpclib
import email
class rpc_proxy(object):
def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='terp'):
def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='openerp'):
self.rpc = xmlrpclib.ServerProxy('http://%s:%s/xmlrpc/%s' % (host, port, path), allow_none=True)
self.user_id = uid
self.passwd = passwd
@@ -49,11 +49,13 @@ class email_parser(object):
self.email_default = email_default
def parse(self, message):
def parse(self, message, custom_values=None):
if custom_values is None:
custom_values = {}
try:
# pass message as bytes because we don't know its encoding until we parse its headers
# and hence can't convert it to utf-8 for transport
res_id = self.rpc('email.server.tools', 'process_email', self.model, xmlrpclib.Binary(message))
res_id = self.rpc('email.server.tools', 'process_email', self.model, xmlrpclib.Binary(message), custom_values)
except Exception, e:
logger = logging.getLogger('mail-gateway')
logger.warning('Failed to process incoming email. Source of the failed mail is available at debug level.', exc_info=True)
@@ -70,9 +72,10 @@ if __name__ == '__main__':
parser.add_option("-p", "--password", dest="password", help="Password of the user in OpenERP", default='admin')
parser.add_option("-o", "--model", dest="model", help="Name or ID of crm model", default="crm.lead")
parser.add_option("-m", "--default", dest="default", help="Default eMail in case of any trouble.", default=None)
parser.add_option("-d", "--dbname", dest="dbname", help="Database name (default: terp)", default='terp')
parser.add_option("-d", "--dbname", dest="dbname", help="Database name (default: openerp)", default='openerp')
parser.add_option("--host", dest="host", help="Hostname of the OpenERP Server", default="localhost")
parser.add_option("--port", dest="port", help="Port of the OpenERP Server", default="8069")
parser.add_option("--custom-values", dest="custom_values", help="Add Custom Values to the object", default=None)
(options, args) = parser.parse_args()
@@ -82,6 +85,12 @@ if __name__ == '__main__':
msg_txt = sys.stdin.read()
parser.parse(msg_txt)
custom_values = {}
try:
custom_values = dict(eval(options.custom_values))
except:
pass
parser.parse(msg_txt, custom_values)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1 +1,2 @@
python addin.py
pause
@@ -1 +1,2 @@
python addin.py --unregister
pause
@@ -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")
),
}
@@ -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
@@ -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
@@ -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
+2 -2
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>
+2 -1
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>
@@ -233,6 +233,7 @@
/>
<separator orientation="vertical"/>
<field name="name" string="Name"/>
<field name="partner_id" string="Partner" />
<field name="user_id"/>
<field name="project_id" string="Project"/>
<field name="categ_id"/>
+18 -3
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)])
Binary file not shown.
@@ -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>
@@ -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 = {
@@ -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>
@@ -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");
@@ -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

@@ -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");