[FIX] center windows + push on partner

bzr revid: tfr@openerp.com-20111226171229-g3szzsrs6zd0vg95
This commit is contained in:
tfr@openerp.com 2011-12-26 18:12:29 +01:00
parent f32c9e2356
commit 191d91c2f8
14 changed files with 30 additions and 93 deletions

View File

@ -93,8 +93,7 @@ class plugin_handler(osv.osv_memory):
msg = mail_message.parse_message(email)
message_id = msg.get('message-id')
mail_ids = mail_message.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
if model=='res.partner':
model_obj = self.pool.get('mail.thread')
if message_id and mail_ids :
mail_record = mail_message.browse(cr, uid, mail_ids)[0]
res_id = mail_record.res_id
@ -106,8 +105,12 @@ class plugin_handler(osv.osv_memory):
res_id = model_obj.message_new(cr, uid, msg)
notify = "Mail succefully pushed, a new %s has been created " % model
else:
model_obj.message_append_dict(cr, uid, [res_id], msg)
if model == 'res.partner':
model_obj = self.pool.get('mail.thread')
res = self.pool.get(model).browse(cr, uid, [res_id])
model_obj.message_append_dict(cr, uid, res, msg)
notify = "Mail succefully pushed"
url = self._make_url(cr, uid, res_id, model)
return (model, res_id, url, notify)

View File

