[MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9698, revision-id: odo@openerp.com-20131216142049-xh9gxy5cir3p2i09
bzr revid: dle@openerp.com-20131216111534-0w0jdod25ff3iapc bzr revid: odo@openerp.com-20131216142246-unt6qqb23uq53we1
This commit is contained in:
commit
89a6771f6a
|
@ -450,6 +450,7 @@ class account_analytic_account(osv.osv):
|
|||
'is_overdue_quantity' : fields.function(_is_overdue_quantity, method=True, type='boolean', string='Overdue Quantity',
|
||||
store={
|
||||
'account.analytic.line' : (_get_analytic_account, None, 20),
|
||||
'account.analytic.account': (lambda self, cr, uid, ids, c=None: ids, ['quantity_max'], 10),
|
||||
}),
|
||||
'ca_invoiced': fields.function(_ca_invoiced_calc, type='float', string='Invoiced Amount',
|
||||
help="Total customer invoiced amount for this account.",
|
||||
|
|
|
@ -23,6 +23,7 @@ from datetime import datetime, timedelta
|
|||
import time
|
||||
import logging
|
||||
|
||||
import openerp
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
||||
|
@ -222,6 +223,7 @@ class base_action_rule(osv.osv):
|
|||
def create(self, cr, uid, vals, context=None):
|
||||
res_id = super(base_action_rule, self).create(cr, uid, vals, context=context)
|
||||
self._register_hook(cr, [res_id])
|
||||
openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
|
||||
return res_id
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
|
@ -229,6 +231,7 @@ class base_action_rule(osv.osv):
|
|||
ids = [ids]
|
||||
super(base_action_rule, self).write(cr, uid, ids, vals, context=context)
|
||||
self._register_hook(cr, ids)
|
||||
openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
|
||||
return True
|
||||
|
||||
def onchange_model_id(self, cr, uid, ids, model_id, context=None):
|
||||
|
|
|
@ -32,6 +32,7 @@ import psycopg2
|
|||
|
||||
import openerp
|
||||
from openerp import tools
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.osv.orm import except_orm
|
||||
import openerp.report.interface
|
||||
|
@ -322,7 +323,7 @@ class document_directory(osv.osv):
|
|||
ressource_parent_type_id=vals.get('ressource_parent_type_id',False)
|
||||
ressource_id=vals.get('ressource_id',0)
|
||||
if op=='write':
|
||||
for directory in self.browse(cr, uid, ids):
|
||||
for directory in self.browse(cr, SUPERUSER_ID, ids):
|
||||
if not name:
|
||||
name=directory.name
|
||||
if not parent_id:
|
||||
|
@ -336,7 +337,7 @@ class document_directory(osv.osv):
|
|||
if len(res):
|
||||
return False
|
||||
if op=='create':
|
||||
res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('ressource_parent_type_id','=',ressource_parent_type_id),('ressource_id','=',ressource_id)])
|
||||
res = self.search(cr, SUPERUSER_ID, [('name','=',name),('parent_id','=',parent_id),('ressource_parent_type_id','=',ressource_parent_type_id),('ressource_id','=',ressource_id)])
|
||||
if len(res):
|
||||
return False
|
||||
return True
|
||||
|
|
|
@ -58,6 +58,23 @@
|
|||
!python {model: ir.attachment}: |
|
||||
ids = self.search(cr, uid, [('res_model', '=', 'res.country'), ('res_id', '=', ref("base.za"))])
|
||||
assert ids == [ ref("attach_3rd")], ids
|
||||
-
|
||||
I test that I can't create duplicate directories (even when duplicates are hidden by a record rule)
|
||||
-
|
||||
!python {model: document.directory}: |
|
||||
duplicate_detected = False
|
||||
from openerp.osv.osv import except_osv
|
||||
try:
|
||||
demo_uid = ref('base.user_demo')
|
||||
dir_vals = {
|
||||
'name': 'Testing (will be deleted!)',
|
||||
'parent_id': ref('document.dir_root')
|
||||
}
|
||||
new_dir_id = self.create(cr, demo_uid, dir_vals, context=None)
|
||||
self.unlink(cr, uid, [new_dir_id], context=None)
|
||||
except except_osv, e:
|
||||
duplicate_detected = e.value == u'Directory name must be unique!'
|
||||
assert duplicate_detected is True, 'Failed to detect duplicate directory'
|
||||
-
|
||||
I delete the attachments
|
||||
-
|
||||
|
|
Loading…
Reference in New Issue