[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',
|
'is_overdue_quantity' : fields.function(_is_overdue_quantity, method=True, type='boolean', string='Overdue Quantity',
|
||||||
store={
|
store={
|
||||||
'account.analytic.line' : (_get_analytic_account, None, 20),
|
'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',
|
'ca_invoiced': fields.function(_ca_invoiced_calc, type='float', string='Invoiced Amount',
|
||||||
help="Total customer invoiced amount for this account.",
|
help="Total customer invoiced amount for this account.",
|
||||||
|
|
|
@ -23,6 +23,7 @@ from datetime import datetime, timedelta
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import openerp
|
||||||
from openerp import SUPERUSER_ID
|
from openerp import SUPERUSER_ID
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
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):
|
def create(self, cr, uid, vals, context=None):
|
||||||
res_id = super(base_action_rule, self).create(cr, uid, vals, context=context)
|
res_id = super(base_action_rule, self).create(cr, uid, vals, context=context)
|
||||||
self._register_hook(cr, [res_id])
|
self._register_hook(cr, [res_id])
|
||||||
|
openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
|
||||||
return res_id
|
return res_id
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None):
|
def write(self, cr, uid, ids, vals, context=None):
|
||||||
|
@ -229,6 +231,7 @@ class base_action_rule(osv.osv):
|
||||||
ids = [ids]
|
ids = [ids]
|
||||||
super(base_action_rule, self).write(cr, uid, ids, vals, context=context)
|
super(base_action_rule, self).write(cr, uid, ids, vals, context=context)
|
||||||
self._register_hook(cr, ids)
|
self._register_hook(cr, ids)
|
||||||
|
openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def onchange_model_id(self, cr, uid, ids, model_id, context=None):
|
def onchange_model_id(self, cr, uid, ids, model_id, context=None):
|
||||||
|
|
|
@ -32,6 +32,7 @@ import psycopg2
|
||||||
|
|
||||||
import openerp
|
import openerp
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
|
from openerp import SUPERUSER_ID
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.osv.orm import except_orm
|
from openerp.osv.orm import except_orm
|
||||||
import openerp.report.interface
|
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_parent_type_id=vals.get('ressource_parent_type_id',False)
|
||||||
ressource_id=vals.get('ressource_id',0)
|
ressource_id=vals.get('ressource_id',0)
|
||||||
if op=='write':
|
if op=='write':
|
||||||
for directory in self.browse(cr, uid, ids):
|
for directory in self.browse(cr, SUPERUSER_ID, ids):
|
||||||
if not name:
|
if not name:
|
||||||
name=directory.name
|
name=directory.name
|
||||||
if not parent_id:
|
if not parent_id:
|
||||||
|
@ -336,7 +337,7 @@ class document_directory(osv.osv):
|
||||||
if len(res):
|
if len(res):
|
||||||
return False
|
return False
|
||||||
if op=='create':
|
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):
|
if len(res):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -58,6 +58,23 @@
|
||||||
!python {model: ir.attachment}: |
|
!python {model: ir.attachment}: |
|
||||||
ids = self.search(cr, uid, [('res_model', '=', 'res.country'), ('res_id', '=', ref("base.za"))])
|
ids = self.search(cr, uid, [('res_model', '=', 'res.country'), ('res_id', '=', ref("base.za"))])
|
||||||
assert ids == [ ref("attach_3rd")], ids
|
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
|
I delete the attachments
|
||||||
-
|
-
|
||||||
|
|
Loading…
Reference in New Issue