@ -29,18 +29,11 @@ class thunderbird_installer(osv.osv_memory):
_name = 'thunderbird.installer'
_inherit = 'res.config.installer'
def default_get(self, cr, uid, fields, context=None):
data = super(thunderbird_installer, self).default_get(cr, uid, fields, context)
data['pdf_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_thunderbird.html'
file = open(addons.get_module_resource('thunderbird','plugin', 'openerp_plugin.xpi'),'rb')
data['plugin_file'] = base64.encodestring(file.read())
return data
_columns = {
'name':fields.char('File name', size=34),
'pdf_name':fields.char('File name', size=64),
'thunderbird':fields.boolean('Thunderbird Plug-in', help="Allows you to select an object that you would like to add to your email and its attachments."),
'plugin_file':fields.binary('Thunderbird Plug-in', readonly=True, help="Thunderbird plug-in file. Save as this file and install this plug-in in thunderbird."),
'plugin_file':fields.char('Thunderbird Plug-in', size=256, readonly=True, help="Thunderbird plug-in file. Save as this file and install this plug-in in thunderbird."),
'pdf_file':fields.char('Installation Manual', size=264, help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True),
'description':fields.text('Description', readonly=True)
}
@ -48,6 +41,8 @@ class thunderbird_installer(osv.osv_memory):
_defaults = {
'thunderbird' : True,
'name' : 'openerp_plugin.xpi',
'pdf_file' : 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_thunderbird.html',
'plugin_file' : 'https://addons.mozilla.org/en-US/thunderbird/addon/openerp-plugin/',
'description' : """
Thunderbird plugin installation:
1. Save the Thunderbird plug-­in.

View File

@ -10,7 +10,10 @@
<script type="text/javascript" src="chrome://openerp_plugin/content/js/create.js"></script>
<groupbox id="contact" >
<hbox>
<label align="right" value="Partner not found. create a new one ? "/>
<textbox class="plain" style="background-color: transparent;" flex="1"
multiline="true" readonly="true"
onoverflow="this.height = this.inputField.scrollHeight;"
value="No existing contact found, you can create a new partner with this contact or link to a existing partner" />
</hbox>
<hbox>
<label align="right" id="partner" value="&selectpartner.value;" width="90" class="text-prompt"/>

View File

@ -8,7 +8,7 @@ function load_config_data() {
function config_close() {
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
open_window('chrome://openerp_plugin/content/config.xul', 580,500);
}
//set the value of the configuration fields
@ -33,7 +33,7 @@ function config_ok()
function openConfigChange() {
window.close("chrome://openerp_plugin/content/config.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
open_window("chrome://openerp_plugin/content/config_change.xul", 350,200);
}
//xmlrpc request handler for getting the list of database

View File

@ -23,65 +23,11 @@ function check(fun) {
}
function searchmail()
{
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
//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);
//gives the received email date
var stdate = new Date(message.date / 1000);
//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
}
//gives the receiver email address
receiveremail = message.mime2DecodedRecipients;
//parsing the received date in the particular format
receivedDate = stdate.getFullYear()+'/'+(stdate.getMonth()+1)+'/'+stdate.getDate();
//gives the selected email subject
subject = message.subject;
log_message("subject: " + subject)
var uri = message.folder.getUriForMsg(message);
var messagebody = getMessage(uri);
getPref().setCharPref('email_text', messagebody);
//set the initial information for the selected email
window.open("chrome://openerp_plugin/content/push.xul", "", "chrome, resizable=yes");
}
var openPartnerHandler = {
onResult: function(client, context, result) {
res = extract_data(result)
if(res[RES_ID]==0) {
open_window("chrome://openerp_plugin/content/create.xul", 550, 230);
open_window("chrome://openerp_plugin/content/create.xul", 550, 250);
return;
}
open_url(res[URL])

View File

@ -111,7 +111,6 @@ function searchCheckbox()
//xmlrpc request handler for creating the record of mail
var pushHandler = {
onResult: function(client, context, result) {
log_message("push finished")
res = extract_data(result)
alert(res[ADDITIONAL_INFORMATION])
open_url(res[URL]);
@ -141,7 +140,6 @@ function push(op) {
var res_id = item.value;
}
log_message("model :" + model_name + ", res_id : " + res_id)
setServerService('xmlrpc/object');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var xmlRpcClient = getXmlRpc();

View File

@ -26,7 +26,7 @@
tooltiptext="&opendocumenttooltip.value;"
/>
<menuitem id="tiny-plugin3" label="Configuration"
oncommand="window.open('chrome://openerp_plugin/content/config.xul', '', 'chrome', 'resizable=yes');"
oncommand="open_window('chrome://openerp_plugin/content/config.xul', 580,500);"
image="&menuicon.settings;"
class="menuitem-iconic"
tooltiptext="&pluginconfig.value;"

View File

@ -11,7 +11,7 @@
<script type="text/javascript" src="chrome://openerp_plugin/content/js/push.js"></script>
<description></description>
<vbox>
<separator class="groove-thin" orient="horizontal" width="400"/>
<separator class="groove-thin" orient="horizontal"/>
<grid flex="1">
<columns>
<column />
@ -20,23 +20,16 @@
</columns>
<rows>
<row>
<label id="lblex3" align="right" width="135" control="section" value="&object.label;" class="text-prompt" />
<menulist id="menu_model_list" width="150">
<label id="lblex3" align="right" control="section" value="&object.label;" class="text-prompt" />
<menulist id="menu_model_list" >
<menupopup id="model_list">
<menuitem id="first_model_list" value="" label=""/>
</menupopup>
</menulist>
</row>
<row>
<menulist id="operation" hidden="true" width="150" oncommand="changeForm()">
<menupopup>
<menuitem label="Attach to an existing one" value="add"/>
</menupopup>
</menulist>
</row>
<row>
<label id="lblsearch" control="txtvalueobj" value="&search.label;" class="text-prompt"/>
<textbox id="txtvalueobj" size="30"/>
<textbox id="txtvalueobj" />
<button label="&bsearch.label;" oncommand="searchCheckbox()" image="&imagesearch.value;" accesskey="s" id="search_button"/>
</row>
</rows>
@ -45,7 +38,7 @@
<caption label="&document.label;" id="label_box"/>
</hbox>
<vbox >
<listbox height="250" width="100%" id="listSearchBox" style="border:1px solid red" seltype="multiple">
<listbox height="200" id="listSearchBox" style="border:1px solid red" seltype="multiple">
<listhead>
<listheader label="&listSearchBox.header;"/>
</listhead>
@ -54,10 +47,10 @@
</listcols>
</listbox>
</vbox>
<hbox align="right" width="480">
<hbox align="right" >
<button label="&attach.label;" accesskey="u" image="&imagearchive.value;" oncommand="push('add');"/>
</hbox>
<separator class="groove-thin" orient="horizontal" width="480"/>
<separator class="groove-thin" orient="horizontal"/>
</vbox>
</window>

View File

@ -14,8 +14,8 @@
</hbox>
<hbox align="right">
<button label="Cancel" accesskey="c" oncommand="window.close();"/>
<button id="push" label="Push Email" accesskey="a" oncommand=" window.close();window.open('chrome://openerp_plugin/content/push.xul', '', 'chrome', resizable='yes');"/>
<button id="new" label="Create Document" accesskey="c" oncommand="window.close();window.open('chrome://openerp_plugin/content/push_new.xul', '', 'chrome', resizable='yes');"/>
<button id="push" label="Push Email" accesskey="a" oncommand="window.close();open_window('chrome://openerp_plugin/content/push.xul', 500,360);"/>
<button id="new" label="Create Document" accesskey="c" oncommand="window.close();open_window('chrome://openerp_plugin/content/push_new.xul', 320,100);"/>
<button id="open_document" label="Open Document" accesskey="d" oncommand="open_url(getPreference('urldoc'));window.close();"/>
</hbox>
</vbox>

View File

@ -29,10 +29,9 @@
</row>
</rows>
</grid>
<hbox align="right" width="480">
<hbox align="right" >
<button label="&attach.label;" accesskey="u" image="&imagearchive.value;" oncommand="push();"/>
</hbox>
<separator class="groove-thin" orient="horizontal" width="480"/>
</vbox>
</window>

View File

@ -2,7 +2,7 @@
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{d57f315a-9f5d-4366-a530-a769a4a8c949}</em:id>
<em:id>thunderbird@openerp.com</em:id>
<em:iconURL>chrome://openerp_plugin/skin/tinyerp-icon.ico</em:iconURL>
<em:name>OpenERP Plugin</em:name>
<em:version>1.0</em:version>
@ -15,7 +15,7 @@
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>2.0</em:minVersion>
<em:maxVersion>8.0.*</em:maxVersion>
<em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>

View File

@ -33,7 +33,7 @@
<field name="pdf_name" invisible="1"/>
<newline/>
<field name="plugin_file" filename="name"/>
<field name="plugin_file" filename="name" widget="url"/>
<newline/>
<field name="pdf_file" filename="pdf_name" widget="url"/>
<newline/>