Added thunderbird plugin with usability improvemenents and Improved product data for getting exact uom factor
bzr revid: hda@tinyerp.com-20100601064247-es5ebwsbeths03vp
This commit is contained in:
@@ -21,32 +21,27 @@
|
||||
<field name="category_id" ref="product_uom_categ_unit"/>
|
||||
<field name="name">PCE</field>
|
||||
<field name="factor">1.0</field>
|
||||
<field name="factor_inv_data">1.0</field>
|
||||
<field name="rounding">1.0</field>
|
||||
</record>
|
||||
<record id="product_uom_kgm" model="product.uom">
|
||||
<field name="category_id" ref="product_uom_categ_kgm"/>
|
||||
<field name="name">KGM</field>
|
||||
<field name="factor">1000.0</field>
|
||||
<field name="factor_inv_data">1.0</field>
|
||||
</record>
|
||||
<record id="uom_hour" model="product.uom">
|
||||
<field name="name">Hour</field>
|
||||
<field eval="uom_categ_wtime" name="category_id"/>
|
||||
<field name="factor">8.0</field>
|
||||
<field name="factor_inv_data">1.0</field>
|
||||
</record>
|
||||
<record id="uom_day" model="product.uom">
|
||||
<field name="name">Day</field>
|
||||
<field eval="uom_categ_wtime" name="category_id"/>
|
||||
<field name="factor">1.0</field>
|
||||
<field name="factor_inv_data">1.0</field>
|
||||
</record>
|
||||
<record id="product_uom_ton" model="product.uom">
|
||||
<field name="category_id" ref="product_uom_categ_kgm"/>
|
||||
<field name="name">TON</field>
|
||||
<field name="factor">1.0</field>
|
||||
<field name="factor_inv_data">1.0</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -29,38 +29,28 @@ class thunderbird_installer(osv.osv_memory):
|
||||
_name = 'thunderbird.installer'
|
||||
_inherit = 'res.config.installer'
|
||||
|
||||
def process_plugin(self, cr, uid, ids, context):
|
||||
"""
|
||||
Default Attach Thunderbird Plug-in File.
|
||||
"""
|
||||
data = {}
|
||||
file = open(config['addons_path'] + "/thunderbird/plugin/tiny_plugin-2.0.xpi", 'r')
|
||||
data['plugin_file'] = base64.encodestring(file.read())
|
||||
self.write(cr, uid, ids, data)
|
||||
return False
|
||||
|
||||
def process_pdf_file(self, cr, uid, ids, context):
|
||||
"""
|
||||
Default Attach Thunderbird Plug-in Installation File.
|
||||
"""
|
||||
data = {}
|
||||
def default_get(self, cr, uid, fields, context={}):
|
||||
data = super(thunderbird_installer, self).default_get(cr, uid, fields, context)
|
||||
pdf_file = open(config['addons_path'] + "/thunderbird/doc/Installation Guide to OpenERP Thunderbid Plug-in.pdf", 'r')
|
||||
data['pdf_file'] = base64.encodestring(pdf_file.read())
|
||||
self.write(cr, uid, ids, data)
|
||||
return False
|
||||
file = open(config['addons_path'] + "/thunderbird/plugin/tiny_plugin-2.0.xpi", 'r')
|
||||
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 Module ', help="Allows you to select an object that you’d 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 thunderbir."),
|
||||
'pdf_file':fields.binary('Thunderbird Plug-in Installation File', help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True),
|
||||
'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."),
|
||||
'pdf_file':fields.binary('Installation Manual', help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True),
|
||||
'description':fields.text('Description', readonly=True)
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'thunderbird' : True,
|
||||
'name' : 'tiny_plugin-2.0.xpi',
|
||||
'pdf_name' : 'Installation Guide to OpenERP Thunderbid Plug-in.pdf',
|
||||
'description' : """ * Save The thunderbird plugin Follow the following step to install thunderbird plugin. \n -> 1. From Menu Bar, Open Tools > Add ons. \n -> 2. Now click on install button and a browser window will appear. \n -> 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. \n -> 4. Click on Install Now and restart Thunderbird. \n -> 5. Now Thunderbird plugin is installed."""
|
||||
}
|
||||
|
||||
thunderbird_installer()
|
||||
|
||||
@@ -90,9 +90,9 @@ class tinythunderbird_partner(osv.osv):
|
||||
case_pool=self.pool.get(dictcreate.get('object','crm.case'))
|
||||
partner_ids=add_obj.search(cr,user,[('email','=',dictcreate['email_from'])])
|
||||
partner=add_obj.read(cr,user,partner_ids,['partner_id'])
|
||||
if partner:
|
||||
if partner and partner[0] and partner[0]['partner_id']:
|
||||
dictcreate.update({'partner_id':partner[0]['partner_id'][0]})
|
||||
create_id = self.pool.get(dictcreate.get('object','crm.case')).create(cr, user, dictcreate)
|
||||
create_id = case_pool.create(cr, user, dictcreate)
|
||||
cases=case_pool.browse(cr,user,[create_id])
|
||||
case_pool._history(cr, user, cases, _('Archive'), history=True, email=False)
|
||||
return create_id
|
||||
@@ -104,10 +104,11 @@ class tinythunderbird_partner(osv.osv):
|
||||
|
||||
def thunderbird_createpartner(self,cr,user,vals):
|
||||
dictcreate = dict(vals)
|
||||
search_id = self.pool.get('res.partner').search(cr, user,[('name','=',dictcreate['name'])])
|
||||
address_obj = self.pool.get('res.partner')
|
||||
search_id = address_obj.search(cr, user,[('name','=',dictcreate['name'])])
|
||||
if search_id:
|
||||
return 0
|
||||
create_id = self.pool.get('res.partner').create(cr, user, dictcreate)
|
||||
create_id = address_obj.create(cr, user, dictcreate)
|
||||
return create_id
|
||||
|
||||
def thunderbird_searchobject(self,cr,user,vals):
|
||||
@@ -116,12 +117,13 @@ class tinythunderbird_partner(osv.osv):
|
||||
return (search_id and search_id[0]) or 0
|
||||
|
||||
def thunderbird_searchcontact(self,cr,user,vals):
|
||||
search_id1 = self.pool.get('res.partner.address').search(cr,user,[('name','ilike',vals)])
|
||||
search_id2 = self.pool.get('res.partner.address').search(cr,user,[('email','=',vals)])
|
||||
address_obj = self.pool.get('res.partner.address')
|
||||
search_id1 = address_obj.search(cr,user,[('name','ilike',vals)])
|
||||
search_id2 = address_obj.search(cr,user,[('email','=',vals)])
|
||||
if search_id1:
|
||||
return self.pool.get('res.partner.address').name_get(cr, user, search_id1)
|
||||
return address_obj.name_get(cr, user, search_id1)
|
||||
elif search_id2:
|
||||
return self.pool.get('res.partner.address').name_get(cr, user, search_id2)
|
||||
return address_obj.name_get(cr, user, search_id2)
|
||||
return []
|
||||
|
||||
def thunderbird_tempsearch(self,cr,user,vals):
|
||||
@@ -132,21 +134,22 @@ class tinythunderbird_partner(osv.osv):
|
||||
name_get=[]
|
||||
er_val=[]
|
||||
for object in obj:
|
||||
dyn_object = self.pool.get(object)
|
||||
if object == 'res.partner.address':
|
||||
search_id1 = self.pool.get(object).search(cr,user,[('name','ilike',value)])
|
||||
search_id2 = self.pool.get(object).search(cr,user,[('email','=',value)])
|
||||
search_id1 = dyn_object.search(cr,user,[('name','ilike',value)])
|
||||
search_id2 = dyn_object.search(cr,user,[('email','=',value)])
|
||||
if search_id1:
|
||||
name_get.append(object)
|
||||
name_get.append(self.pool.get(object).name_get(cr, user, search_id1))
|
||||
name_get.append(dyn_object.name_get(cr, user, search_id1))
|
||||
elif search_id2:
|
||||
name_get.append(object)
|
||||
name_get.append(self.pool.get(object).name_get(cr, user, search_id2))
|
||||
name_get.append(dyn_object.name_get(cr, user, search_id2))
|
||||
else:
|
||||
try:
|
||||
search_id1 = self.pool.get(object).search(cr,user,[('name','ilike',value)])
|
||||
search_id1 = dyn_object.search(cr,user,[('name','ilike',value)])
|
||||
if search_id1:
|
||||
name_get.append(object)
|
||||
name_get.append(self.pool.get(object).name_get(cr, user, search_id1))
|
||||
name_get.append(dyn_object.name_get(cr, user, search_id1))
|
||||
except:
|
||||
er_val.append(object)
|
||||
continue
|
||||
@@ -179,17 +182,38 @@ class tinythunderbird_partner(osv.osv):
|
||||
|
||||
def read(self, cr, user, ids, fields=None, context={}, load='_classic_read'):
|
||||
ret_read = super(tinythunderbird_partner, self).read(cr, user, ids,fields,context,load)
|
||||
attach_obj = self.pool.get('ir.attachment')
|
||||
for read_data in ret_read:
|
||||
attachments = self.pool.get('ir.attachment').search(cr,user,[('res_model','=',self._name),('res_id','=',read_data['id'])])
|
||||
attechments_data = self.pool.get('ir.attachment').read(cr,user,attachments,['name'])
|
||||
attachments = attach_obj.search(cr,user,[('res_model','=',self._name),('res_id','=',read_data['id'])])
|
||||
attechments_data = sattach_obj.read(cr,user,attachments,['name'])
|
||||
file_names = [a['name'] for a in attechments_data]
|
||||
text_atteched = '\n'.join(file_names)
|
||||
read_data['attachments'] = text_atteched
|
||||
return ret_read
|
||||
|
||||
def unlink(self, cr, uid, ids, context={}):
|
||||
attachments = self.pool.get('ir.attachment').search(cr,uid,[('res_model','=',self._name),('res_id','in',ids)])
|
||||
self.pool.get('ir.attachment').unlink(cr,uid,attachments)
|
||||
attach_obj = self.pool.get('ir.attachment')
|
||||
attachments = attach_obj.search(cr,uid,[('res_model','=',self._name),('res_id','in',ids)])
|
||||
attach_obj.unlink(cr,uid,attachments)
|
||||
return super(tinythunderbird_partner, self).unlink(cr, uid, ids,context)
|
||||
|
||||
tinythunderbird_partner()
|
||||
def thunderbird_objectsearch(self,cr,user,vals):
|
||||
obj_list= [('crm.claim', 'Claim'), ('crm.lead','Lead'), ('crm.meeting','Metting'), ('crm.opportunity','Opportunity'), ('crm.phonecall','Phonecall'), ('crm.fundraising','Fund raising'), ('crm.helpdesk','Helpdesk')]
|
||||
object=[]
|
||||
model_obj = self.pool.get('ir.model')
|
||||
for obj in obj_list:
|
||||
if model_obj.search(cr, user, [('model', '=', obj[0])]):
|
||||
object.append(obj)
|
||||
return object
|
||||
|
||||
def thunderbird_list_search_object(self,cr,user,vals):
|
||||
model_obj = self.pool.get('ir.model')
|
||||
object=''
|
||||
for obj in vals[0][1].split(','):
|
||||
if model_obj.search(cr, user, [('model', '=', obj)]):
|
||||
object += obj + ","
|
||||
else:
|
||||
object += "null,"
|
||||
return object
|
||||
|
||||
tinythunderbird_partner()
|
||||
|
||||
Binary file not shown.
@@ -1,3 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_tinythunderbird_partner","tinythunderbird.partner","model_tinythunderbird_partner",,1,1,1,1
|
||||
|
||||
"access_thunderbird_installer","thunderbird.installer","model_thunderbird_installer","base.group_user",1,1,1,1
|
||||
|
||||
|
@@ -29,13 +29,11 @@
|
||||
<newline/>
|
||||
|
||||
<field name="plugin_file" filename="name"/>
|
||||
<button name="process_plugin" icon="gtk-execute" string="Get Plugin File" type="object"/>
|
||||
<newline/>
|
||||
<field name="pdf_file" filename="pdf_name"/>
|
||||
<button name="process_pdf_file" icon="gtk-execute" string="Get Plugin Installation File" type="object"/>
|
||||
<newline/>
|
||||
<separator string="Thunderbird plugin installation note." colspan="4"/>
|
||||
<label colspan="8" string="Save The thunderbird plugin Follow the following step to install thunderbird plugin ? 1. From Menu Bar, Open Tools > Add ons. 2. Now click on install button and a browser window will appear. 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. 4. Click on Install Now and restart Thunderbird. 5. Now Thunderbird plugin is installed."/>
|
||||
<field name="description" nolabel="1" colspan="8"/>
|
||||
</group>
|
||||
</group>
|
||||
</data>
|
||||
@@ -74,16 +72,18 @@
|
||||
<label align="0.0" string="This module is required for the thuderbird plug-in to work properly.This allows you to select an object that you had like to add to your email and its attachments. You can select a partner, a task, a project, an analytical account, or any other object and attach selected mail as .eml file in attachment of selected record." width="200"/>
|
||||
</group>
|
||||
<group colspan="8">
|
||||
<separator string="Thunderbird" colspan="4"/>
|
||||
<field name="thunderbird"/>
|
||||
<field name="name" invisible="1"/>
|
||||
<newline/>
|
||||
<field name="plugin_file"/>
|
||||
<button name="process_plugin" icon="gtk-execute" string="Get Plugin File" type="object"/>
|
||||
<newline/>
|
||||
<separator string="Thunderbird plugin installation note." colspan="4"/>
|
||||
<label colspan="8" string="Save The thunderbird plugin Follow the following step to install thunderbird plugin ? 1. From Menu Bar, Open Tools > Add ons. 2. Now click on install button and a browser window will appear. 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. 4. Click on Install Now and restart Thunderbird. 5. Now Thunderbird plugin is installed."/>
|
||||
</group>
|
||||
<field name="thunderbird"/>
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="pdf_name" invisible="1"/>
|
||||
<newline/>
|
||||
|
||||
<field name="plugin_file" filename="name"/>
|
||||
<newline/>
|
||||
<field name="pdf_file" filename="pdf_name"/>
|
||||
<newline/>
|
||||
<separator string="Thunderbird plugin installation note." colspan="4"/>
|
||||
<field name="description" nolabel="1" colspan="8"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="" colspan="4"/>
|
||||
|
||||
Reference in New Issue
Block a user