Followup bugfix
Account move line bugfix in control from journals bzr revid: fp@tinyerp.com-fb30c2bf337fe56762fb5c83b6c76432f6cd49ed
This commit is contained in:
@@ -850,6 +850,19 @@ class account_tax_code(osv.osv):
|
||||
_defaults = {
|
||||
'company_id': _default_company,
|
||||
}
|
||||
#def _check_recursion(self, cr, uid, ids):
|
||||
# level = 100
|
||||
# while len(ids):
|
||||
# cr.execute('select distinct parent_id from account_account_rel where child_id in ('+','.join(map(str,ids))+')')
|
||||
# ids = filter(None, map(lambda x:x[0], cr.fetchall()))
|
||||
# if not level:
|
||||
# return False
|
||||
# level -= 1
|
||||
# return True
|
||||
|
||||
#_constraints = [
|
||||
# (_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id'])
|
||||
#]
|
||||
_order = 'name'
|
||||
account_tax_code()
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ class account_move_line(osv.osv):
|
||||
'credit': fields.float('Credit', digits=(16,2), states={'reconciled':[('readonly',True)]}),
|
||||
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", states={'reconciled':[('readonly',True)]}, domain=[('type','<>','view'), ('type', '<>', 'closed')]),
|
||||
|
||||
'move_id': fields.many2one('account.move', 'Entry', required=True, ondelete="cascade", states={'reconciled':[('readonly',True)]}, help="The entry of this entry line.", select=2),
|
||||
'move_id': fields.many2one('account.move', 'Entry', ondelete="cascade", states={'reconciled':[('readonly',True)]}, help="The entry of this entry line.", select=2),
|
||||
|
||||
'ref': fields.char('Ref.', size=32),
|
||||
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=True),
|
||||
@@ -480,15 +480,20 @@ class account_move_line(osv.osv):
|
||||
else:
|
||||
raise osv.except_osv('No piece number !', 'Can not create an automatic sequence for this piece !\n\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.')
|
||||
|
||||
ok = not (journal.type_control_ids or journal.account_control_ids)
|
||||
if ('account_id' in vals) and journal.type_control_ids:
|
||||
type = self.pool.get('account.account').browse(cr, uid, vals['account_id']).type
|
||||
ok = False
|
||||
for t in journal.type_control_ids:
|
||||
if type==t.code:
|
||||
ok = True
|
||||
break
|
||||
if not ok:
|
||||
raise osv.except_osv('Bad account !', 'You can not use this general account in this journal !')
|
||||
if ('account_id' in vals) and journal.account_control_ids and not ok:
|
||||
for a in journal.account_control_ids:
|
||||
if a.id==vals['account_id']:
|
||||
ok = True
|
||||
break
|
||||
if not ok:
|
||||
raise osv.except_osv('Bad account !', 'You can not use this general account in this journal !')
|
||||
|
||||
result = super(osv.osv, self).create(cr, uid, vals, context)
|
||||
if check:
|
||||
|
||||
@@ -32,15 +32,13 @@ import pooler
|
||||
pay_form = '''<?xml version="1.0"?>
|
||||
<form string="Pay invoice">
|
||||
<field name="amount"/>
|
||||
<field name="dest_account_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="period_id"/>
|
||||
</form>'''
|
||||
|
||||
pay_fields = {
|
||||
'amount': {'string': 'Amount paid', 'type':'float', 'required':True},
|
||||
'dest_account_id': {'string':'Payment to Account', 'type':'many2one', 'required':True, 'relation':'account.account', 'domain':[('type','=','cash')]},
|
||||
'journal_id': {'string': 'Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
|
||||
'journal_id': {'string': 'Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True, 'domain':[('type','=','cash')]},
|
||||
'period_id': {'string': 'Period', 'type': 'many2one', 'relation':'account.period', 'required':True},
|
||||
}
|
||||
|
||||
@@ -51,7 +49,11 @@ def _pay_and_reconcile(self, cr, uid, data, context):
|
||||
journal_id = form.get('journal_id', False)
|
||||
writeoff_account_id = form.get('writeoff_acc_id', False)
|
||||
writeoff_journal_id = form.get('writeoff_journal_id', False)
|
||||
service.execute(cr.dbname, uid, 'account.invoice', 'pay_and_reconcile', [data['id']], form['amount'], form['dest_account_id'], period_id, journal_id, writeoff_account_id, period_id, writeoff_journal_id, context)
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
acc_id = pool.get('account.journal').browse(cr, uid, journal_id, context).default_credit_account_id.id
|
||||
if not acc_id:
|
||||
raise wizard.except_wizard('Error !', 'Your journal must have a default credit and debit account.')
|
||||
service.execute(cr.dbname, uid, 'account.invoice', 'pay_and_reconcile', [data['id']], form['amount'], acc_id, period_id, journal_id, writeoff_account_id, period_id, writeoff_journal_id, context)
|
||||
return {}
|
||||
|
||||
def _trans_reconcile(self, cr, uid, data, context):
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
action="action_account_asset_asset_form"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_account_asset_asset_tree">
|
||||
<field name="name">Asset hyerarchy</field>
|
||||
<field name="name">Asset hierarchy</field>
|
||||
<field name="res_model">account.asset.asset</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
|
||||
@@ -85,7 +85,14 @@ Thanks,
|
||||
|
||||
class followup_all_print(wizard.interface):
|
||||
def _get_partners(self, cr, uid, data, context):
|
||||
cr.execute('select id from account_followup_stat')
|
||||
cr.execute(
|
||||
"SELECT distinct l.partner_id "\
|
||||
"FROM account_move_line AS l LEFT JOIN account_account AS a "\
|
||||
"ON (l.account_id=a.id) "\
|
||||
"WHERE (l.reconcile_id IS NULL) "\
|
||||
"AND (a.type='receivable') "\
|
||||
"AND (l.state<>'draft') "\
|
||||
"AND (l.reconcile_id is NULL) ")
|
||||
ids = map(lambda x: x[0], cr.fetchall())
|
||||
return {'partner_ids': ids}
|
||||
|
||||
@@ -97,8 +104,9 @@ class followup_all_print(wizard.interface):
|
||||
"FROM account_move_line AS l LEFT JOIN account_account AS a "\
|
||||
"ON (l.account_id=a.id) "\
|
||||
"WHERE (l.reconcile_id IS NULL) "\
|
||||
"AND (a.type='receivable') AND (l.debit > 0) "\
|
||||
"AND (a.type='receivable') "\
|
||||
"AND (l.state<>'draft') "\
|
||||
"AND (l.reconcile_id is NULL) "\
|
||||
"AND partner_id in ("+','.join(map(str,partner_ids))+") "\
|
||||
"ORDER BY l.date")
|
||||
move_lines = cr.fetchall()
|
||||
|
||||
Reference in New Issue
Block a user