[MERGE] forward port of branch saas-3 up to revid 38abc8a

This commit is contained in:
Christophe Simonis 2014-05-20 19:00:50 +02:00
commit bb26dea60b
8 changed files with 32 additions and 12 deletions

View File

@ -21,7 +21,7 @@
from openerp.osv import osv, fields
from openerp.addons.edi import EDIMixin
from urllib import urlencode
from werkzeug import url_encode
INVOICE_LINE_EDI_STRUCT = {
'name': True,
@ -274,7 +274,7 @@ class account_invoice(osv.osv, EDIMixin):
"no_note": "1",
"bn": "OpenERP_Invoice_PayNow_" + inv.currency_id.name,
}
res[inv.id] = "https://www.paypal.com/cgi-bin/webscr?" + urlencode(params)
res[inv.id] = "https://www.paypal.com/cgi-bin/webscr?" + url_encode(params)
return res
_columns = {

View File

@ -432,6 +432,14 @@ def prepare_audittrail_log_line(cr, uid, pool, model, resource_id, method, old_v
'old_value_text': key in old_values and old_values[key]['text'].get(field_name)
}
lines[key].append(data)
# On read log add current values for fields.
if method == 'read':
data={
'name': field_name,
'old_value': key in old_values and old_values[key]['value'].get(field_name),
'old_value_text': key in old_values and old_values[key]['text'].get(field_name)
}
lines[key].append(data)
return lines
def process_data(cr, uid, pool, res_ids, model, method, old_values=None, new_values=None, field_list=None):

View File

@ -565,7 +565,7 @@ class pos_order(osv.osv):
try:
self.signal_paid(cr, uid, [order_id])
except Exception as e:
_logger.error('Could not mark POS Order as Paid: %s', tools.ustr(e))
_logger.error('Could not fully process the POS Order: %s', tools.ustr(e))
if to_invoice:
self.action_invoice(cr, uid, [order_id], context)
@ -725,8 +725,6 @@ class pos_order(osv.osv):
move_obj = self.pool.get('stock.move')
for order in self.browse(cr, uid, ids, context=context):
if not order.state=='draft':
continue
addr = order.partner_id and partner_obj.address_get(cr, uid, [order.partner_id.id], ['delivery']) or {}
picking_id = picking_obj.create(cr, uid, {
'origin': order.name,
@ -1167,8 +1165,8 @@ class pos_order(osv.osv):
return self.write(cr, uid, ids, {'state': 'payment'}, context=context)
def action_paid(self, cr, uid, ids, context=None):
self.create_picking(cr, uid, ids, context=context)
self.write(cr, uid, ids, {'state': 'paid'}, context=context)
self.create_picking(cr, uid, ids, context=context)
return True
def action_cancel(self, cr, uid, ids, context=None):

View File

@ -22,7 +22,7 @@ from openerp.osv import osv, fields
from openerp.addons.edi import EDIMixin
from openerp.tools.translate import _
from urllib import urlencode
from werkzeug import url_encode
SALE_ORDER_LINE_EDI_STRUCT = {
'sequence': True,
@ -197,7 +197,7 @@ class sale_order(osv.osv, EDIMixin):
"no_note": "1",
"bn": "OpenERP_Order_PayNow_" + order.pricelist_id.currency_id.name,
}
res[order.id] = "https://www.paypal.com/cgi-bin/webscr?" + urlencode(params)
res[order.id] = "https://www.paypal.com/cgi-bin/webscr?" + url_encode(params)
return res
_columns = {

View File

@ -351,6 +351,8 @@ class ir_model_fields(osv.osv):
raise except_orm(_('Error'), _("Model %s does not exist!") % vals['relation'])
if vals['model'] in self.pool:
if vals['model'].startswith('x_') and vals['name'] == 'x_name':
self.pool[vals['model']]._rec_name = 'x_name'
self.pool[vals['model']].__init__(self.pool, cr)
#Added context to _auto_init for special treatment to custom field for select_level
ctx = dict(context,

View File

@ -229,7 +229,7 @@ class view(osv.osv):
['type', '=', view_type],
['inherit_id', '=', False],
]
ids = self.search(cr, uid, domain, limit=1, order='priority', context=context)
ids = self.search(cr, uid, domain, limit=1, context=context)
if not ids:
return False
return ids[0]

View File

@ -3758,9 +3758,13 @@ class BaseModel(object):
ir_values_obj.unlink(cr, uid, ir_value_ids, context=context)
for order, obj_name, store_ids, fields in result_store:
if obj_name != self._name:
if obj_name == self._name:
effective_store_ids = list(set(store_ids) - set(ids))
else:
effective_store_ids = store_ids
if effective_store_ids:
obj = self.pool[obj_name]
cr.execute('select id from '+obj._table+' where id IN %s', (tuple(store_ids),))
cr.execute('select id from '+obj._table+' where id IN %s', (tuple(effective_store_ids),))
rids = map(lambda x: x[0], cr.fetchall())
if rids:
obj._store_set_values(cr, uid, rids, fields, context)
@ -5130,7 +5134,14 @@ class BaseModel(object):
# shortcut read if we only want the ids
return [{'id': id} for id in record_ids]
result = self.read(cr, uid, record_ids, fields, context=context)
# read() ignores active_test, but it would forward it to any downstream search call
# (e.g. for x2m or function fields), and this is not the desired behavior, the flag
# was presumably only meant for the main search().
# TODO: Move this to read() directly?
read_ctx = dict(context or {})
read_ctx.pop('active_test', None)
result = self.read(cr, uid, record_ids, fields, context=read_ctx)
if len(result) <= 1:
return result

View File

@ -476,6 +476,7 @@ ALL_LANGUAGES = {
'lo_LA': u'Lao / ພາສາລາວ',
'lt_LT': u'Lithuanian / Lietuvių kalba',
'lv_LV': u'Latvian / latviešu valoda',
'mk_MK': u'Macedonian / македонски јазик',
'ml_IN': u'Malayalam / മലയാളം',
'mn_MN': u'Mongolian / монгол',
'nb_NO': u'Norwegian Bokmål / Norsk bokmål',