diff --git a/addons/account_invoice_layout/account_invoice_layout_demo.xml b/addons/account_invoice_layout/account_invoice_layout_demo.xml index cb8df67d997..e49079c9656 100644 --- a/addons/account_invoice_layout/account_invoice_layout_demo.xml +++ b/addons/account_invoice_layout/account_invoice_layout_demo.xml @@ -4,11 +4,11 @@ OpenERP SA - ERP & CRM Solutions.... + ERP & CRM Solutions.... Tiny sprl Be Expert with the Experts... - \ No newline at end of file + diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 11bd22e6134..facb598427b 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -398,10 +398,13 @@ property or property parameter."), """ res = None def ics_datetime(idate, short=False): - if short: - return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d'))) + if idate: + if short: + return date.fromtimestamp(time.mktime(time.strptime(idate, '%Y-%m-%d'))) + else: + return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S') else: - return datetime.strptime(idate, '%Y-%m-%d %H:%M:%S') + return False try: # FIXME: why isn't this in CalDAV? import vobject @@ -482,35 +485,37 @@ property or property parameter."), sign = att.sent_by_uid and att.sent_by_uid.signature or '' sign = '
'.join(sign and sign.split('\n') or []) res_obj = att.ref - sub = res_obj.name - att_infos = [] - other_invitaion_ids = self.search(cr, uid, [('ref', '=', res_obj._name + ',' + str(res_obj.id))]) - for att2 in self.browse(cr, uid, other_invitaion_ids): - att_infos.append(((att2.user_id and att2.user_id.name) or \ - (att2.partner_id and att2.partner_id.name) or \ - att2.email) + ' - Status: ' + att2.state.title()) - body_vals = {'name': res_obj.name, - 'start_date': res_obj.date, - 'end_date': res_obj.date_deadline or False, - 'description': res_obj.description or '-', - 'location': res_obj.location or '-', - 'attendees': '
'.join(att_infos), - 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', - 'sign': sign, - 'company': company - } - body = html_invitation % body_vals - if mail_to and email_from: - attach = self.get_ics_file(cr, uid, res_obj, context=context) - tools.email_send( - email_from, - mail_to, - sub, - body, - attach=attach and [('invitation.ics', attach)] or None, - subtype='html', - reply_to=email_from - ) + if res_obj: + att_infos = [] + sub = res_obj.name + other_invitation_ids = self.search(cr, uid, [('ref', '=', res_obj._name + ',' + str(res_obj.id))]) + + for att2 in self.browse(cr, uid, other_invitation_ids): + att_infos.append(((att2.user_id and att2.user_id.name) or \ + (att2.partner_id and att2.partner_id.name) or \ + att2.email) + ' - Status: ' + att2.state.title()) + body_vals = {'name': res_obj.name, + 'start_date': res_obj.date, + 'end_date': res_obj.date_deadline or False, + 'description': res_obj.description or '-', + 'location': res_obj.location or '-', + 'attendees': '
'.join(att_infos), + 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', + 'sign': sign, + 'company': company + } + body = html_invitation % body_vals + if mail_to and email_from: + attach = self.get_ics_file(cr, uid, res_obj, context=context) + tools.email_send( + email_from, + mail_to, + sub, + body, + attach=attach and [('invitation.ics', attach)] or None, + subtype='html', + reply_to=email_from + ) return True def onchange_user_id(self, cr, uid, ids, user_id, *args, **argv): diff --git a/addons/base_calendar/wizard/base_calendar_invite_attendee.py b/addons/base_calendar/wizard/base_calendar_invite_attendee.py index f60139c0600..98369962ab7 100644 --- a/addons/base_calendar/wizard/base_calendar_invite_attendee.py +++ b/addons/base_calendar/wizard/base_calendar_invite_attendee.py @@ -128,8 +128,9 @@ send an Email to Invited Person') att = att_obj.browse(cr, uid, context_id) att_val.update({ 'parent_ids': [(4, att.id)], - 'ref': att.ref._name + ',' +str(att.ref.id) + 'ref': att.ref and (att.ref._name + ',' +str(att.ref.id)) or False }) + attendees.append(att_obj.create(cr, uid, att_val)) if model_field: for attendee in attendees: diff --git a/addons/crm/report/report_businessopp.py b/addons/crm/report/report_businessopp.py index 7cadb41359a..07751622abe 100644 --- a/addons/crm/report/report_businessopp.py +++ b/addons/crm/report/report_businessopp.py @@ -83,12 +83,12 @@ class report_custom(report_int): if benefit < minbenef: minbenef = benefit - tuple = (proba * 100, benefit) + tuple_benefit = (proba * 100, benefit) responsible_data.setdefault(userid, []) - responsible_data[userid].append(tuple) + responsible_data[userid].append(tuple_benefit) - tuple = (proba * 100, cost, benefit) - data.append(tuple) + tuple_benefit = (proba * 100, cost, benefit) + data.append(tuple_benefit) responsible_names[userid] = (row['name'] or '/').replace('/','//') diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index c8d75a3a873..c775b97d520 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -136,8 +136,8 @@ class mailgate_thread(osv.osv): 'partner_id': partner_id, 'res_id': case.id, 'date': time.strftime('%Y-%m-%d %H:%M:%S'), - 'message_id': message_id, - 'description': details or (hasattr(case, 'description') and case.description or False), + 'message_id': message_id, + 'description': details or (hasattr(case, 'description') and case.description or False), 'attachment_ids': [(6, 0, attachments)] } @@ -283,7 +283,7 @@ class mailgate_tool(osv.osv_memory): 'description': msg.get('body', msg.get('from')), 'history': True, 'partner_id': partner_id, - 'res_model': model, + 'model': model, 'email_cc': msg.get('cc'), 'email_from': msg.get('from'), 'email_to': msg.get('to'), diff --git a/addons/mail_gateway/mail_gateway_view.xml b/addons/mail_gateway/mail_gateway_view.xml index 203d9a942bf..de1a88c34c7 100644 --- a/addons/mail_gateway/mail_gateway_view.xml +++ b/addons/mail_gateway/mail_gateway_view.xml @@ -10,13 +10,13 @@ - + - + @@ -50,7 +50,9 @@ - + + + @@ -63,13 +65,21 @@ - - + + + + + + + + + + + - mailgate.thread.form mailgate.thread @@ -127,8 +137,9 @@ form [('history', '=', True)] + {"search_default_user_id":uid} - + Mailgateway Threads mailgate.thread @@ -149,7 +160,7 @@ - + Emails @@ -159,7 +170,7 @@ [('history', '=', True)] - + tree @@ -173,10 +184,6 @@ - - - + + + + + + + diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index a7066e2c1a3..5ad90bf25d6 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -19,6 +19,8 @@ # ############################################################################## +from itertools import groupby +from operator import itemgetter from datetime import datetime from osv import osv, fields from tools.translate import _ @@ -353,14 +355,16 @@ class many2many_domain(fields.many2many): def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} - res = {} + move_obj = obj.pool.get('stock.move') - for prod in obj.browse(cr, user, ids, context=context): - cr.execute("SELECT move_id from mrp_production_move_ids where\ - production_id=%s" % (prod.id)) - m_ids = map(lambda x: x[0], cr.fetchall()) - final = move_obj.search(cr, user, self._domain + [('id', 'in', tuple(m_ids))]) - res[prod.id] = final + res = {}.fromkeys(ids, []) + valid_move_ids = move_obj.search(cr, user, self._domain) # move ids relative to domain argument + cr.execute("SELECT production_id, move_id from mrp_production_move_ids where production_id in %s and move_id in %s", + [tuple(ids), tuple(valid_move_ids)]) + related_move_map = cr.fetchall() + related_move_dict = dict((k, list(set([v[1] for v in itr]))) for k, itr in groupby(related_move_map, itemgetter(0))) + res.update(related_move_dict) + return res class one2many_domain(fields.one2many): @@ -371,13 +375,14 @@ class one2many_domain(fields.one2many): def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} - res = {} + move_obj = obj.pool.get('stock.move') - for prod in obj.browse(cr, user, ids, context=context): - cr.execute("SELECT id from stock_move where production_id=%s" % (prod.id)) - m_ids = map(lambda x: x[0], cr.fetchall()) - final = move_obj.search(cr, user, self._domain + [('id', 'in', tuple(m_ids))]) - res[prod.id] = final + res = {}.fromkeys(ids, []) + key = operator.itemgetter(0) + move_ids = move_obj.search(cr, user, self._domain+[('production_id', 'in', tuple(ids))], context=context) + related_move_dict = dict([(o.production_id.id, [o.id]) for o in move_obj.browse(cr, user, move_ids, context=context)]) + res.update(related_move_dict) + return res class mrp_production(osv.osv): diff --git a/addons/outlook/installer.py b/addons/outlook/installer.py index f042ce9c94e..84349a64d17 100755 --- a/addons/outlook/installer.py +++ b/addons/outlook/installer.py @@ -31,8 +31,7 @@ class outlook_installer(osv.osv_memory): def default_get(self, cr, uid, fields, context={}): data = super(outlook_installer, self).default_get(cr, uid, fields, context) - doc_file = open(config['addons_path'] + "/outlook/doc/Installation Guide to OpenERP Outlook Plug-in.doc", 'r') - data['doc_file'] = base64.encodestring(doc_file.read()) + data['doc_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_outlook.html' file = open(config['addons_path'] + "/outlook/plugin/openerp-outlook-plugin.zip", 'r') data['plugin_file'] = base64.encodestring(file.read()) return data @@ -42,7 +41,7 @@ class outlook_installer(osv.osv_memory): 'doc_name':fields.char('File name', size=64), 'outlook':fields.boolean('Outlook Plug-in ', help="Allows you to select an object that you’d like to add to your email and its attachments."), 'plugin_file':fields.binary('Outlook Plug-in', readonly=True, help="outlook plug-in file. Save as this file and install this plug-in in outlook."), - 'doc_file':fields.binary('Installation Manual', help="The documentation file :- how to install Outlook Plug-in.", readonly=True), + 'doc_file':fields.char('Installation Manual',size="264",help="The documentation file :- how to install Outlook Plug-in.", readonly=True), 'description':fields.text('Description', readonly=True) } @@ -63,7 +62,7 @@ How to install openerp-outlook plug-in? 3. Run “Register-plugin.bat” file. 4. Run Outlook and Check addon has been registered. 5. Tools->OpenERP Configuration and test your connection. - 6. See User Guide for more information. + 6. See User Guide for more information. 7. Keep All extratced files in some safe places (e.g. python installation Directory "C:\pythonXX\" or Windows installation Directory "C:\Program Files\" ). """ diff --git a/addons/outlook/outlook_installer.xml b/addons/outlook/outlook_installer.xml index 99b440bf89a..e9fd756ff3d 100755 --- a/addons/outlook/outlook_installer.xml +++ b/addons/outlook/outlook_installer.xml @@ -38,7 +38,7 @@ - + @@ -74,20 +74,15 @@ {'menu':True} - - - - - diff --git a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc index 63fe9f64ba4..bef1c0ef516 100755 --- a/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc +++ b/addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc @@ -86,7 +86,7 @@ EXSTYLE WS_EX_CONTEXTHELP CAPTION "About" FONT 8, "Tahoma", 400, 0, 0x0 BEGIN - GROUPBOX "About Plugin",IDC_STATIC,7,3,422,200 + GROUPBOX "About OpenERP Outlook Plugin",IDC_STATIC,7,3,422,200 CONTROL 1062,IDB_OPENERPLOGO,"Static",SS_BITMAP | SS_REALSIZEIMAGE,60,30,20,20 LTEXT "",IDC_ABOUT,80,90,250,100 END diff --git a/addons/project/project.py b/addons/project/project.py index 0b9584655a8..6959a19fd03 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -22,12 +22,14 @@ from lxml import etree import time from datetime import datetime, date +from operator import itemgetter +from itertools import groupby +from tools.misc import flatten from tools.translate import _ from osv import fields, osv from tools import email_send as email -from operator import itemgetter class project_task_type(osv.osv): _name = 'project.task.type' @@ -77,20 +79,6 @@ class project(osv.osv): pricelist_id = pricelist.get('property_product_pricelist', False) and pricelist.get('property_product_pricelist')[0] or False return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist_id}} - def get_all_child_projects(self, cr, uid, ids, context=None): - # Calculate child project for Given project id => For progress rate + planned time + Time spent - cr.execute('''SELECT prpc.id AS id from account_analytic_account AS p - JOIN account_analytic_account AS c ON p.id = c.parent_id - JOIN project_project AS prp ON prp.analytic_account_id = p.id - JOIN project_project AS prpc ON prpc.analytic_account_id = c.id - WHERE prp.id IN %s''',(tuple(ids),)) - - child_ids = cr.fetchall() - if child_ids: - child_ids = [x[0] for x in child_ids] - child_ids = self.get_all_child_projects(cr, uid, child_ids) - return ids + child_ids - def _get_user_and_default_uom_ids(self, cr, uid): users_obj = self.pool.get('res.users') model_data_obj = self.pool.get('ir.model.data') @@ -102,17 +90,33 @@ class project(osv.osv): return user_uom, default_uom def _progress_rate(self, cr, uid, ids, names, arg, context=None): + def _get_all_child_projects(ids): + """Recursively get child project ids""" + child_ids = flatten([project_hierarchy.get(idn, []) for idn in ids]) + if child_ids: + child_ids = _get_all_child_projects(child_ids) + return ids + child_ids + # END _get_all_child_projects + res = {}.fromkeys(ids, 0.0) progress = {} if not ids: return res - par_child_projects={} + par_child_projects = {} all_projects = list(ids) + # get project hierarchy: + cr.execute('''SELECT prp.id AS pr_parent_id, prpc.id AS pr_child_id + FROM account_analytic_account AS p + JOIN account_analytic_account AS c ON p.id = c.parent_id + JOIN project_project AS prp ON prp.analytic_account_id = p.id + JOIN project_project AS prpc ON prpc.analytic_account_id = c.id''') + + project_hierarchy = dict((k, list(set([v[1] for v in itr]))) for k, itr in groupby(cr.fetchall(), itemgetter(0))) + for id in ids: - child_projects = self.get_all_child_projects(cr, uid, [id], context) - child_projects = [x for x in child_projects] + child_projects = _get_all_child_projects([id]) par_child_projects[id] = child_projects all_projects.extend(child_projects) @@ -128,6 +132,7 @@ class project(osv.osv): project_id''',(tuple(all_projects),)) progress = dict(map(lambda x: (x[0], (x[1], x[2], x[3])), cr.fetchall())) + user_uom, def_uom = self._get_user_and_default_uom_ids(cr, uid) for project in self.browse(cr, uid, par_child_projects.keys(), context=context): s = [0.0, 0.0, 0.0] tocompute = par_child_projects[project.id] @@ -137,7 +142,6 @@ class project(osv.osv): s[i] += progress.get(p, (0.0, 0.0, 0.0))[i] uom_obj = self.pool.get('product.uom') - user_uom, def_uom = self._get_user_and_default_uom_ids(cr, uid) if user_uom != def_uom: s[0] = uom_obj._compute_qty(cr, uid, user_uom, s[0], def_uom) s[1] = uom_obj._compute_qty(cr, uid, user_uom, s[1], def_uom) @@ -426,7 +430,7 @@ class task(osv.osv): 'parent_ids': fields.many2many('project.task', 'project_task_parent_rel', 'task_id', 'parent_id', 'Parent Tasks'), 'child_ids': fields.many2many('project.task', 'project_task_parent_rel', 'parent_id', 'task_id', 'Delegated Tasks'), 'notes': fields.text('Notes'), - 'planned_hours': fields.float('Planned Hours', required=True, help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'), + 'planned_hours': fields.float('Planned Hours', help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'), 'effective_hours': fields.function(_hours_get, method=True, string='Hours Spent', multi='hours', store=True, help="Computed using the sum of the task work done."), 'remaining_hours': fields.float('Remaining Hours', digits=(16,2), help="Total remaining time, can be re-estimated periodically by the assignee of the task."), 'total_hours': fields.function(_hours_get, method=True, string='Total Hours', multi='hours', store=True, help="Computed as: Time Spent + Remaining Time."), @@ -466,7 +470,7 @@ class task(osv.osv): cr.execute('SELECT DISTINCT task_id '\ 'FROM project_task_parent_rel '\ 'WHERE parent_id IN %s', (tuple(ids),)) - child_ids = map(itemgetter(0), cr.fetchall()) + child_ids = map(lambda x: x[0], cr.fetchall()) c_ids = child_ids if (list(set(parent_ids).intersection(set(c_ids)))) or (obj_task.id in c_ids): return False diff --git a/addons/thunderbird/installer.py b/addons/thunderbird/installer.py index cb963831218..62664fedccb 100644 --- a/addons/thunderbird/installer.py +++ b/addons/thunderbird/installer.py @@ -25,6 +25,7 @@ from tools import config import base64 import addons +import difflib class thunderbird_installer(osv.osv_memory): _name = 'thunderbird.installer' @@ -32,8 +33,7 @@ class thunderbird_installer(osv.osv_memory): def default_get(self, cr, uid, fields, context={}): data = super(thunderbird_installer, self).default_get(cr, uid, fields, context) - pdf_file = open(addons.get_module_resource('thunderbird','doc', 'Installation Guide to OpenERP Thunderbid Plug-in.pdf'),'rb') - data['pdf_file'] = base64.encodestring(pdf_file.read()) + 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 @@ -43,14 +43,13 @@ class thunderbird_installer(osv.osv_memory): 'pdf_name':fields.char('File name', size=64), 'thunderbird':fields.boolean('Thunderbird Plug-in', 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 thunderbird."), - 'pdf_file':fields.binary('Installation Manual', help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True), + '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) } _defaults = { 'thunderbird' : True, 'name' : 'openerp_plugin.xpi', - 'pdf_name' : 'Installation Guide to OpenERP Thunderbid Plug-in.pdf', 'description' : """ * Save the Thunderbird plug-­in. * Follow these steps to install Thunderbird plug-­in. diff --git a/addons/thunderbird/partner/partner.py b/addons/thunderbird/partner/partner.py index a7795d1a602..d0c830bfa8b 100644 --- a/addons/thunderbird/partner/partner.py +++ b/addons/thunderbird/partner/partner.py @@ -30,7 +30,7 @@ import tools import binascii class email_server_tools(osv.osv_memory): _inherit = "email.server.tools" - def history_message(self, cr, uid, model, res_id, message): + def history_message(self, cr, uid, model, res_id, message, context=None): #@param message: string of mail which is read from EML File attachment_pool = self.pool.get('ir.attachment') msg = self.parse_message(message) @@ -49,15 +49,15 @@ class email_server_tools(osv.osv_memory): return self.history(cr, uid, model, res_id, msg, att_ids) def parse_message(self, message): - #TOCHECK: put this function in mailgateway + #TOCHECK: put this function in mailgateway module + if isinstance(message, unicode): + message = message.encode('utf-8') msg_txt = email.message_from_string(message) message_id = msg_txt.get('message-id', False) msg = {} - msg_txt = email.message_from_string(message) fields = msg_txt.keys() msg['id'] = message_id msg['message-id'] = message_id - if 'Subject' in fields: msg['subject'] = self._decode_header(msg_txt.get('Subject')) @@ -152,67 +152,79 @@ class thunderbird_partner(osv.osv_memory): dictcreate = dict(vals) ref_ids = str(dictcreate.get('ref_ids')).split(';') msg = dictcreate.get('message') + msg = self.pool.get('email.server.tools').parse_message(msg) server_tools_pool = self.pool.get('email.server.tools') + message_id = msg.get('message-id', False) + msg_pool = self.pool.get('mailgate.message') + 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(',') model = ref[0] res_id = int(ref[1]) - server_tools_pool.history_message(cr, uid, model, res_id, msg) - return True + if message_id: + msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)]) + if msg_ids and len(msg_ids): + continue + server_tools_pool.history_message(cr, uid, model, res_id, msg_new) + res_ids.append(res_id) + return len(res_ids) - def process_email(self,cr,uid,vals): + def process_email(self, cr, uid, vals): dictcreate = dict(vals) model = str(dictcreate.get('model')) message = dictcreate.get('message') return self.pool.get('email.server.tools').process_email(cr, uid, model, message, attach=True, context=None) - def search_contact(self, cr, user, vals): - address_obj = self.pool.get('res.partner.address') - partner = address_obj.search(cr, user,[('email','=',vals)]) + def search_contact(self, cr, user, email): + address_pool = self.pool.get('res.partner.address') + address_ids = address_pool.search(cr, user, [('email','=',email)]) res = {} - res1 = {} - if not partner: - res1 = { - 'email': '', - } - return res1.items() - - if partner: - partner=partner[0] - data = address_obj.read(cr,user, partner) + if not address_ids: res = { - 'partner_name': data['partner_id'] and data['partner_id'][1] or '', - 'contactname': data['name'] or '', - 'street': data['street'] or '', - 'street2': data['street2'] or '', - 'zip': data['zip'] or '', - 'city': data['city'] or '', - 'country': data['country_id'] and data['country_id'][1] or '', - 'state': data['state_id'] and data['state_id'][1] or '', - 'email': data['email'] or '', - 'phone': data['phone'] or '', - 'mobile': data['mobile'] or '', - 'fax': data['fax'] or '', - 'res_id': str(partner), + 'email': '', + } + else: + address_id = address_ids[0] + address = address_pool.browse(cr, user, address_id) + res = { + 'partner_name': address.partner_id and address.partner_id.name or '', + 'contactname': address.name, + 'street': address.street or '', + 'street2': address.street2 or '', + 'zip': address.zip or '', + 'city': address.city or '', + 'country': address.country_id and address.country_id.name or '', + 'state': address.state_id and address.state_id.name or '', + 'email': address.email or '', + 'phone': address.phone or '', + 'mobile': address.mobile or '', + 'fax': address.fax or '', + 'partner_id': address.partner_id and str(address.partner_id.id) or '', + 'res_id': str(address.id), } return res.items() - def update_contact(self,cr,user,vals): + def update_contact(self, cr, user, vals): dictcreate = dict(vals) res_id = dictcreate.get('res_id',False) - result={} - - if not (dictcreate.get('partner_id')): + result = {} + address_pool = self.pool.get('res.partner.address') + if not (dictcreate.get('partner_id')): # TOCHECK: It should be check res_id or not dictcreate.update({'partner_id': False}) - create_id = self.pool.get('res.partner.address').create(cr, user, dictcreate) + create_id = address_pool.create(cr, user, dictcreate) return create_id if res_id: - address_obj = self.pool.get('res.partner.address') - address_data = address_obj.read(cr, user, int(res_id), []) + address_data = address_pool.read(cr, user, int(res_id), []) result = { - 'partner_id': address_data['partner_id'] and address_data['partner_id'][0] or False, + 'partner_id': address_data['partner_id'] and address_data['partner_id'][0] or False, #TOFIX: parter_id should take from address_data 'country_id': dictcreate['country_id'] and int(dictcreate['country_id'][0]) or False, 'state_id': dictcreate['state_id'] and int(dictcreate['state_id'][0]) or False, 'name': dictcreate['name'], @@ -225,7 +237,7 @@ class thunderbird_partner(osv.osv_memory): 'mobile': dictcreate['mobile'], 'email': dictcreate['email'], } - address_obj.write(cr, user,int(res_id),result ) + address_pool.write(cr, user, int(res_id), result ) return True def create_partner(self,cr,user,vals): diff --git a/addons/thunderbird/plugin/openerp_plugin.xpi b/addons/thunderbird/plugin/openerp_plugin.xpi index f9e11ba939c..70e1f8fcaa0 100644 Binary files a/addons/thunderbird/plugin/openerp_plugin.xpi and b/addons/thunderbird/plugin/openerp_plugin.xpi differ diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar index de506007d3a..aeab9c82228 100644 Binary files a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar and b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar differ diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/address.xul b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/address.xul index 58514f39cbd..cacd522718e 100644 --- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/address.xul +++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/address.xul @@ -26,7 +26,6 @@