diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml
index 3f36ad6ce2a..f48fe1ae8b2 100644
--- a/addons/crm/crm_meeting_view.xml
+++ b/addons/crm/crm_meeting_view.xml
@@ -26,19 +26,17 @@
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml
index eb05c5c9f93..a49dc92abd0 100644
--- a/addons/crm/crm_view.xml
+++ b/addons/crm/crm_view.xml
@@ -576,9 +576,6 @@
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.case.custom'}"
icon="terp-mail-message-new" type="action" />
-
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/crm/res_partner.py b/addons/crm/res_partner.py
index db7069af4db..c2651b14c8e 100644
--- a/addons/crm/res_partner.py
+++ b/addons/crm/res_partner.py
@@ -31,8 +31,6 @@ class res_partner(osv.osv):
'Meetings'),
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id',\
'Phonecalls'),
- 'opportunity_assigned_ids': fields.one2many('crm.lead', 'partner_assigned_id',\
- 'Assigned Opportunities'),
}
res_partner()
diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml
index 4dad9f3dfdd..6ca978ea153 100644
--- a/addons/crm/res_partner_view.xml
+++ b/addons/crm/res_partner_view.xml
@@ -44,39 +44,6 @@
icon="gtk-cancel" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index 7b23d0eac3d..9730b8d1d55 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -20,7 +20,6 @@
##############################################################################
import crm_send_email
-import crm_forward_to_partner
import crm_add_note
import crm_lead_to_partner
diff --git a/addons/partner_geo_assign/__init__.py b/addons/crm_partner_assign/__init__.py
similarity index 97%
rename from addons/partner_geo_assign/__init__.py
rename to addons/crm_partner_assign/__init__.py
index e1957dfb286..3bb196d3193 100644
--- a/addons/partner_geo_assign/__init__.py
+++ b/addons/crm_partner_assign/__init__.py
@@ -20,3 +20,5 @@
##############################################################################
import partner_geo_assign
+import wizard
+import report
diff --git a/addons/partner_geo_assign/__openerp__.py b/addons/crm_partner_assign/__openerp__.py
similarity index 92%
rename from addons/partner_geo_assign/__openerp__.py
rename to addons/crm_partner_assign/__openerp__.py
index e5ef5b5dd9d..3068bf25fbe 100644
--- a/addons/partner_geo_assign/__openerp__.py
+++ b/addons/crm_partner_assign/__openerp__.py
@@ -30,9 +30,11 @@ based on geolocalization.
""",
'author': 'OpenERP SA',
'depends': ['crm'],
- 'data': [
+ 'update_xml': [
'res_partner_view.xml',
+ 'wizard/crm_forward_to_partner_view.xml',
'crm_lead_view.xml',
+ 'report/crm_lead_report_view.xml',
],
'installable': True,
'active': False,
diff --git a/addons/crm_partner_assign/crm_lead_view.xml b/addons/crm_partner_assign/crm_lead_view.xml
new file mode 100644
index 00000000000..fe6b997cc6e
--- /dev/null
+++ b/addons/crm_partner_assign/crm_lead_view.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ crm.lead.geo_assign.inherit
+ crm.lead
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/partner_geo_assign/i18n/en_US.po b/addons/crm_partner_assign/i18n/en_US.po
similarity index 100%
rename from addons/partner_geo_assign/i18n/en_US.po
rename to addons/crm_partner_assign/i18n/en_US.po
diff --git a/addons/partner_geo_assign/i18n/fr.po b/addons/crm_partner_assign/i18n/fr.po
similarity index 100%
rename from addons/partner_geo_assign/i18n/fr.po
rename to addons/crm_partner_assign/i18n/fr.po
diff --git a/addons/partner_geo_assign/i18n/partner_geo_assign.pot b/addons/crm_partner_assign/i18n/partner_geo_assign.pot
similarity index 100%
rename from addons/partner_geo_assign/i18n/partner_geo_assign.pot
rename to addons/crm_partner_assign/i18n/partner_geo_assign.pot
diff --git a/addons/partner_geo_assign/partner_geo_assign.py b/addons/crm_partner_assign/partner_geo_assign.py
similarity index 84%
rename from addons/partner_geo_assign/partner_geo_assign.py
rename to addons/crm_partner_assign/partner_geo_assign.py
index d53aa461db6..9a761740c8d 100644
--- a/addons/partner_geo_assign/partner_geo_assign.py
+++ b/addons/crm_partner_assign/partner_geo_assign.py
@@ -41,6 +41,20 @@ def geo_find(addr):
_('Could not contact geolocation servers, please make sure you have a working internet connection (%s)') % e)
+class res_partner_grade(osv.osv):
+ _order = 'sequence'
+ _name = 'res.partner.grade'
+ _columns = {
+ 'sequence': fields.integer('Sequence'),
+ 'active': fields.boolean('Active'),
+ 'name': fields.char('Grade Name', size=32)
+ }
+ _defaults = {
+ 'active': lambda *args: 1
+ }
+res_partner_grade()
+
+
class res_partner(osv.osv):
_inherit = "res.partner"
_columns = {
@@ -49,6 +63,9 @@ class res_partner(osv.osv):
'date_localization': fields.date('Geo Localization Date'),
'partner_weight': fields.integer('Weight',
help="Gives the probability to assign a lead to this partner. (0 means no assignation.)"),
+ 'opportunity_assigned_ids': fields.one2many('crm.lead', 'partner_assigned_id',\
+ 'Assigned Opportunities'),
+ 'grade_id': fields.many2one('res.partner.grade', 'Partner Grade')
}
_defaults = {
'partner_weight': lambda *args: 0
@@ -74,7 +91,21 @@ class crm_lead(osv.osv):
_columns = {
'partner_latitude': fields.float('Geo Latitude'),
'partner_longitude': fields.float('Geo Longitude'),
+ 'partner_assigned_id': fields.many2one('res.partner', 'Assigned Partner', help="Partner this case has been forwarded/assigned to.", select=True),
+ 'date_assign': fields.date('Assignation Date', help="Last date this case was forwarded/assigned to a partner"),
}
+ def onchange_assign_id(self, cr, uid, ids, partner_assigned_id, context={}):
+ """This function updates the "assignation date" automatically, when manually assign a partner in the geo assign tab
+ @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 stage’s IDs
+ @stage_id: change state id on run time """
+
+ if not partner_assigned_id:
+ return {'value':{'date_assign': False}}
+ else:
+ return {'value':{'date_assign': time.strftime('%Y-%m-%d')}}
def assign_partner(self, cr, uid, ids, context=None):
ok = False
diff --git a/addons/crm_partner_assign/report/__init__.py b/addons/crm_partner_assign/report/__init__.py
new file mode 100644
index 00000000000..9b7860b8de4
--- /dev/null
+++ b/addons/crm_partner_assign/report/__init__.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import crm_lead_report
+
diff --git a/addons/crm_partner_assign/report/crm_lead_report.py b/addons/crm_partner_assign/report/crm_lead_report.py
new file mode 100644
index 00000000000..07da2d99411
--- /dev/null
+++ b/addons/crm_partner_assign/report/crm_lead_report.py
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields,osv
+import tools
+from crm import crm
+
+AVAILABLE_STATES = [
+ ('draft','Draft'),
+ ('open','Open'),
+ ('cancel', 'Cancelled'),
+ ('done', 'Closed'),
+ ('pending','Pending')
+]
+
+class crm_lead_report_assign(osv.osv):
+ """ CRM Lead Report """
+ _name = "crm.lead.report.assign"
+ _auto = False
+ _description = "CRM Lead Report"
+ _columns = {
+ 'name': fields.char('Year', size=64, required=False, readonly=True),
+ 'partner_assigned_id':fields.many2one('res.partner', 'Partner', readonly=True),
+ 'grade_id':fields.many2one('res.partner.grade', 'Grade', readonly=True),
+ 'user_id':fields.many2one('res.users', 'User', readonly=True),
+ 'country_id':fields.many2one('res.country', 'Country', readonly=True),
+ 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
+ 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
+ 'month':fields.selection([('01', 'January'), ('02', 'February'), \
+ ('03', 'March'), ('04', 'April'),\
+ ('05', 'May'), ('06', 'June'), \
+ ('07', 'July'), ('08', 'August'),\
+ ('09', 'September'), ('10', 'October'),\
+ ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ 'partner_date': fields.date('Partner Date', readonly=True),
+ 'create_date': fields.datetime('Create Date', readonly=True),
+ 'day': fields.char('Day', size=128, readonly=True),
+ 'delay_open': fields.float('Delay to Open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"),
+ 'delay_close': fields.float('Delay to Close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
+ 'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"),
+ 'probability': fields.float('Avg Probability',digits=(16,2),readonly=True, group_operator="avg"),
+ 'probability_max': fields.float('Max Probability',digits=(16,2),readonly=True, group_operator="max"),
+ 'planned_revenue': fields.float('Planned Revenue',digits=(16,2),readonly=True),
+ 'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True),
+ 'categ_id': fields.many2one('crm.case.categ', 'Category',\
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.lead')]" , readonly=True),
+ 'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
+ domain="[('section_id','=',section_id),\
+ ('object_id.model', '=', 'crm.lead')]", readonly=True),
+ '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),
+ 'date_closed': fields.date('Close Date', readonly=True),
+ 'nbr': fields.integer('# of Cases', readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
+ 'type':fields.selection([
+ ('lead','Lead'),
+ ('opportunity','Opportunity'),
+ ],'Type', help="Type is used to separate Leads and Opportunities"),
+ }
+ def init(self, cr):
+
+ """
+ CRM Lead Report
+ @param cr: the current row, from the database cursor
+ """
+ tools.drop_view_if_exists(cr, 'crm_lead_report')
+ cr.execute("""
+ CREATE OR REPLACE VIEW crm_lead_report_assign AS (
+ SELECT
+ c.id,
+ to_char(c.create_date, 'YYYY') as name,
+ to_char(c.create_date, 'MM') as month,
+ to_char(c.create_date, 'YYYY-MM-DD') as day,
+ to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
+ to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
+ to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
+ c.state,
+ c.user_id,
+ c.probability,
+ c.probability as probability_max,
+ c.stage_id,
+ c.type,
+ c.company_id,
+ c.priority,
+ c.section_id,
+ c.categ_id,
+ c.partner_id,
+ c.country_id,
+ c.planned_revenue,
+ c.partner_assigned_id,
+ p.grade_id,
+ p.date as partner_date,
+ c.planned_revenue*(c.probability/100) as probable_revenue,
+ 1 as nbr,
+ date_trunc('day',c.create_date) as create_date,
+ extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
+ extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected,
+ extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open
+ FROM
+ crm_lead c
+ left join res_partner p on (c.partner_assigned_id=p.id)
+ )""")
+
+crm_lead_report_assign()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm_partner_assign/report/crm_lead_report_view.xml b/addons/crm_partner_assign/report/crm_lead_report_view.xml
new file mode 100644
index 00000000000..3424fc44fbe
--- /dev/null
+++ b/addons/crm_partner_assign/report/crm_lead_report_view.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+ crm.lead.report.assign.select
+ crm.lead.report.assign
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ crm.lead.assign.report.tree
+ crm.lead.report.assign
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Opp. Assignment Analysis
+ crm.lead.report.assign
+ form
+ {"search_default_group_partner_date": 1, "search_default_group_grade":1,'group_by_no_leaf':1,'group_by':[]}
+ tree
+ [('type', '=', 'opportunity')]
+
+
+
+
+ tree
+
+
+
+
+
+
+
+
diff --git a/addons/crm_partner_assign/res_partner_view.xml b/addons/crm_partner_assign/res_partner_view.xml
new file mode 100644
index 00000000000..ab14e7ca7b0
--- /dev/null
+++ b/addons/crm_partner_assign/res_partner_view.xml
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+ res.partner.grade.tree
+ res.partner.grade
+ tree
+
+
+
+
+
+
+
+
+ res.partner.grade.form
+ res.partner.grade
+ form
+
+
+
+
+
+ Partner Grade
+ res.partner.grade
+ form
+
+
+
+
+
+ res.partner.geo.inherit.tree
+ res.partner
+ tree
+
+
+
+
+
+
+
+
+
+ res.partner.geo.inherit.search
+ res.partner
+ search
+
+
+
+
+
+
+
+
+
+ res.partner.geo.inherit
+ res.partner
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/crm_partner_assign/wizard/__init__.py b/addons/crm_partner_assign/wizard/__init__.py
new file mode 100644
index 00000000000..9224173145b
--- /dev/null
+++ b/addons/crm_partner_assign/wizard/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import crm_forward_to_partner
diff --git a/addons/crm/wizard/crm_forward_to_partner.py b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
similarity index 100%
rename from addons/crm/wizard/crm_forward_to_partner.py
rename to addons/crm_partner_assign/wizard/crm_forward_to_partner.py
diff --git a/addons/crm/wizard/crm_forward_to_partner_view.xml b/addons/crm_partner_assign/wizard/crm_forward_to_partner_view.xml
similarity index 94%
rename from addons/crm/wizard/crm_forward_to_partner_view.xml
rename to addons/crm_partner_assign/wizard/crm_forward_to_partner_view.xml
index d2705c8f0db..9ee2870335a 100644
--- a/addons/crm/wizard/crm_forward_to_partner_view.xml
+++ b/addons/crm_partner_assign/wizard/crm_forward_to_partner_view.xml
@@ -5,7 +5,7 @@
crm_lead_forward_to_partnercrm.lead.forward.to.partnerform
-
+
@@ -31,7 +31,7 @@
crm_lead_forward_to_partner1crm.lead.forward.to.partnerform
-
+
@@ -63,13 +65,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
-
mailgate.thread.formmailgate.thread
@@ -127,8 +137,9 @@
form[('history', '=', True)]
+ {"search_default_user_id":uid}
-
+
Mailgateway Threadsmailgate.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 8b616c3d7ac..5ad90bf25d6 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -19,11 +19,11 @@
#
##############################################################################
-from mx import DateTime
-from datetime import datetime, timedelta
+from itertools import groupby
+from operator import itemgetter
+from datetime import datetime
from osv import osv, fields
from tools.translate import _
-import ir
import netsvc
import time
@@ -178,8 +178,8 @@ class mrp_bom(osv.osv):
'code': fields.char('Reference', size=16),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the bills of material without removing it."),
'type': fields.selection([('normal','Normal BoM'),('phantom','Sets / Phantom')], 'BoM Type', required=True,
- help= "If a sub-product is used in several products, it can be useful to create its own BoM."\
- "Though if you don't want separated production orders for this sub-product, select Set/Phantom as BoM type."\
+ help= "If a sub-product is used in several products, it can be useful to create its own BoM. "\
+ "Though if you don't want separated production orders for this sub-product, select Set/Phantom as BoM type. "\
"If a Phantom BoM is used for a root product, it will be sold and shipped as a set of components, instead of being produced."),
'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]),
'date_start': fields.date('Valid From', help="Validity of this BoM or component. Keep empty if it's always valid."),
@@ -250,7 +250,6 @@ class mrp_bom(osv.osv):
@param properties: List of related properties.
@return: False or BoM id.
"""
- bom_result = False
cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
ids = map(lambda x: x[0], cr.fetchall())
max_prop = 0
@@ -356,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):
@@ -374,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):
@@ -479,7 +481,7 @@ class mrp_production(osv.osv):
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'mrp.production') or '/',
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
}
- _order = 'date_planned asc, priority desc';
+ _order = 'priority desc, date_planned asc';
def _check_qty(self, cr, uid, ids):
orders = self.browse(cr, uid, ids)
@@ -681,7 +683,6 @@ class mrp_production(osv.osv):
stock_mov_obj = self.pool.get('stock.move')
production = self.browse(cr, uid, production_id)
- raw_product_todo = []
final_product_todo = []
produced_qty = 0
@@ -800,7 +801,6 @@ class mrp_production(osv.osv):
""" Changes state to In Production and writes starting date.
@return: True
"""
- move_ids = []
self.write(cr, uid, ids, {'state': 'in_production', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index ba7ebef1973..71fbfd0851d 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -33,7 +33,7 @@
- Property Categories
+ Property Groupsir.actions.act_windowmrp.property.groupform
@@ -64,7 +64,6 @@
form
@@ -192,9 +191,11 @@
-
-
+
+
+
+
@@ -252,15 +253,18 @@
form
@@ -276,12 +280,25 @@
+
+ mrp.routing.search
+ mrp.routing
+ tree
+
+
+
+
+
+
+
+ Routingsir.actions.act_windowmrp.routingform
+ Routings define the assembly operations to be done in work centers for manufacturing a certain product. They are usually attached to bills of materials which will define the assembly of products required for manufacture or for finished products.
@@ -358,16 +375,14 @@
-
+
-
-
+
-
-
+
@@ -497,10 +512,10 @@
+
-
@@ -625,16 +640,16 @@
states="done,cancel"/>
-
+
-
+
-
+
-
-
+
+
@@ -736,12 +751,13 @@
-
+
-
-
-
+
+
+
+
@@ -761,12 +777,12 @@
-
+ Manufacturing Orders Planningir.actions.act_windowmrp.productionform
- gantt,tree,form,calendar,graph
+ tree,form,calendar,graph[('state','in',('ready','confirmed','in_production'))]Manufacturing Orders describe the operations that need to be carried out and the raw materials usage for each stage of production. You use specifications (bills of materials or BoM) to work out the raw material requirements and the manufacturing orders needed for the finished products. Once the bills of materials have been defined, OpenERP becomes capable of automatically deciding on the manufacturing route depending on the needs of the company.
diff --git a/addons/mrp/report/bom_structure.py b/addons/mrp/report/bom_structure.py
index b38f2499c40..a5b43c19f01 100644
--- a/addons/mrp/report/bom_structure.py
+++ b/addons/mrp/report/bom_structure.py
@@ -40,6 +40,7 @@ class bom_structure(report_sxw.rml_parse):
res = {}
res['name'] = l.name
res['pname'] = l.product_id.name
+ res['pcode'] = l.product_id.default_code
res['pqty'] = l.product_qty
res['uname'] = l.product_uom.name
res['code'] = l.code
diff --git a/addons/mrp/report/bom_structure.rml b/addons/mrp/report/bom_structure.rml
index c05da1242ea..533d7454943 100644
--- a/addons/mrp/report/bom_structure.rml
+++ b/addons/mrp/report/bom_structure.rml
@@ -67,7 +67,9 @@
+
+
@@ -82,7 +84,7 @@
diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py
index 5c6caf1e9db..e1b9b5af40b 100644
--- a/addons/procurement/procurement.py
+++ b/addons/procurement/procurement.py
@@ -19,7 +19,6 @@
#
##############################################################################
-from mx import DateTime
from osv import osv, fields
from tools.translate import _
import netsvc
diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml
index aa5552f0b0c..01c50d67e64 100644
--- a/addons/procurement/procurement_view.xml
+++ b/addons/procurement/procurement_view.xml
@@ -91,7 +91,6 @@
help="Procurement started late" />
-
diff --git a/addons/product/i18n/pt_BR.po b/addons/product/i18n/pt_BR.po
index 0bf7bda1ddc..1ce31156c3e 100644
--- a/addons/product/i18n/pt_BR.po
+++ b/addons/product/i18n/pt_BR.po
@@ -421,7 +421,7 @@ msgid ""
"reception of products."
msgstr ""
"Preço Padrão: o preço é fixo e recalculado periodicamente (geralmente no "
-"final do ano).\r\n"
+"final do ano).\n"
"Preço Médio: o preço de custo é recalculado a cada recepção de produtos."
#. module: product
diff --git a/addons/product/i18n/zh_CN.po b/addons/product/i18n/zh_CN.po
index 7cb31c3b142..43c33f51d02 100644
--- a/addons/product/i18n/zh_CN.po
+++ b/addons/product/i18n/zh_CN.po
@@ -399,7 +399,7 @@ msgid ""
"at the end of the year), Average Price: the cost price is recomputed at each "
"reception of products."
msgstr ""
-"标准价格: 成本价格是定期重新计算(通常在年底).\r\n"
+"标准价格: 成本价格是定期重新计算(通常在年底).\n"
"平均价格: 成本价格是在每次接收产品时重新计算."
#. module: product
@@ -557,7 +557,7 @@ msgid ""
"and the reception of goods for this product and for the default supplier. It "
"is used by the scheduler to order requests based on reordering delays."
msgstr ""
-"产品供应在确认采购订单到接收产品之间的默认平均延迟. \r\n"
+"产品供应在确认采购订单到接收产品之间的默认平均延迟. \n"
"用于在调度订单请求时要考虑的重订货延迟."
#. module: product
@@ -671,7 +671,7 @@ msgid ""
"supplying. 'Make to Order': When needed, purchase or produce for the "
"procurement request."
msgstr ""
-"按库存生产: 在仓库或等待重新供应时得到需求.\r\n"
+"按库存生产: 在仓库或等待重新供应时得到需求.\n"
" 按订单生产: 在采购或产品获得请求时得到需求."
#. module: product
@@ -1214,7 +1214,7 @@ msgid ""
"The computed quantity will be a multiple of this value. Use 1.0 for products "
"that can not be split."
msgstr ""
-"这数量计算将乘于一个数值.\r\n"
+"这数量计算将乘于一个数值.\n"
"产品使用1.0表示不能拆分."
#. module: product
@@ -1444,7 +1444,7 @@ msgid ""
"the delivery of the finished products. It's the time you promise to your "
"customers."
msgstr ""
-"这是确认客户订单和交付的平均时间.\r\n"
+"这是确认客户订单和交付的平均时间.\n"
"是承诺客户的时间."
#. module: product
@@ -1668,7 +1668,7 @@ msgid ""
"reception of the products in your warehouse. Used by the scheduler for "
"automatic computation of the purchase order planning."
msgstr ""
-"延迟天数是确认采购订单到仓库接收产品之间的延迟天数.\r\n"
+"延迟天数是确认采购订单到仓库接收产品之间的延迟天数.\n"
"用于制定采购订单计划时调度程序自动计算."
#. module: product
diff --git a/addons/product/product.py b/addons/product/product.py
index 8cb0a08f52d..eaa1df9ebf2 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -21,13 +21,10 @@
from osv import osv, fields
import decimal_precision as dp
-import pooler
import math
-import logging
from _common import rounding
-from tools import config
from tools.translate import _
def is_pair(x):
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/project_mrp/project_mrp_view.xml b/addons/project_mrp/project_mrp_view.xml
index 726e95d1c9b..c8ed6fbc447 100644
--- a/addons/project_mrp/project_mrp_view.xml
+++ b/addons/project_mrp/project_mrp_view.xml
@@ -19,7 +19,7 @@
form
-
+
diff --git a/addons/project_scrum/project_scrum.py b/addons/project_scrum/project_scrum.py
index a80a31ff257..d4be8ebe450 100644
--- a/addons/project_scrum/project_scrum.py
+++ b/addons/project_scrum/project_scrum.py
@@ -140,7 +140,7 @@ class project_scrum_sprint(osv.osv):
if default is None:
default = {}
default.update({'backlog_ids': [], 'meeting_ids': []})
- return super(scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
+ return super(project_scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
def onchange_project_id(self, cr, uid, ids, project_id=False):
v = {}
diff --git a/addons/resource/resource_view.xml b/addons/resource/resource_view.xml
index 02b9abd882a..83dcbed5019 100644
--- a/addons/resource/resource_view.xml
+++ b/addons/resource/resource_view.xml
@@ -18,9 +18,13 @@
-
-
+
+
+
+
+
+
@@ -53,16 +57,17 @@
-
-
+
+
-
-
+
+
+
@@ -74,9 +79,11 @@
form
-
-
-
+
+
+
+
+
@@ -196,7 +203,7 @@
Resourcesresource.resourcetree,form
- {"search_default_user_id":uid}
+ {}There you can find clusters of your resources type involved in a specific project phase as well as their workload.
@@ -210,7 +217,7 @@
-
+
@@ -224,11 +231,11 @@
+
-
diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py
index e69416f1d25..6f968b481e1 100644
--- a/addons/sale_crm/wizard/crm_make_sale.py
+++ b/addons/sale_crm/wizard/crm_make_sale.py
@@ -81,7 +81,6 @@ class crm_make_sale(osv.osv_memory):
sale_line_obj = self.pool.get('sale.order.line')
result = mod_obj._get_id(cr, uid, 'sale', 'view_sales_order_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
data = context and context.get('active_ids', []) or []
diff --git a/addons/stock/i18n/bs.po b/addons/stock/i18n/bs.po
index 9e12e11b092..940a921238c 100644
--- a/addons/stock/i18n/bs.po
+++ b/addons/stock/i18n/bs.po
@@ -2013,7 +2013,7 @@ msgid ""
"This stock location will be used, instead of the default one, as the "
"destination location for goods you send to this partner"
msgstr ""
-"Koristiće se ova lokacija zaliha, umjesto podrazumjevane, kao \r\n"
+"Koristiće se ova lokacija zaliha, umjesto podrazumjevane, kao \n"
"odredišna lokacija za robu koju šaljete ovom partneru"
#. module: stock
@@ -2151,8 +2151,8 @@ msgid ""
"instead of the default one, as the source location for stock moves generated "
"by production orders"
msgstr ""
-"Za ovaj proizvod (šablon) biće korištena ova lokacija zaliha, \r\n"
-"umjesto podrazumjevane, kao izvorna lokacija za premještanja zaliha \r\n"
+"Za ovaj proizvod (šablon) biće korištena ova lokacija zaliha, \n"
+"umjesto podrazumjevane, kao izvorna lokacija za premještanja zaliha \n"
"kada ga inicira nalog za proizvodnju"
#. module: stock
@@ -2238,7 +2238,7 @@ msgid ""
"by procurements"
msgstr ""
"Za ovaj proizvod (šablon) biće korištena ova lokacija zaliha, umjesto "
-"podrazumjevane, kao izvorna lokacija za premještanja zaliha \r\n"
+"podrazumjevane, kao izvorna lokacija za premještanja zaliha \n"
"kada ga inicira nabavka"
#. module: stock
diff --git a/addons/stock/product.py b/addons/stock/product.py
index 951c3badcf4..790b50c45b3 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -67,7 +67,6 @@ class product_product(osv.osv):
stock_output_acc = datas.get('stock_output_account', False)
stock_input_acc = datas.get('stock_input_account', False)
journal_id = datas.get('stock_journal', False)
- property_obj=self.pool.get('ir.property')
product_obj=self.browse(cr,uid,ids)[0]
account_variation = product_obj.categ_id.property_stock_variation
account_variation_id = account_variation and account_variation.id or False
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 5ecbd5f40ba..b1f31294a97 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -23,7 +23,6 @@ from dateutil.relativedelta import relativedelta
import time
from osv import fields, osv
-from tools import config
from tools.translate import _
import netsvc
import tools
@@ -856,7 +855,6 @@ class stock_picking(osv.osv):
""" Gets payment term from partner.
@return: Payment term
"""
- partner_obj = self.pool.get('res.partner')
partner = picking.address_id.partner_id
return partner.property_payment_term and partner.property_payment_term.id or False
@@ -1132,12 +1130,8 @@ class stock_picking(osv.osv):
price_type_obj = self.pool.get('product.price.type')
sequence_obj = self.pool.get('ir.sequence')
wf_service = netsvc.LocalService("workflow")
- partner_id = partial_datas.get('partner_id', False)
- address_id = partial_datas.get('address_id', False)
- delivery_date = partial_datas.get('delivery_date', False)
for pick in self.browse(cr, uid, ids, context=context):
new_picking = None
- new_moves = []
complete, too_many, too_few = [], [], []
move_product_qty = {}
for move in pick.move_lines:
@@ -1197,7 +1191,7 @@ class stock_picking(osv.osv):
})
if product_qty != 0:
- new_obj = move_obj.copy(cr, uid, move.id,
+ move_obj.copy(cr, uid, move.id,
{
'product_qty' : product_qty,
'product_uos_qty': product_qty, #TODO: put correct uos_qty
@@ -1682,7 +1676,6 @@ class stock_move(osv.osv):
"""
moves = self.browse(cr, uid, ids)
self.write(cr, uid, ids, {'state': 'confirmed'})
- i = 0
def create_chained_picking(self, cr, uid, moves, context=None):
new_moves = []
@@ -1815,7 +1808,6 @@ class stock_move(osv.osv):
def setlast_tracking(self, cr, uid, ids, context=None):
tracking_obj = self.pool.get('stock.tracking')
- tracking = context.get('tracking', False)
picking = self.browse(cr, uid, ids)[0].picking_id
if picking:
last_track = [line.tracking_id.id for line in picking.move_lines if line.tracking_id]
@@ -1895,7 +1887,6 @@ class stock_move(osv.osv):
amount = q * move.price_unit
# Base computation on valuation price type
else:
- company_id = move.company_id.id
context['currency_id'] = move.company_id.currency_id.id
pricetype = price_type_obj.browse(cr,uid,move.company_id.property_valuation_price_type.id)
amount_unit = move.product_id.price_get(pricetype.field, context)[move.product_id.id]
@@ -1906,11 +1897,7 @@ class stock_move(osv.osv):
""" Makes the move done and if all moves are done, it will finish the picking.
@return:
"""
- track_flag = False
picking_ids = []
- product_uom_obj = self.pool.get('product.uom')
- price_type_obj = self.pool.get('product.price.type')
- product_obj = self.pool.get('product.product')
move_obj = self.pool.get('account.move')
if context is None:
context = {}
@@ -2205,12 +2192,7 @@ class stock_move(osv.osv):
users_obj = self.pool.get('res.users')
uom_obj = self.pool.get('product.uom')
price_type_obj = self.pool.get('product.price.type')
- sequence_obj = self.pool.get('ir.sequence')
wf_service = netsvc.LocalService("workflow")
- partner_id = partial_datas.get('partner_id', False)
- address_id = partial_datas.get('address_id', False)
- delivery_date = partial_datas.get('delivery_date', False)
- new_moves = []
if context is None:
context = {}
@@ -2303,7 +2285,6 @@ class stock_move(osv.osv):
picking_obj.action_move(cr, uid, [move.picking_id.id])
wf_service.trg_validate(uid, 'stock.picking', move.picking_id.id, 'button_done', cr)
- ref = {}
done_move_ids = []
for move in complete:
done_move_ids.append(move.id)
@@ -2345,7 +2326,6 @@ class stock_inventory(osv.osv):
context = {}
for inv in self.browse(cr, uid, ids):
move_ids = []
- move_line = []
for line in inv.inventory_line_id:
pid = line.product_id.id
@@ -2495,7 +2475,6 @@ class stock_picking_move_wizard(osv.osv_memory):
def action_move(self, cr, uid, ids, context=None):
move_obj = self.pool.get('stock.move')
picking_obj = self.pool.get('stock.picking')
- account_move_obj = self.pool.get('account.move')
for act in self.read(cr, uid, ids):
move_lines = move_obj.browse(cr, uid, act['move_ids'])
for line in move_lines:
diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py
index a5a401800d3..08df30e7ea8 100644
--- a/addons/stock/wizard/stock_move.py
+++ b/addons/stock/wizard/stock_move.py
@@ -20,7 +20,6 @@
##############################################################################
from osv import fields, osv
-from tools.translate import _
class stock_move_track(osv.osv_memory):
_name = "stock.move.track"
@@ -220,7 +219,6 @@ class split_in_production_lot(osv.osv_memory):
@return:
"""
prodlot_obj = self.pool.get('stock.production.lot')
- ir_sequence_obj = self.pool.get('ir.sequence')
move_obj = self.pool.get('stock.move')
new_move = []
for data in self.browse(cr, uid, ids):
diff --git a/addons/stock/wizard/stock_partial_move.py b/addons/stock/wizard/stock_partial_move.py
index 17515f86252..1016d6c3977 100644
--- a/addons/stock/wizard/stock_partial_move.py
+++ b/addons/stock/wizard/stock_partial_move.py
@@ -36,7 +36,6 @@ class stock_partial_move(osv.osv_memory):
move_obj = self.pool.get('stock.move')
if not context:
context={}
- moveids = []
for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if m.state in ('done', 'cancel'):
raise osv.except_osv(_('Invalid action !'), _('Cannot delivery products which are already delivered !'))
@@ -63,7 +62,7 @@ class stock_partial_move(osv.osv_memory):
move_ids = move_obj.search(cr, uid, [('id','in',move_ids)])
_moves_arch_lst = """
-
+
"""
_moves_fields = result['fields']
@@ -147,7 +146,6 @@ class stock_partial_move(osv.osv_memory):
move_obj = self.pool.get('stock.move')
if not context:
context={}
- moveids = address_delivery = address_default = []
if 'date' in fields:
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
move_ids = context.get('active_ids', [])
@@ -203,7 +201,6 @@ class stock_partial_move(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
- rec_id = context and context.get('active_id', False)
move_obj = self.pool.get('stock.move')
move_ids = context.get('active_ids', False)
partial = self.browse(cr, uid, ids[0], context)
@@ -224,7 +221,7 @@ class stock_partial_move(osv.osv_memory):
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
})
- res = move_obj.do_partial(cr, uid, move_ids, partial_datas, context=context)
+ move_obj.do_partial(cr, uid, move_ids, partial_datas, context=context)
return {}
stock_partial_move()
diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py
index 30403e3b1d0..74aa96e8e63 100644
--- a/addons/stock/wizard/stock_return_picking.py
+++ b/addons/stock/wizard/stock_return_picking.py
@@ -75,7 +75,7 @@ class stock_return_picking(osv.osv_memory):
self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True)
if 'invoice_state' not in self._columns:
self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be Invoiced'), ('none', 'None')], string='Invoice State', required=True)
- except Exception, e:
+ except Exception:
return res
return res
@@ -117,10 +117,6 @@ class stock_return_picking(osv.osv_memory):
raise osv.except_osv(_('Warning!'),_('There is no product to return!'))
arch_lst.append('\n')
- if pick.invoice_state=='invoiced':
- new_invoice_state='2binvoiced'
- else:
- new_invoice_state=pick.invoice_state
res['fields']['invoice_state']={'string':_('Invoice state'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To Be Invoiced')), ('none', _('None'))]}
arch_lst.append('')
arch_lst.append('')
diff --git a/addons/stock/wizard/stock_splitinto.py b/addons/stock/wizard/stock_splitinto.py
index 5e75801d2f6..20b1940e1c7 100644
--- a/addons/stock/wizard/stock_splitinto.py
+++ b/addons/stock/wizard/stock_splitinto.py
@@ -69,7 +69,7 @@ class stock_split_into(osv.osv_memory):
'state': move.state,
'product_uos': move.product_uom.id
}
- current_move = move_obj.copy(cr, uid, move.id, default_val)
+ move_obj.copy(cr, uid, move.id, default_val)
return {}
stock_split_into()
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 @@
-
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/config_change.xul b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/config_change.xul
index 574fe244f2a..86f777ccb75 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/config_change.xul
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/config_change.xul
@@ -24,7 +24,7 @@
-
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul
index 5aa53566dfd..a3215a8c9df 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul
@@ -14,8 +14,9 @@
-
-
+
+
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/loaddata.js b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/loaddata.js
index 4bf92728a06..0bee6e705a6 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/loaddata.js
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/loaddata.js
@@ -33,6 +33,7 @@ function selectPartner(){
}
}
+
//function for the intialization procedure //used while loading and unloading of the window
var myPrefObserver =
{
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.js b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.js
index 3bf24a79e0c..96f4a43b578 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.js
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.js
@@ -10,9 +10,9 @@ var MBstrBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].
var mboximportbundle = MBstrBundleService.createBundle("chrome://mboximport/locale/mboximport.properties");
//function to get the required details of the selected email
-function searchmail()
-{
- setTimeout("createConnection()",5000)
+function check()
+{
+ setTimeout("createConnection()",5000)
if (getconnect_server() == "false")
{
alert("Please Login To The Database First !")
@@ -24,7 +24,20 @@ function searchmail()
alert("Please install the thunderbird module on your '" + getDbName() +"' database and try again !");
return false
}
- var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
+ if(GetNumSelectedMessages() < 1 || GetNumSelectedMessages() > 1){
+ alert("You must select only one mail to archive");
+ return false
+ }
+ return true
+
+}
+
+function searchmail()
+{
+ 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");
@@ -45,11 +58,7 @@ function searchmail()
IETexported = 0;
var msguri = emlsArray[0];
- if(GetNumSelectedMessages() < 1 || GetNumSelectedMessages() > 1){
- alert("You must select only one mail to archive");
- return false
- }
-
+
//gives the selected email uri
var messageUri= gDBView.URIForFirstSelectedMessage;
@@ -83,10 +92,10 @@ function searchmail()
sendername = message.author;
}
if(message.author.indexOf('<')!=-1){
- senderemail = message.author.split('<')[1].split('>')[0];
+ senderemail = message.author.split('<')[1].split('>')[0];
}
else{
- senderemail = message.author
+ senderemail = message.author
}
//gives the receiver email address
@@ -157,46 +166,106 @@ function searchmail()
}
//function to read the attachment file contents
att =getAttachValue()
- if (getmodule_install() == "no")
- {
- alert("Please install the thunderbird module on your '" + getDbName() +"' database and try again !");
- return false
- }
window.open("chrome://openerp_plugin/content/plugin.xul", "", "chrome, resizable=yes");
createInstance(name,test)
}
else
{
- if (getmodule_install() == "no")
- {
- alert("Please install the thunderbird module on your '" + getDbName() +"' database and try again !");
- return false
- }
window.open("chrome://openerp_plugin/content/plugin.xul", "", "chrome, resizable=yes");
}
}
-
-
-function open_contact()
-{
- setTimeout("createConnection()",5000)
- if (getconnect_server() == "false")
- {
- alert("Please Login To The Database First !")
- return false;
- }
- setTimeout("module_install()", 10000)
- if (getmodule_install() == "no")
- {
- alert("Please install the thunderbird module on your '" + getDbName() +"' database and try again !");
- return false
- }
- if(GetNumSelectedMessages() < 1 || GetNumSelectedMessages() > 1){
- alert("You must select only one mail For Open Contact Detail");
- return false
+var openPartnerHandler = {
+ 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=='')
+ {
+ 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)
+ }
+ else{
+ alert("Partner is not Available.");
+ return;
+ }
+ }
+ }
+ },
+ onFault: function (client, ctxt, fault) {
+
+ },
+
+ onError: function (client, ctxt, status, errorMsg) {
+
}
+}
+
+function searchPartner(email)
+{
+ var branchobj = getPref();
+ setServerService('xmlrpc/object');
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
+ arrFinalList = [];
+ var xmlRpcClient = getXmlRpc();
+ 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 = email;
+ xmlRpcClient.asyncCall(openPartnerHandler,null,'execute',[ strDbName,struid,strpass,strobj,strmethod,strname ],6);
+}
+function open_partner()
+{
+ 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;
@@ -210,39 +279,156 @@ function open_contact()
sendername = message.author.split('"')[1].split('"')[0];
}
else if(message.author.indexOf('<')!=-1){
- sendername = message.author.split('<')[0];
+ sendername = message.author.split('<')[0];
}
else{
- sendername = message.author;
+ sendername = message.author;
}
if(message.author.indexOf('<')!=-1){
- senderemail = message.author.split('<')[1].split('>')[0];
+ senderemail = message.author.split('<')[1].split('>')[0];
}
else{
- senderemail = message.author
+ senderemail = message.author
}
+ 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)
+ },
+ onFault: function (client, ctxt, fault) {
- //set the initial information for the selected email
- setSenderEmail(senderemail);
- setSenderName(sendername);
- setPartnerName("");
- setStreet("");
- setStreet2("");
- setZipCode("");
- setCity("");
- setOfficenumber("");
- setFax("");
- setMobilenumber("");
-
- if (getmodule_install() == "no")
+ },
+
+ 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);
+ version = version_obj.getCharPref("lastAppVersion");
+ version = parseInt(version[0])
+
+ file = getPredefinedFolder(2);
+
+ if (version > 2)
{
- alert("Please install the thunderbird module on your '" + getDbName() +"' database and try again !");
- return false
+ var emlsArray = gFolderDisplay.selectedMessages;
+ }
+ else
+ {
+ var emlsArray = GetSelectedMessages();
}
+ IETtotal = emlsArray.length;
+ IETexported = 0;
+ var msguri = emlsArray[0];
+
+
+ var branchobj = getPref();
+ setServerService('xmlrpc/object');
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
+ var xmlRpcClient = getXmlRpc();
+ var strDbName = xmlRpcClient.createType(xmlRpcClient.STRING,{});
+ strDbName.data = branchobj.getCharPref("serverdbname");
+ var struids = xmlRpcClient.createType(xmlRpcClient.INT,{});
+ struids.data = branchobj.getIntPref('userid');
+ var strpass = xmlRpcClient.createType(xmlRpcClient.STRING,{});
+ strpass.data = branchobj.getCharPref("password");
+ var strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
+ 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);
+ xmlRpcClient.asyncCall(listDocumentHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
+}
+function open_contact()
+{
+ 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);
+ setPartnerName("");
+ setStreet("");
+ setStreet2("");
+ setZipCode("");
+ setCity("");
+ setOfficenumber("");
+ setFax("");
+ setMobilenumber("");
+ searchContact();
}
-
+
//function to open the configuration window
var Config = {
onLoad: function() {
@@ -279,18 +465,18 @@ var Create = {
}
};
window.addEventListener("load", function(e) { Create.onLoad(e); }, false);
-
+
var Address = {
onLoad: function(){
this.initialized=true;
},
- onMenuItemCommand: function(){
+ onMenuItemCommand: function(){
open_contact();
- searchContact();
+
}
};
-
+
//function to open the window for selecting the partner for a new contact creation
var Select = {
@@ -298,11 +484,12 @@ var Select = {
this.initialized=true;
},
- onMenuItemCommand: function(){
- //document.getElementById("txtselectpartner").value="";
+ onMenuItemCommand: function(){
+ // document.getElementById("txtselectpartner").value="";
window.open("chrome://openerp_plugin/content/selectpartner.xul", "", "chrome");
}
-};
+};
+
var CreatePartner = {
onLoad: function(){
@@ -310,7 +497,7 @@ var CreatePartner = {
},
onMenuItemCommand: function(){
- window.open("chrome://openerp_plugin/content/createpartner.xul", "", "chrome");
+ window.open("chrome://openerp_plugin/content/createpartner.xul", "", "chrome");
}
};
window.addEventListener("load", function(e) { CreatePartner.onLoad(e); }, false);
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul
index c48dc0d70b9..15626e54f49 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/overlay.xul
@@ -14,7 +14,7 @@
image="&menuicon.value;"
class="menuitem-iconic"
tooltiptext="&pluginconfig.value;"/>
-
+
-
+
+
+
+ oncommand="open_document();" />
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul
index f0c44cd6555..ca35f02cc2a 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul
@@ -1,8 +1,7 @@
-
@@ -29,7 +28,7 @@
-
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js
index cc3d26e7e84..fadc29222fe 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js
@@ -201,6 +201,10 @@ function setDbName(argDbName){
getPref().setCharPref('serverdbname',argDbName);
}
+//set webserver url
+function setWebServerURL(argWebServerURL){
+ getPref().setCharPref('webserverurl',argWebServerURL);
+}
//set preference value of username for login
function setUsername(argUsername){
getPref().setCharPref('username',argUsername);
@@ -399,6 +403,11 @@ function getDbName(){
return getPref().getCharPref('serverdbname');
}
+//get webserver url
+function getWebServerURL(){
+ return getPref().getCharPref('webserverurl');
+}
+
//get username from config settings
function getUsername(){
return getPref().getCharPref('username');
@@ -459,7 +468,8 @@ function getSenderName(){
}
}
-//ger partner name
+
+//get partner name
function getPartnerName(){
return getPref().getCharPref('partnername');
}
@@ -909,31 +919,46 @@ function createMenuItem(aLabel) {
}
-function listinstallmodule( result ) {
- if ( rpc.onfault( result ) )
- {
- setmodule_install('no')
+var listinstallmodulehandler = {
+ onResult: function(client, context, result) {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
+ var arrIdList = result.QueryInterface(Components.interfaces.nsISupportsArray);
+ var count = arrIdList.Count();
+ if (count > 0)
+ {
+ setmodule_install('yes')
+ }
+
+ },
+ onFault: function (client, ctxt, fault) {
+ setmodule_install('no')
+ },
+
+ onError: function (client, ctxt, status, errorMsg) {
+ setmodule_install('no')
}
}
function module_install()
{
- setmodule_install("yes")
+ setmodule_install("no")
var branchobj = getPref();
setServerService('xmlrpc/object');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var xmlRpcClient = getXmlRpc();
- strDbName = branchobj.getCharPref("serverdbname");
- struid = branchobj.getIntPref('userid');
- strpass = branchobj.getCharPref("password");
- strmethod = 'search';
- strobj = 'thunderbird.partner'; // TOFIX: Find module 'thunderbird' into 'module.module' model.
- var temp = new Array()
- server=getServer()
- port=getPort()
- basicList=getBasicList()
- rpc.addserver('object',basicList[3] , basicList[4],'/xmlrpc/object');
- srcids=rpc.ask( 'object', 'execute', [basicList[0],basicList[1],basicList[2],strobj,strmethod,[]],listinstallmodule)
+ 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 strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
+ strmethod.data = 'name_search';
+ var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
+ strobj.data = 'ir.model';
+ var strvalue = xmlRpcClient.createType(xmlRpcClient.STRING,{});
+ strvalue.data = 'thunderbird.partner';
+ xmlRpcClient.asyncCall(listinstallmodulehandler,null,'execute',[ strDbName,struid,strpass,strobj,strmethod, strvalue],6);
}
@@ -951,7 +976,7 @@ var listSearchContactHandler = {
setPartnerName(strlSearchResultValue);
var t = getPartnerName();}
- if(strlSearchResult=="contactname"){
+ if(strlSearchResult=="contactname"){
setSenderName(strlSearchResultValue);
var t = getSenderName();}
@@ -1048,6 +1073,7 @@ var listSearchContactdetailHandler = {
document.getElementById("txtmobile").value =strlSearchResultValue;}
if(strlSearchResult=="email"&& strlSearchResultValue!=''){
+ alert("Contact is Available.")
document.getElementById("txtemail").value =strlSearchResultValue;}
if(strlSearchResult=="res_id"){
@@ -1195,7 +1221,7 @@ var listSearchCheckboxHandler = {
listcell.setAttribute("label",arrFinalList[i][j][1]); //stores the name ofthe record
listItem.appendChild(listcell);
listItem.value = arrFinalList[i][j][0]; //stores the id of the record
- listItem.label = arr1[i]; // stores the value of the object
+ listItem.label = arr1[i]; // stores the value of the object
cmbSearchList.appendChild(listItem);
}
}
@@ -1303,7 +1329,9 @@ var listPartnerHandler = {
listItem.value = arrPartnerList[i][0];
cmdPartnerList.appendChild(listItem);
}
+
}
+
},
onFault: function (client, ctxt, fault) {
@@ -1362,7 +1390,24 @@ function dictcontact(a,b){
var listArchiveHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
+ list_documents = document.getElementById('listSearchBox')
var createId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
+ createId = parseInt(createId);
+ if(createId==0)
+ {
+ alert("Mail is Already Archived Successfully.");
+ }
+ else if (createId<0)
+ {
+ alert("sorry Mail is not Archived");
+
+ }
+
+ else if (createId>=1)
+ {
+ alert("Mail Archived Successfully");
+ }
+ window.close();
},
onFault: function (client, ctxt, fault) {
@@ -1402,6 +1447,7 @@ function parse_eml(){
var output = sis.read( sis.available() );
return output
}
+
}
function upload_archivemail()
{
@@ -1438,14 +1484,34 @@ function upload_archivemail()
var a = ['ref_ids','message'];
var b = [ref_ids, eml_string];
var arrofarr = dictcontact(a,b);
+
xmlRpcClient.asyncCall(listArchiveHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
- alert("Mail Archived Successfully.");
- window.close();
+ // alert("Mail Archived Successfully to" +" " + ":" + " "+ list_documents.value);
+ //window.close();
}
+var listArchiveDocumentHandler = {
+ onResult: function(client, context, result) {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
+ var createId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
+ var popup = document.getElementById("section").selectedItem;
+ alert("Document Created Successfully For " +" " + ":" + " "+ popup.label);
+ window.close();
+
+ },
+ onFault: function (client, ctxt, fault) {
+
+ },
+
+ onError: function (client, ctxt, status, errorMsg) {
+
+ }
+}
+
function create_archivemail(){
- var popup = document.getElementById("section").selectedItem; // a element
+ var popup = document.getElementById("section").selectedItem;
+ // a element
if (String(popup) != "null"){
object=popup.value;
@@ -1469,10 +1535,10 @@ function create_archivemail(){
var a = ['model', 'message'];
var b = [object, eml_string];
var arrofarr = dictcontact(a,b);
- xmlRpcClient.asyncCall(listArchiveHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
- alert("Document Created Successfully.");
+ xmlRpcClient.asyncCall(listArchiveDocumentHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
+ //alert("Document Created Successfully For " +" " + ":" + " "+ popup.label);
}
- window.close();
+ //window.close();
}
else
{
@@ -1679,6 +1745,16 @@ function createInstance(name,test){
}
//xmlrpc request handler for handling the login information
+function check_module_install(count){
+ if (getmodule_install() == "no")
+ {
+ if (count <= 0){ return false; }
+ count = count - 1;
+ return check_module_install(count)
+ }
+ return true
+}
+
var listLoginHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
@@ -1686,8 +1762,14 @@ var listLoginHandler = {
if(login.type == 12){
login = result.QueryInterface(Components.interfaces.nsISupportsPRInt32)
setUserId(login.data);
- alert('Successfully Login To OpenERP.');
- window.close();
+ 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();
+ }
}
else{
alert("Login Failed");
@@ -1744,6 +1826,7 @@ function testConnection(){
var strpass = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strpass.data = getPref().getCharPref('password');
xmlRpcClient.asyncCall(listLoginHandler,null,'login',[strDbName,strusername,strpass],3);
+
}
@@ -1944,7 +2027,7 @@ var listsearchAttachmentHandler = {
count += 1
var hbox = document.createElement("vbox");
var checkbox1 = document.createElement("checkbox");
-
+
checkbox1.setAttribute("label",object[i]);
checkbox1.setAttribute("id","cbx"+(i+1));
checkbox1.setAttribute("width",150)
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/address.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/address.dtd
index 3b5b95e2a32..3dd37445ada 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/address.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/address.dtd
@@ -17,7 +17,7 @@
-
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/config.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/config.dtd
index 23cd94efa05..26495872037 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/config.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/config.dtd
@@ -1,6 +1,6 @@
-
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/create.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/create.dtd
index 181d408a3e9..bb5f2c34be6 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/create.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/create.dtd
@@ -21,7 +21,7 @@
-
+
@@ -31,7 +31,7 @@
-
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/createpartner.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/createpartner.dtd
index 67b32b32907..f323277b482 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/createpartner.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/createpartner.dtd
@@ -2,6 +2,6 @@
-
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd
index 4d49c4bc4b0..a2345f0aaaf 100755
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/overlay.dtd
@@ -3,7 +3,7 @@
-
+
diff --git a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/selectpartner.dtd b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/selectpartner.dtd
index e6a62c16003..d568b96a4ca 100644
--- a/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/selectpartner.dtd
+++ b/addons/thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/locale/en-US/selectpartner.dtd
@@ -5,7 +5,7 @@
-
+
diff --git a/addons/thunderbird/thunderbird_installer.xml b/addons/thunderbird/thunderbird_installer.xml
index 622ca3ed127..0c8b431a82f 100644
--- a/addons/thunderbird/thunderbird_installer.xml
+++ b/addons/thunderbird/thunderbird_installer.xml
@@ -39,7 +39,7 @@
-
+
@@ -76,8 +76,7 @@
{'menu':True}
-
-
+