diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index ebb0c4ff0cd..60ca4626033 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -845,7 +845,8 @@
-
+
+
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 2bbd2e92207..e5bbdc6f52c 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -880,7 +880,7 @@ class account_invoice(osv.osv):
lines = [(0, 0, l1), (0, 0, l2)]
move = {'ref': invoice.number, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date}
- move_id = self.pool.get('account.move').create(cr, uid, move)
+ move_id = self.pool.get('account.move').create(cr, uid, move, context=context)
line_ids = []
total = 0.0
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index 4350f0a42b8..deccf3c7a68 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -584,7 +584,7 @@ class account_analytic_account_summary_month(osv.osv):
_description = "Hours summary by month"
_auto = False
_rec_name = 'month'
- _order = 'month'
+# _order = 'month'
def _unit_amount(self, cr, uid, ids, name, arg, context=None):
res = {}
diff --git a/addons/base_module_record/base_module_record.py b/addons/base_module_record/base_module_record.py
index 719a136e5f7..b77027bbda2 100644
--- a/addons/base_module_record/base_module_record.py
+++ b/addons/base_module_record/base_module_record.py
@@ -128,8 +128,9 @@ class base_module_record(osv.osv):
noupdate = noupdate or update
if not id:
field.setAttribute("model", fields[key]['relation'])
- name = self.pool.get(fields[key]['relation']).browse(cr, uid, val).name
- field.setAttribute("search", "[('name','=','"+name+"')]")
+ fld_nm = self.pool.get(fields[key]['relation'])._rec_name
+ name = self.pool.get(fields[key]['relation']).read(cr, uid, val,[fld_nm])[fld_nm] or False
+ field.setAttribute("search", str([(str(fld_nm) ,'=', name)]))
else:
field.setAttribute("ref", id)
record.appendChild(field)
diff --git a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py
index 0380770caee..11462169b06 100644
--- a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py
+++ b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py
@@ -109,7 +109,14 @@ class email_parser(object):
import netsvc
netsvc.Logger().notifyChannel('mailgate', netsvc.LOG_ERROR, "%s" % e)
- id = self.rpc('crm.case', 'create', data)
+ try:
+ id = self.rpc('crm.case', 'create', data)
+
+
+ except Exception,e:
+ if getattr(e,'faultCode','') and 'AccessError' in e.faultCode:
+ e = '\n\nThe Specified user does not have an access to the CRM case.'
+ print e
attachments = message['attachment']
for attach in attachments or []:
@@ -316,7 +323,11 @@ if __name__ == '__main__':
msg_txt = email.message_from_file(sys.stdin)
- parser.parse(msg_txt)
-
+ try :
+ parser.parse(msg_txt)
+ except Exception,e:
+ if getattr(e,'faultCode','') and 'Connection unexpectedly closed' in e.faultCode:
+ print e
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/document/ftpserver/abstracted_fs.py b/addons/document/ftpserver/abstracted_fs.py
index b3dec8f2b5e..47f3a2f1b14 100644
--- a/addons/document/ftpserver/abstracted_fs.py
+++ b/addons/document/ftpserver/abstracted_fs.py
@@ -126,17 +126,20 @@ class abstracted_fs:
for db_name in result:
db, cr = None, None
try:
- db = pooler.get_db_only(db_name)
- cr = db.cursor()
- cr.execute("SELECT 1 FROM pg_class WHERE relkind = 'r' AND relname = 'ir_module_module'")
- if not cr.fetchone():
- continue
-
- cr.execute("select id from ir_module_module where name like 'document%' and state='installed' ")
- res = cr.fetchone()
- if res and len(res):
- self.db_name_list.append(db_name)
- cr.commit()
+ try:
+ db = pooler.get_db_only(db_name)
+ cr = db.cursor()
+ cr.execute("SELECT 1 FROM pg_class WHERE relkind = 'r' AND relname = 'ir_module_module'")
+ if not cr.fetchone():
+ continue
+
+ cr.execute("select id from ir_module_module where name like 'document%' and state='installed' ")
+ res = cr.fetchone()
+ if res and len(res):
+ self.db_name_list.append(db_name)
+ cr.commit()
+ except Exception, e:
+ log(e)
finally:
if cr is not None:
cr.close()
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index 3b5923b5ba9..8d18ffb83e7 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -304,11 +304,14 @@ class pos_order(osv.osv):
def create_picking(self, cr, uid, ids, context={}):
"""Create a picking for each order and validate it."""
picking_obj = self.pool.get('stock.picking')
-
+ partner_obj = self.pool.get('res.partner')
+ address_id = False
orders = self.browse(cr, uid, ids, context)
for order in orders:
if not order.last_out_picking:
new = True
+ if order.partner_id.id:
+ address_id = partner_obj.address_get(cr, uid, [order.partner_id.id], ['delivery'])['delivery']
picking_id = picking_obj.create(cr, uid, {
'origin': order.name,
'type': 'out',
@@ -318,7 +321,8 @@ class pos_order(osv.osv):
'invoice_state': 'none',
'auto_picking': True,
'pos_order': order.id,
- })
+ 'address_id' : address_id
+ },context)
self.write(cr, uid, [order.id], {'last_out_picking': picking_id})
else:
picking_id = order.last_out_picking.id
diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py
index 69b95d1ac8f..3e232f7413c 100644
--- a/addons/product/report/product_pricelist.py
+++ b/addons/product/report/product_pricelist.py
@@ -45,7 +45,7 @@ class product_pricelist(report_sxw.rml_parse):
qtys = 1
for i in range(1,6):
- if form['qty'+str(i)] >= 0 and form['qty'+str(i)] not in vals.values():
+ if form['qty'+str(i)] > 0 and form['qty'+str(i)] not in vals.values():
vals['qty'+str(qtys)] = form['qty'+str(i)]
qtys += 1
lst.append(vals)
@@ -54,7 +54,7 @@ class product_pricelist(report_sxw.rml_parse):
def _set_quantity(self,form):
for i in range(1,6):
q = 'qty%d'%i
- if form[q] >=0 and form[q] not in self.quantity:
+ if form[q] >0 and form[q] not in self.quantity:
self.quantity.append(form[q])
# else:
# self.quantity.append(0)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 2cdb9a22f13..4b372b78459 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -955,7 +955,12 @@ class stock_move(osv.osv):
['prodlot_id'])]
def _default_location_destination(self, cr, uid, context={}):
if context.get('move_line', []):
- return context['move_line'][0][2] and context['move_line'][0][2]['location_dest_id'] or False
+ if context['move_line'][0]:
+ if isinstance(context['move_line'][0],(tuple,list)):
+ return context['move_line'][0][2] and context['move_line'][0][2]['location_dest_id'] or False
+ else:
+ move_list = self.pool.get('stock.move').read(cr, uid, context['move_line'][0],['location_dest_id'])
+ return move_list and move_list['location_dest_id'][0] or False
if context.get('address_out_id', False):
return self.pool.get('res.partner.address').browse(cr, uid, context['address_out_id'], context).partner_id.property_stock_customer.id
return False
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index c1a58bb23bd..17a0de03be6 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -343,7 +343,7 @@
-
+
@@ -422,7 +422,7 @@
-
+
@@ -436,7 +436,7 @@
-
+
@@ -458,7 +458,7 @@
form