[REF] account
bzr revid: vth@tinyerp.com-20101011055153-h8hygvtjqkxc8004
This commit is contained in:
parent
48f0a8554e
commit
685489a172
|
@ -2722,7 +2722,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
|
||||
# Bank Journals
|
||||
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')])
|
||||
data = obj_pool.browse(cr, uid, data_id[0])
|
||||
data = obj_data.browse(cr, uid, data_id[0])
|
||||
view_id_cash = data.res_id
|
||||
|
||||
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view_multi')])
|
||||
|
|
|
@ -349,7 +349,7 @@ class account_move_line(osv.osv):
|
|||
return res
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
result = []
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
|
@ -363,18 +363,18 @@ class account_move_line(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
if not len(args):
|
||||
if not args:
|
||||
return []
|
||||
where = ' and '.join(map(lambda x: '(abs(sum(debit-credit))'+x[1]+str(x[2])+')',args))
|
||||
cursor.execute('select id, sum(debit-credit) from account_move_line \
|
||||
group by id, debit, credit having '+where)
|
||||
res = cursor.fetchall()
|
||||
if not len(res):
|
||||
if not res:
|
||||
return [('id', '=', '0')]
|
||||
return [('id', 'in', [x[0] for x in res])]
|
||||
|
||||
def _invoice_search(self, cursor, user, obj, name, args, context):
|
||||
if not len(args):
|
||||
if not args:
|
||||
return []
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
|
||||
|
@ -407,7 +407,7 @@ class account_move_line(osv.osv):
|
|||
qu2 += x[2]
|
||||
else:
|
||||
qu1.append(' (False)')
|
||||
if len(qu1):
|
||||
if qu1:
|
||||
qu1 = ' AND' + ' AND'.join(qu1)
|
||||
else:
|
||||
qu1 = ''
|
||||
|
@ -415,7 +415,7 @@ class account_move_line(osv.osv):
|
|||
'FROM account_move_line l, account_invoice i ' \
|
||||
'WHERE l.move_id = i.move_id ' + qu1, qu2)
|
||||
res = cursor.fetchall()
|
||||
if not len(res):
|
||||
if not res:
|
||||
return [('id', '=', '0')]
|
||||
return [('id', 'in', [x[0] for x in res])]
|
||||
|
||||
|
@ -989,7 +989,7 @@ class account_move_line(osv.osv):
|
|||
part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs]
|
||||
unlink_ids += rec_ids
|
||||
unlink_ids += part_rec_ids
|
||||
if len(unlink_ids):
|
||||
if unlink_ids:
|
||||
obj_move_rec.unlink(cr, uid, unlink_ids)
|
||||
return True
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ class account_invoice(osv.osv):
|
|||
}, help="The Journal Entry of the invoice have been totally reconciled with one or several Journal Entries of payment."),
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
help='Bank Account Number, Company bank account if Invoice is customer or supplier refund, otherwise Partner bank account number.', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'move_lines':fields.function(_get_lines , method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
|
||||
'move_lines':fields.function(_get_lines, method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
|
||||
'residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 50),
|
||||
|
@ -585,7 +585,7 @@ class account_invoice(osv.osv):
|
|||
else:
|
||||
val['currency_id'] = company.currency_id.id
|
||||
|
||||
return {'value' : val, 'domain': dom }
|
||||
return {'value': val, 'domain': dom }
|
||||
|
||||
# go from canceled state to draft state
|
||||
def action_cancel_draft(self, cr, uid, ids, *args):
|
||||
|
@ -898,7 +898,7 @@ class account_invoice(osv.osv):
|
|||
'name': name,
|
||||
'price': total,
|
||||
'account_id': acc_id,
|
||||
'date_maturity' : inv.date_due or False,
|
||||
'date_maturity': inv.date_due or False,
|
||||
'amount_currency': diff_currency_p \
|
||||
and total_currency or False,
|
||||
'currency_id': diff_currency_p \
|
||||
|
@ -909,7 +909,7 @@ class account_invoice(osv.osv):
|
|||
date = inv.date_invoice or time.strftime('%Y-%m-%d')
|
||||
part = inv.partner_id.id
|
||||
|
||||
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})) ,iml)
|
||||
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})),iml)
|
||||
|
||||
line = self.group_lines(cr, uid, iml, line, inv)
|
||||
|
||||
|
@ -932,7 +932,7 @@ class account_invoice(osv.osv):
|
|||
period_id = inv.period_id and inv.period_id.id or False
|
||||
if not period_id:
|
||||
period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
|
||||
if len(period_ids):
|
||||
if period_ids:
|
||||
period_id = period_ids[0]
|
||||
if period_id:
|
||||
move['period_id'] = period_id
|
||||
|
@ -1018,7 +1018,7 @@ class account_invoice(osv.osv):
|
|||
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
|
||||
if i['payment_ids']:
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
pay_ids = account_move_line_obj.browse(cr, uid , i['payment_ids'])
|
||||
pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids'])
|
||||
for move_line in pay_ids:
|
||||
if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids:
|
||||
raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!'))
|
||||
|
@ -1043,7 +1043,7 @@ class account_invoice(osv.osv):
|
|||
return True
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
types = {
|
||||
'out_invoice': 'CI: ',
|
||||
|
@ -1103,7 +1103,7 @@ class account_invoice(osv.osv):
|
|||
else:
|
||||
refund_journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')])
|
||||
|
||||
if not date :
|
||||
if not date:
|
||||
date = time.strftime('%Y-%m-%d')
|
||||
invoice.update({
|
||||
'type': type_dict[invoice['type']],
|
||||
|
@ -1114,11 +1114,11 @@ class account_invoice(osv.osv):
|
|||
'tax_line': tax_lines,
|
||||
'journal_id': refund_journal_ids
|
||||
})
|
||||
if period_id :
|
||||
if period_id:
|
||||
invoice.update({
|
||||
'period_id': period_id,
|
||||
})
|
||||
if description :
|
||||
if description:
|
||||
invoice.update({
|
||||
'name': description,
|
||||
})
|
||||
|
@ -1406,7 +1406,7 @@ class account_invoice_line(osv.osv):
|
|||
result['uos_id'] = res.uom_id.id or uom or False
|
||||
if result['uos_id']:
|
||||
res2 = res.uom_id.category_id.id
|
||||
if res2 :
|
||||
if res2:
|
||||
domain = {'uos_id':[('category_id','=',res2 )]}
|
||||
|
||||
result['categ_id'] = res.categ_id.id
|
||||
|
@ -1537,8 +1537,8 @@ class account_invoice_tax(osv.osv):
|
|||
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."),
|
||||
'tax_amount': fields.float('Tax Code Amount', digits_compute=dp.get_precision('Account')),
|
||||
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
|
||||
'factor_base' : fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"),
|
||||
'factor_tax' : fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all")
|
||||
'factor_base': fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"),
|
||||
'factor_tax': fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all")
|
||||
}
|
||||
|
||||
def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False):
|
||||
|
|
|
@ -52,7 +52,7 @@ class account_fiscal_position(osv.osv):
|
|||
return result
|
||||
|
||||
def map_account(self, cr, uid, fposition_id, account_id, context={}):
|
||||
if not fposition_id :
|
||||
if not fposition_id:
|
||||
return account_id
|
||||
for pos in fposition_id.account_ids:
|
||||
if pos.account_src_id.id == account_id:
|
||||
|
@ -116,7 +116,7 @@ class res_partner(osv.osv):
|
|||
return res
|
||||
|
||||
def _asset_difference_search(self, cr, uid, obj, name, type, args, context=None):
|
||||
if not len(args):
|
||||
if not args:
|
||||
return []
|
||||
having_values = tuple(map(itemgetter(2), args))
|
||||
where = ' AND '.join(
|
||||
|
@ -133,7 +133,7 @@ class res_partner(osv.osv):
|
|||
'GROUP BY partner_id HAVING '+where),
|
||||
(type,) + having_values)
|
||||
res = cr.fetchall()
|
||||
if not len(res):
|
||||
if not res:
|
||||
return [('id','=','0')]
|
||||
return [('id','in',map(itemgetter(0), res))]
|
||||
|
||||
|
|
|
@ -91,14 +91,14 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
|||
|
||||
def _sum_debit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids), date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
|
|
@ -102,7 +102,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
|
|||
|
||||
def _sum_quantity(self, accounts, date1, date2, journals):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
if not journals:
|
||||
self.cr.execute("SELECT sum(unit_amount) \
|
||||
|
|
|
@ -86,7 +86,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
|||
self.sum_debit += account_rec['debit']
|
||||
self.sum_credit += account_rec['credit']
|
||||
if disp_acc == 'bal_movement':
|
||||
if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 :
|
||||
if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0:
|
||||
self.result_acc.append(res)
|
||||
elif disp_acc == 'bal_solde':
|
||||
if res['balance'] != 0:
|
||||
|
|
|
@ -139,7 +139,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
|
||||
|
||||
if len(tmp):
|
||||
if tmp:
|
||||
accounts.append(tmp)
|
||||
|
||||
merged_accounts=zip(*accounts)
|
||||
|
@ -198,7 +198,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
|
||||
|
||||
if len(tmp1):
|
||||
if tmp1:
|
||||
accounts.append(tmp1)
|
||||
|
||||
if level==1: #if parent is called,done is not empty when called again.
|
||||
|
|
|
@ -71,7 +71,7 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
|||
move_state = ['draft','posted']
|
||||
if self.target_move == 'posted':
|
||||
move_state = ['posted']
|
||||
self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code,l.currency_id ,l.amount_currency ,SUM(debit) AS debit, SUM(credit) AS credit \
|
||||
self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code, l.currency_id, l.amount_currency, SUM(debit) AS debit, SUM(credit) AS credit \
|
||||
from account_move_line l \
|
||||
LEFT JOIN account_move am ON (l.move_id=am.id) \
|
||||
LEFT JOIN account_account a ON (l.account_id=a.id) \
|
||||
|
|
|
@ -55,7 +55,7 @@ class account_entries_report(osv.osv):
|
|||
'move_line_state': fields.selection([('draft','Unbalanced'), ('valid','Valid')], 'State of Move Line', readonly=True),
|
||||
'reconcile_id': fields.many2one('account.move.reconcile', readonly=True),
|
||||
'partner_id': fields.many2one('res.partner','Partner', readonly=True),
|
||||
'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
|
||||
'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True),
|
||||
'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True),
|
||||
'type': fields.selection([
|
||||
|
|
|
@ -117,15 +117,15 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
sold_account = self._sum_balance_account(child_account)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
if self.display_account == 'bal_movement':
|
||||
if child_account.type != 'view' and num_entry <> 0 :
|
||||
if child_account.type != 'view' and num_entry <> 0:
|
||||
res.append(child_account)
|
||||
elif self.display_account == 'bal_solde':
|
||||
if child_account.type != 'view' and num_entry <> 0 :
|
||||
if child_account.type != 'view' and num_entry <> 0:
|
||||
if ( sold_account <> 0.0):
|
||||
res.append(child_account)
|
||||
else:
|
||||
res.append(child_account)
|
||||
if not len(res):
|
||||
if not res:
|
||||
return [account]
|
||||
return res
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
|||
if self.target_move == 'posted':
|
||||
move_state = ['posted']
|
||||
|
||||
self.cr.execute('SELECT SUM(debit) FROM account_move_line l , account_move am '
|
||||
self.cr.execute('SELECT SUM(debit) FROM account_move_line l, account_move am '
|
||||
'WHERE l.move_id=am.id AND am.state IN %s AND l.period_id IN %s AND l.journal_id IN %s ' + self.query_get_clause + ' ',
|
||||
(tuple(move_state), tuple(period_id), tuple(journal_id)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
@ -121,7 +121,7 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
|||
if self.target_move == 'posted':
|
||||
move_state = ['posted']
|
||||
|
||||
self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '' ,(tuple(move_state), period_id, tuple(journal_id) ))
|
||||
self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '',(tuple(move_state), period_id, tuple(journal_id) ))
|
||||
ids = map(lambda x: x[0], self.cr.fetchall())
|
||||
return obj_mline.browse(self.cr, self.uid, ids)
|
||||
|
||||
|
@ -138,12 +138,12 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
|||
def _get_fiscalyear(self, data):
|
||||
if data['model'] == 'account.journal.period':
|
||||
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name
|
||||
return super(journal_print ,self)._get_fiscalyear(data)
|
||||
return super(journal_print, self)._get_fiscalyear(data)
|
||||
|
||||
def _get_account(self, data):
|
||||
if data['model'] == 'account.journal.period':
|
||||
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
|
||||
return super(journal_print ,self)._get_account(data)
|
||||
return super(journal_print, self)._get_account(data)
|
||||
|
||||
def _display_currency(self, data):
|
||||
if data['model'] == 'account.journal.period':
|
||||
|
|
|
@ -83,7 +83,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
full_account = []
|
||||
result_tmp = 0.0
|
||||
self.cr.execute(
|
||||
"SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code ,p.name, sum(debit) AS debit, sum(credit) AS credit, " \
|
||||
"SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code,p.name, sum(debit) AS debit, sum(credit) AS credit, " \
|
||||
"CASE WHEN sum(debit) > sum(credit) " \
|
||||
"THEN sum(debit) - sum(credit) " \
|
||||
"ELSE 0 " \
|
||||
|
@ -254,7 +254,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
"JOIN account_move am ON (am.id = l.move_id)" \
|
||||
"WHERE l.account_id IN %s" \
|
||||
"AND am.state IN %s" \
|
||||
"AND " + self.query + "" ,
|
||||
"AND " + self.query + "",
|
||||
(tuple(self.account_ids), tuple(move_state)))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
@ -273,7 +273,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
"JOIN account_move am ON (am.id = l.move_id)" \
|
||||
"WHERE l.account_id IN %s" \
|
||||
"AND am.state IN %s" \
|
||||
"AND " + self.query + "" ,
|
||||
"AND " + self.query + "",
|
||||
(tuple(self.account_ids), tuple(move_state)))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
|
|
@ -30,11 +30,11 @@ class Overdue(report_sxw.rml_parse):
|
|||
def __init__(self, cr, uid, name, context):
|
||||
super(Overdue, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update( {
|
||||
'time' : time,
|
||||
'adr_get' : self._adr_get,
|
||||
'getLines' : self._lines_get,
|
||||
'tel_get' : self._tel_get,
|
||||
'message' : self._message,
|
||||
'time': time,
|
||||
'adr_get': self._adr_get,
|
||||
'getLines': self._lines_get,
|
||||
'tel_get': self._tel_get,
|
||||
'message': self._message,
|
||||
})
|
||||
self.context = context
|
||||
def _adr_get(self, partner, type):
|
||||
|
@ -47,10 +47,10 @@ class Overdue(report_sxw.rml_parse):
|
|||
'name': False,
|
||||
'street': False,
|
||||
'street2': False,
|
||||
'city' : False,
|
||||
'zip' : False,
|
||||
'city': False,
|
||||
'zip': False,
|
||||
'state_id':False,
|
||||
'country_id' : False,
|
||||
'country_id': False,
|
||||
}
|
||||
if adr_id:
|
||||
result = res_partner_address.read(self.cr, self.uid, [adr_id], context=self.context.copy())
|
||||
|
|
|
@ -34,17 +34,17 @@ class rml_parse(report_sxw.rml_parse):
|
|||
self.localcontext.update({
|
||||
'comma_me': self.comma_me,
|
||||
'format_date': self._get_and_change_date_format_for_swiss,
|
||||
'strip_name' : self._strip_name,
|
||||
'explode_name' : self._explode_name,
|
||||
'strip_name': self._strip_name,
|
||||
'explode_name': self._explode_name,
|
||||
})
|
||||
|
||||
def comma_me(self,amount):
|
||||
#print "#" + str(amount) + "#"
|
||||
if not amount:
|
||||
amount = 0.0
|
||||
if type(amount) is float :
|
||||
if type(amount) is float:
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
else:
|
||||
amount = str(amount)
|
||||
if (amount == '0'):
|
||||
return ' '
|
||||
|
|
|
@ -43,13 +43,13 @@ ir_sequence_fiscalyear()
|
|||
class ir_sequence(osv.osv):
|
||||
_inherit = 'ir.sequence'
|
||||
_columns = {
|
||||
'fiscal_ids' : fields.one2many('account.sequence.fiscalyear',
|
||||
'fiscal_ids': fields.one2many('account.sequence.fiscalyear',
|
||||
'sequence_main_id', 'Sequences')
|
||||
}
|
||||
def get_id(self, cr, uid, sequence_id, test='id', context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
cr.execute('select id from ir_sequence where '
|
||||
cr.execute('select id from ir_sequence where '
|
||||
+ test + '=%s and active=%s', (sequence_id, True,))
|
||||
res = cr.dictfetchone()
|
||||
if res:
|
||||
|
|
|
@ -71,8 +71,8 @@ class account_change_currency(osv.osv_memory):
|
|||
if old_rate <= 0:
|
||||
raise osv.except_osv(_('Error'), _('Current currency is not confirured properly !'))
|
||||
new_price = (line.price_unit / old_rate ) * rate
|
||||
obj_inv_line.write(cr, uid, [line.id], {'price_unit' : new_price})
|
||||
obj_inv.write(cr, uid, [invoice.id], {'currency_id' : new_currency}, context=context)
|
||||
obj_inv_line.write(cr, uid, [line.id], {'price_unit': new_price})
|
||||
obj_inv.write(cr, uid, [invoice.id], {'currency_id': new_currency}, context=context)
|
||||
return {}
|
||||
|
||||
account_change_currency()
|
||||
|
|
|
@ -65,9 +65,9 @@ class account_fiscalyear_close(osv.osv_memory):
|
|||
context = {}
|
||||
fy_id = data[0]['fy_id']
|
||||
|
||||
cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)" , (str(data[0]['fy2_id']),))
|
||||
cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)", (str(data[0]['fy2_id']),))
|
||||
fy_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall()))
|
||||
cr.execute("SELECT id FROM account_period WHERE date_start > (SELECT date_stop FROM account_fiscalyear WHERE id = %s)" , (str(fy_id),))
|
||||
cr.execute("SELECT id FROM account_period WHERE date_start > (SELECT date_stop FROM account_fiscalyear WHERE id = %s)", (str(fy_id),))
|
||||
fy2_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall()))
|
||||
|
||||
period = obj_acc_period.browse(cr, uid, data[0]['period_id'], context=context)
|
||||
|
|
|
@ -33,7 +33,7 @@ class account_move_journal(osv.osv_memory):
|
|||
"""
|
||||
ids = self.pool.get('account.period').find(cr, uid, context=context)
|
||||
period_id = False
|
||||
if len(ids):
|
||||
if ids:
|
||||
period_id = ids[0]
|
||||
return period_id
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ class project(osv.osv):
|
|||
if child_ids:
|
||||
self.setActive(cr, uid, child_ids, value, context=None)
|
||||
return True
|
||||
|
||||
|
||||
project()
|
||||
|
||||
class users(osv.osv):
|
||||
|
@ -418,7 +418,7 @@ class task(osv.osv):
|
|||
'active': fields.function(_is_template, method=True, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."),
|
||||
'name': fields.char('Task Summary', size=128, required=True),
|
||||
'description': fields.text('Description'),
|
||||
'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Priority'),
|
||||
'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Priority'),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of tasks."),
|
||||
'type_id': fields.many2one('project.task.type', 'Stage',),
|
||||
'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
|
||||
|
@ -526,7 +526,7 @@ class task(osv.osv):
|
|||
if not project_id: return False
|
||||
task = self.browse(cr, uid, project_id, context=context)
|
||||
project = task.project_id
|
||||
res = self.do_close(cr, uid, [project_id], context=context)
|
||||
res = self.do_close(cr, uid, [project_id], context=context)
|
||||
if project.warn_manager or project.warn_customer:
|
||||
return {
|
||||
'name': _('Send Email after close task'),
|
||||
|
@ -537,7 +537,7 @@ class task(osv.osv):
|
|||
'target': 'new',
|
||||
'nodestroy': True,
|
||||
'context': {'active_id': task.id}
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
||||
def do_close(self, cr, uid, ids, context=None):
|
||||
|
@ -678,7 +678,7 @@ class task(osv.osv):
|
|||
if types:
|
||||
if not typeid:
|
||||
self.write(cr, uid, task.id, {'type_id': types[0]})
|
||||
elif typeid and typeid in types and types.index(typeid) != len(types)-1 :
|
||||
elif typeid and typeid in types and types.index(typeid) != len(types)-1:
|
||||
index = types.index(typeid)
|
||||
self.write(cr, uid, task.id, {'type_id': types[index+1]})
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue