commit
1a89da0476
|
@ -37,7 +37,7 @@
|
|||
-
|
||||
!python {model: account.invoice}: |
|
||||
acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
|
||||
assert acc_id.move_id, "Move not created"
|
||||
assert (not acc_id.move_id), "Move falsely created at pro-forma"
|
||||
-
|
||||
I create invoice by clicking on Create button
|
||||
-
|
||||
|
@ -53,7 +53,7 @@
|
|||
-
|
||||
!python {model: account.invoice}: |
|
||||
acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
|
||||
assert acc_id.move_id, "Move created"
|
||||
assert acc_id.move_id, "Move not created for open invoice"
|
||||
-
|
||||
I create a record for partial payment of 1000 EUR.
|
||||
-
|
||||
|
|
|
@ -598,7 +598,7 @@ class Calendar(CalDAV, osv.osv):
|
|||
data_ids = mod_obj.search(cr, uid, line_domain, order="id", context=context)
|
||||
for data in mod_obj.browse(cr, uid, data_ids, context):
|
||||
ctx = parent and parent.context or None
|
||||
if data.recurrent_uid:
|
||||
if hasattr(data, 'recurrent_uid') and data.recurrent_uid:
|
||||
# Skip for event which is child of other event
|
||||
continue
|
||||
node = res_node_calendar('%s.ics' %data.id, parent, ctx, data, line.object_id.model, data.id)
|
||||
|
|
|
@ -25,6 +25,7 @@ from datetime import datetime, timedelta
|
|||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import time
|
||||
import logging
|
||||
|
||||
class crm_lead(crm_case, osv.osv):
|
||||
""" CRM Leads """
|
||||
|
@ -178,13 +179,20 @@ class res_users(osv.osv):
|
|||
_name = 'res.users'
|
||||
_inherit = 'res.users'
|
||||
|
||||
def create(self, cr, uid, data, context={}):
|
||||
def create(self, cr, uid, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
user_id = super(res_users, self).create(cr, uid, data, context)
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
data_id = data_obj._get_id(cr, uid, 'crm', 'ir_ui_view_sc_calendar0')
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
copy_id = self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
|
||||
'user_id': user_id}, context=context)
|
||||
try:
|
||||
data_id = data_obj._get_id(cr, uid, 'crm', 'ir_ui_view_sc_calendar0')
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
copy_id = self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
|
||||
'user_id': user_id}, context=context)
|
||||
except ValueError:
|
||||
# Tolerate a missing shortcut. See product/product.py for similar code.
|
||||
logging.getLogger('orm').warning('Skipped Products shortcut for user "%s"', data.get('name','<new'))
|
||||
|
||||
return user_id
|
||||
|
||||
res_users()
|
||||
|
|
|
@ -240,7 +240,7 @@ class document_file(osv.osv):
|
|||
return bro.address_id.partner_id.id
|
||||
return False
|
||||
|
||||
def unlink(self, cr, uid, ids, context={}):
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
stor = self.pool.get('document.storage')
|
||||
unres = []
|
||||
# We have to do the unlink in 2 stages: prepare a list of actual
|
||||
|
@ -250,7 +250,15 @@ class document_file(osv.osv):
|
|||
|
||||
for f in self.browse(cr, uid, ids, context):
|
||||
# TODO: update the node cache
|
||||
r = stor.prepare_unlink(cr, uid, f.parent_id.storage_id, f)
|
||||
par = f.parent_id
|
||||
storage_id = None
|
||||
while par:
|
||||
if par.storage_id:
|
||||
storage_id = par.storage_id
|
||||
break
|
||||
par = par.parent_id
|
||||
assert storage_id, "Strange, found file #%s w/o storage!" % f.id
|
||||
r = stor.prepare_unlink(cr, uid, storage_id, f)
|
||||
if r:
|
||||
unres.append(r)
|
||||
res = super(document_file, self).unlink(cr, uid, ids, context)
|
||||
|
|
|
@ -110,7 +110,7 @@ class document_directory(osv.osv):
|
|||
('no_selfparent', 'check(parent_id <> id)', 'Directory cannot be parent of itself!'),
|
||||
('dir_parented', 'check(parent_id IS NOT NULL OR storage_id IS NOT NULL)', 'Directory must have a parent or a storage')
|
||||
]
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
res = []
|
||||
if not self.search(cr,uid,[('id','in',ids)]):
|
||||
ids = []
|
||||
|
|
|
@ -121,7 +121,7 @@ class node_context(object):
|
|||
if fbro.parent_id:
|
||||
parent = self.get_dir_node(cr, fbro.parent_id)
|
||||
|
||||
return node_file(fbro.name,parent,self,fbro)
|
||||
return node_file(fbro.name, parent, self, fbro)
|
||||
|
||||
|
||||
class node_descriptor(object):
|
||||
|
@ -644,7 +644,7 @@ class node_dir(node_database):
|
|||
if (not self.parent) and ndir_node:
|
||||
if not dbro.parent_id:
|
||||
raise IOError(errno.EPERM, "Cannot move the root directory!")
|
||||
self.parent = self.context.get_dir_node(cr, dbro.parent_id.id)
|
||||
self.parent = self.context.get_dir_node(cr, dbro.parent_id)
|
||||
assert self.parent
|
||||
|
||||
if self.parent != ndir_node:
|
||||
|
@ -1187,7 +1187,7 @@ class node_file(node_class):
|
|||
return ''
|
||||
|
||||
def move_to(self, cr, ndir_node, new_name=False, fil_obj=None, ndir_obj=None, in_write=False):
|
||||
if ndir_node.context != self.context:
|
||||
if ndir_node and ndir_node.context != self.context:
|
||||
raise NotImplementedError("Cannot move files between contexts")
|
||||
|
||||
if (not self.check_perms(8)) and ndir_node.check_perms(2):
|
||||
|
@ -1205,11 +1205,11 @@ class node_file(node_class):
|
|||
|
||||
if (not self.parent):
|
||||
# there *must* be a parent node for this one
|
||||
self.parent = self.context.get_dir_node(cr, dbro.parent_id.id)
|
||||
self.parent = self.context.get_dir_node(cr, dbro.parent_id)
|
||||
assert self.parent
|
||||
|
||||
ret = {}
|
||||
if self.parent != ndir_node:
|
||||
if ndir_node and self.parent != ndir_node:
|
||||
if not (isinstance(self.parent, node_dir) and isinstance(ndir_node, node_dir)):
|
||||
logger.debug('Cannot move file %r from %r to %r', self, self.parent, ndir_node)
|
||||
raise NotImplementedError('Cannot move files between dynamic folders')
|
||||
|
|
|
@ -74,7 +74,7 @@ class abstracted_fs(object):
|
|||
if not cr.fetchone():
|
||||
continue
|
||||
|
||||
cr.execute("SELECT id FROM ir_module_module WHERE name = 'document_ftp' AND state IN ('installed', 'to upgrade') ")
|
||||
cr.execute("SELECT id FROM ir_module_module WHERE name = 'document_ftp' AND state IN ('installed', 'to install', 'to upgrade') ")
|
||||
res = cr.fetchone()
|
||||
if res and len(res):
|
||||
self.db_name_list.append(db_name)
|
||||
|
@ -287,7 +287,7 @@ class abstracted_fs(object):
|
|||
raise IOError(errno.EPERM, 'Cannot perform operation at root dir')
|
||||
dbname = p_parts[0]
|
||||
if dbname not in self.db_list():
|
||||
raise IOError(errno.ENOENT,'Invalid database path')
|
||||
raise IOError(errno.ENOENT,'Invalid database path: %s' % dbname)
|
||||
try:
|
||||
db = pooler.get_db(dbname)
|
||||
except Exception:
|
||||
|
|
|
@ -120,13 +120,23 @@
|
|||
I delete the test2.txt from the server (RPC).
|
||||
-
|
||||
!delete { model: ir.attachment, id:, search: "[('name','=','test2.txt')]" }
|
||||
-
|
||||
I also commit, because ftp would run in a different transaction.
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
cr.commit()
|
||||
-
|
||||
I check through FTP that test2.txt does not appear.
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
import ftplib
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
|
||||
assert ftp.nlst("test2.txt") == []
|
||||
try:
|
||||
nlst_result = ftp.nlst("test2.txt")
|
||||
except ftplib.error_perm: # 550 error: 'path not exists'
|
||||
nlst_result = []
|
||||
assert "test2.txt" not in nlst_result, "Files: %r" % nlst_result
|
||||
-
|
||||
I create a "test-name.txt" file
|
||||
-
|
||||
|
@ -152,7 +162,7 @@
|
|||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
|
||||
try:
|
||||
res = ftp.nlst("test-name.txt")
|
||||
assert res == []
|
||||
assert res == [], "File has not been renamed!"
|
||||
except error_perm, e:
|
||||
pass
|
||||
assert ftp.nlst("test-renamed.txt") == ['test-renamed.txt']
|
||||
|
@ -178,7 +188,7 @@
|
|||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Test-Folder2')
|
||||
assert ftp.nlst("test3.txt") == ['test3.txt']
|
||||
assert ftp.nlst("test3.txt") == ['test3.txt'], "File test3.txt is not there!"
|
||||
-
|
||||
I create a new folder, 'Test-Folder3', through FTP
|
||||
I try to move test3.txt to 'Test-Folder3'
|
||||
|
@ -211,10 +221,10 @@
|
|||
from document_ftp import test_easyftp as te
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Test-Folder2')
|
||||
# TODO speed
|
||||
assert len(ftp.nlst()) > 200
|
||||
assert len(ftp.nlst()) >= 200, "We haven't managed to store 200 files!"
|
||||
-
|
||||
I read the 200 files, check speed
|
||||
# TODO
|
||||
-
|
||||
I move the 200 files to 'Test-Folder2'
|
||||
# TODO
|
||||
# TODO
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
I check at the server that the file is attached to Partner1
|
||||
-
|
||||
!assert {model: ir.attachment, id: , search: "[('name','=','pat1-dynamic.txt')]" }:
|
||||
- parent_id.name == 'Partners of Test'
|
||||
- parent_id.name == 'Documents'
|
||||
- res_model == 'res.partner'
|
||||
- res_id != False
|
||||
-
|
||||
|
|
|
@ -35,28 +35,29 @@
|
|||
!record {model: res.users, id: res_users_user0}:
|
||||
company_id: base.main_company
|
||||
context_lang: en_US
|
||||
login: user1
|
||||
name: user1
|
||||
login: idea_user1
|
||||
name: Idea test user1
|
||||
password: user1
|
||||
groups_id: [ base.group_tool_user, ]
|
||||
- |
|
||||
And I will also create user2.
|
||||
-
|
||||
!record {model: res.users, id: res_users_user1}:
|
||||
company_id: base.main_company
|
||||
context_lang: en_US
|
||||
login: user2
|
||||
name: user2
|
||||
login: idea_user2
|
||||
name: Idea test user2
|
||||
password: user2
|
||||
|
||||
groups_id: [ base.group_tool_user, ]
|
||||
- |
|
||||
In order to post vote I connect as user1 and open the idea page
|
||||
I click on "Submit Vote" wizard button and vote the idea as "Normal"
|
||||
|
||||
-
|
||||
!python {model: idea.post.vote}: |
|
||||
uid = ref('res_users_user0')
|
||||
new_id = self.create(cr, uid, {'vote': 50}, {"active_ids": [ref("idea_idea_0")]})
|
||||
self.do_vote(cr, uid, [new_id], {"active_ids": [ref("idea_idea_0")]})
|
||||
uid2 = ref('res_users_user0')
|
||||
new_id = self.create(cr, uid2, {'vote': 50}, {"active_ids": [ref("idea_idea_0")]})
|
||||
self.do_vote(cr, uid2, [new_id], {"active_ids": [ref("idea_idea_0")]})
|
||||
|
||||
- |
|
||||
To add other vote I connect as user2 and open the idea page.
|
||||
|
@ -67,9 +68,9 @@
|
|||
|
||||
-
|
||||
!python {model: idea.post.vote}: |
|
||||
uid = ref('res_users_user1')
|
||||
new_id = self.create(cr, uid, {'vote': 100, 'note': 'We can learn many things from technical presentation'}, {"active_ids": [ref("idea_idea_0")]})
|
||||
self.do_vote(cr, uid, [new_id], {'active_ids': [ref('idea_idea_0')]})
|
||||
uid2 = ref('res_users_user1')
|
||||
new_id = self.create(cr, uid2, {'vote': 100, 'note': 'We can learn many things from technical presentation'}, {"active_ids": [ref("idea_idea_0")]})
|
||||
self.do_vote(cr, uid2, [new_id], {'active_ids': [ref('idea_idea_0')]})
|
||||
|
||||
- |
|
||||
I can see that the Average score changed in "Average score" field with value 75
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem icon="terp-mrp" id="base.menu_mrp_root" name="Manufacturing"
|
||||
<menuitem icon="terp-mrp" id="base.menu_mrp_root" parent="" name="Manufacturing"
|
||||
groups="group_mrp_user,group_mrp_manager,base.group_system" sequence="8"/>
|
||||
<menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
|
||||
|
||||
<menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
|
||||
<menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
|
||||
<menuitem id="menu_mrp_manufacturing" name="Manufacturing" parent="base.menu_mrp_root" sequence="1"/>
|
||||
|
||||
|
@ -910,7 +911,6 @@
|
|||
src_model="product.product"/>
|
||||
|
||||
<!-- Menu for Resource for MRP-->
|
||||
<menuitem icon="terp-mrp" id="base.menu_mrp_root" name="Manufacturing" groups="mrp.group_mrp_user" sequence="3" />
|
||||
|
||||
<menuitem id="menu_pm_resources_mrp" name="Resources" parent="base.menu_mrp_root"
|
||||
groups="base.group_extended"
|
||||
|
|
|
@ -24,6 +24,7 @@ import decimal_precision as dp
|
|||
import pooler
|
||||
|
||||
import math
|
||||
import logging
|
||||
from _common import rounding
|
||||
|
||||
from tools import config
|
||||
|
@ -724,13 +725,24 @@ class res_users(osv.osv):
|
|||
_name = 'res.users'
|
||||
_inherit = 'res.users'
|
||||
|
||||
def create(self, cr, uid, data, context={}):
|
||||
def create(self, cr, uid, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
user_id = super(res_users, self).create(cr, uid, data, context)
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
data_id = data_obj._get_id(cr, uid, 'product', 'ir_ui_view_sc_product0')
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
copy_id = self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
|
||||
'user_id': user_id}, context=context)
|
||||
try:
|
||||
data_id = data_obj._get_id(cr, uid, 'product', 'ir_ui_view_sc_product0')
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
copy_id = self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
|
||||
'user_id': user_id}, context=context)
|
||||
except ValueError:
|
||||
# During a single install of multiple modules, the product_view.xml may
|
||||
# be loaded after this python code is present in the server and called
|
||||
# by other module's res_users.create() calls. So, we have to survive
|
||||
# this and create the user.
|
||||
# One more case is if some admin has deliberately removed this shortcut,
|
||||
# users must still be able to create.
|
||||
logging.getLogger('orm').warning('Skipped Products shortcut for user "%s"', data.get('name','<new'))
|
||||
return user_id
|
||||
|
||||
res_users()
|
||||
|
|
|
@ -153,55 +153,4 @@ class project_tasks(osv.osv):
|
|||
return res
|
||||
|
||||
project_tasks()
|
||||
|
||||
class config_compute_remaining(osv.osv_memory):
|
||||
_inherit = "config.compute.remaining"
|
||||
_name='config.compute.remaining'
|
||||
|
||||
def compute_hours(self, cr, uid, ids, context=None):
|
||||
res = super(config_compute_remaining, self).compute_hours(cr, uid, ids, context=context)
|
||||
task_obj = self.pool.get('project.task')
|
||||
if 'active_id' in context:
|
||||
task = task_obj.browse(cr, uid, context['active_id'])
|
||||
if task.state == 'open':
|
||||
task_obj._history(cr, uid, [task], _('Open'))
|
||||
return res
|
||||
config_compute_remaining()
|
||||
|
||||
class project_close_task(osv.osv_memory):
|
||||
_inherit = "close.task"
|
||||
_name = "close.task"
|
||||
|
||||
def close(self, cr, uid, ids, context=None):
|
||||
res = super(project_close_task, self).close(cr, uid, ids, context=context)
|
||||
if not context:
|
||||
context={}
|
||||
task_obj = self.pool.get('project.task')
|
||||
|
||||
if 'task_id' in context:
|
||||
task = task_obj.browse(cr, uid, context['task_id'], context=context)
|
||||
task_obj._history(cr, uid, [task], _('Done'))
|
||||
return res
|
||||
|
||||
def confirm(self, cr, uid, ids, context=None):
|
||||
res=super(project_close_task, self).confirm(cr, uid, ids, context=context)
|
||||
task_obj = self.pool.get('project.task')
|
||||
|
||||
if 'task_id' in context:
|
||||
close_wizard = self.read(cr, uid, ids[0], [])
|
||||
to_adr = []
|
||||
to_adr.append(context.get('send_manager', '') and close_wizard.get('manager_email', '') or '')
|
||||
to_adr.append(context.get('send_partner', '') and close_wizard.get('partner_email', '') or '')
|
||||
description = close_wizard['description']
|
||||
|
||||
task = task_obj.browse(cr, uid, context['task_id'], context=context)
|
||||
subject = "Task '%s' closed" % task.name
|
||||
from_adr = task.user_id.address_id.email
|
||||
task_obj._history(cr, uid, [task], _('Send'), history=True, subject=subject, email=to_adr, details=description, email_from=from_adr)
|
||||
if task.state == 'done':
|
||||
task_obj._history(cr, uid, [task], _('Done'))
|
||||
return res
|
||||
|
||||
project_close_task()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue