[MERGE] Forward-port saas-3 up to 09ab2d4
This commit is contained in:
commit
c926b54a49
|
@ -249,6 +249,10 @@ class users(osv.osv):
|
|||
return user_id
|
||||
registry = RegistryManager.get(db)
|
||||
with registry.cursor() as cr:
|
||||
cr.execute("SELECT id, active FROM res_users WHERE lower(login)=%s", (login,))
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
return False
|
||||
ldap_obj = registry.get('res.company.ldap')
|
||||
for conf in ldap_obj.get_ldap_dicts(cr):
|
||||
entry = ldap_obj.authenticate(conf, login, password)
|
||||
|
|
|
@ -368,6 +368,7 @@ class pos_session(osv.osv):
|
|||
if not cashids:
|
||||
cashids = journal_proxy.search(cr, uid, [('journal_user','=',True)], context=context)
|
||||
|
||||
journal_proxy.write(cr, uid, cashids, {'journal_user': True})
|
||||
jobj.write(cr, uid, [pos_config.id], {'journal_ids': [(6,0, cashids)]})
|
||||
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
|
|||
if not openerp.modules.db.is_initialized(cr):
|
||||
_logger.info("init db")
|
||||
openerp.modules.db.initialize(cr)
|
||||
update_module = True # process auto-installed modules
|
||||
tools.config["init"]["all"] = 1
|
||||
tools.config['update']['all'] = 1
|
||||
if not tools.config['without_demo']:
|
||||
|
|
|
@ -53,6 +53,7 @@ import simplejson
|
|||
import time
|
||||
import traceback
|
||||
import types
|
||||
from collections import defaultdict
|
||||
|
||||
import babel.dates
|
||||
import dateutil.relativedelta
|
||||
|
@ -2693,6 +2694,9 @@ class BaseModel(object):
|
|||
if len(constraints) == 1:
|
||||
# Is it the right constraint?
|
||||
cons, = constraints
|
||||
if self.is_transient() and not dest_model.is_transient():
|
||||
# transient foreign keys are added as cascade by default
|
||||
ondelete = ondelete or 'cascade'
|
||||
if cons['ondelete_rule'] != POSTGRES_CONFDELTYPES.get((ondelete or 'set null').upper(), 'a')\
|
||||
or cons['foreign_table'] != dest_model._table:
|
||||
# Wrong FK: drop it and recreate
|
||||
|
@ -3845,6 +3849,7 @@ class BaseModel(object):
|
|||
"""
|
||||
readonly = None
|
||||
self.check_field_access_rights(cr, user, 'write', vals.keys())
|
||||
deleted_related = defaultdict(list)
|
||||
for field in vals.copy():
|
||||
fobj = None
|
||||
if field in self._columns:
|
||||
|
@ -3853,6 +3858,10 @@ class BaseModel(object):
|
|||
fobj = self._inherit_fields[field][2]
|
||||
if not fobj:
|
||||
continue
|
||||
if fobj._type in ['one2many', 'many2many'] and vals[field]:
|
||||
for wtuple in vals[field]:
|
||||
if isinstance(wtuple, (tuple, list)) and wtuple[0] == 2:
|
||||
deleted_related[fobj._obj].append(wtuple[1])
|
||||
groups = fobj.write
|
||||
|
||||
if groups:
|
||||
|
@ -4059,7 +4068,8 @@ class BaseModel(object):
|
|||
for id in ids_to_update:
|
||||
if id not in done[key]:
|
||||
done[key][id] = True
|
||||
todo.append(id)
|
||||
if id not in deleted_related[object]:
|
||||
todo.append(id)
|
||||
self.pool[model_name]._store_set_values(cr, user, todo, fields_to_recompute, context)
|
||||
|
||||
self.step_workflow(cr, user, ids, context=context)
|
||||
|
|
Loading…
Reference in New Issue