[MERGE] Latest fixes from 6.1

bzr revid: odo@openerp.com-20120322143654-w7etvdnq4z5tg6bt
This commit is contained in:
Olivier Dony 2012-03-22 15:36:54 +01:00
commit ee77b351b4
10 changed files with 17 additions and 11 deletions

View File

@ -1652,7 +1652,7 @@ class account_move_reconcile(osv.osv):
'create_date': fields.date('Creation date', readonly=True),
}
_defaults = {
'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/',
'name': lambda self,cr,uid,ctx=None: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile', context=ctx) or '/',
}
def reconcile_partial_check(self, cr, uid, ids, type='auto', context=None):

View File

@ -341,11 +341,11 @@ class account_bank_statement(osv.osv):
if not st.name == '/':
st_number = st.name
else:
c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
if st.journal_id.sequence_id:
c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
st_number = obj_seq.next_by_id(cr, uid, st.journal_id.sequence_id.id, context=c)
else:
st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement')
st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=c)
for line in st.move_line_ids:
if line.state <> 'valid':

View File

@ -279,11 +279,11 @@ class account_cash_statement(osv.osv):
raise osv.except_osv(_('Error !'), (_('User %s does not have rights to access %s journal !') % (statement.user_id.name, statement.journal_id.name)))
if statement.name and statement.name == '/':
c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id}
if statement.journal_id.sequence_id:
c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id}
st_number = obj_seq.next_by_id(cr, uid, statement.journal_id.sequence_id.id, context=c)
else:
st_number = obj_seq.next_by_code(cr, uid, 'account.cash.statement')
st_number = obj_seq.next_by_code(cr, uid, 'account.cash.statement', context=c)
vals.update({
'name': st_number
})

View File

@ -48,6 +48,8 @@ class ir_sequence(osv.osv):
}
def _next(self, cr, uid, seq_ids, context=None):
if context is None:
context = {}
for seq in self.browse(cr, uid, seq_ids, context):
for line in seq.fiscal_ids:
if line.fiscalyear_id.id == context.get('fiscalyear_id'):

View File

@ -903,7 +903,7 @@ class account_voucher(osv.osv):
if voucher_brw.number:
name = voucher_brw.number
elif voucher_brw.journal_id.sequence_id:
name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id)
name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id, context=context)
else:
raise osv.except_osv(_('Error !'),
_('Please define a sequence on the journal !'))

View File

@ -57,6 +57,8 @@ class email_template(osv.osv):
:param int res_id: id of the document record this mail is related to.
"""
if not template: return u""
if context is None:
context = {}
try:
template = tools.ustr(template)
record = None

View File

@ -95,7 +95,7 @@ class mail_compose_message(osv.osv_memory):
for fname, fcontent in attachment.iteritems():
data_attach = {
'name': fname,
'datas': base64.b64encode(fcontent),
'datas': fcontent,
'datas_fname': fname,
'description': fname,
'res_model' : self._name,

View File

@ -180,6 +180,8 @@ openerp_mailgate.py -u %(uid)d -p PASSWORD -o %(model)s -d %(dbname)s --host=HOS
logger.info('start checking for new emails on %s server %s', server.type, server.name)
context.update({'fetchmail_server_id': server.id, 'server_type': server.type})
count = 0
imap_server = False
pop_server = False
if server.type == 'imap':
try:
imap_server = server.connect()

View File

@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_mail_message,mail.message,model_mail_message,,1,0,1,0
access_mail_thread,mail.thread,model_mail_thread,,1,0,1,0
access_mail_message,mail.message,model_mail_message,,1,1,1,0
access_mail_thread,mail.thread,model_mail_thread,,1,1,1,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mail_message mail.message model_mail_message 1 0 1 1 0
3 access_mail_thread mail.thread model_mail_thread 1 0 1 1 0

View File

@ -52,9 +52,9 @@ class pos_open_statement(osv.osv_memory):
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)], context=context)
if journal.sequence_id:
number = sequence_obj.next_by_id(cr, uid, journal.sequence_id.id)
number = sequence_obj.next_by_id(cr, uid, journal.sequence_id.id, context=context)
else:
number = sequence_obj.next_by_code(cr, uid, 'account.cash.statement')
number = sequence_obj.next_by_code(cr, uid, 'account.cash.statement', context=context)
data.update({
'journal_id': journal.id,