bzr revid: fp@tinyerp.com-20100919123614-oixyvfx7e199z2gc
This commit is contained in:
Fabien Pinckaers
2010-09-19 14:36:14 +02:00
27 changed files with 514 additions and 591 deletions
+25
View File
@@ -686,6 +686,27 @@ class account_journal(osv.osv):
vals.update({'sequence_id' : self.create_sequence(cr, uid, vals, context)})
return super(account_journal, self).create(cr, uid, vals, context)
def name_get(self, cr, user, ids, context={}):
"""
Returns a list of tupples containing id, name.
result format : {[(id, name), (id, name), ...]}
@param cr: A database cursor
@param user: ID of the user currently logged in
@param ids: list of ids for which name should be read
@param context: context arguments, like lang, time zone
@return: Returns a list of tupples containing id, name
"""
result = self.browse(cr, user, ids, context)
res = []
for rs in result:
name = rs.name
if rs.currency:
name = "%s (%s)" % (rs.name, rs.currency.name)
res += [(rs.id, name)]
return res
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
@@ -2659,6 +2680,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['type'] = 'sale'
vals_journal['code'] = _('SAJ')
vals_journal['sequence_id'] = seq_id_sale
vals_journal['company_id'] = company_id
if obj_multi.chart_template_id.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id]
@@ -2672,6 +2694,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['code'] = _('EXJ')
vals_journal['sequence_id'] = seq_id_purchase
vals_journal['view_id'] = view_id
vals_journal['company_id'] = company_id
if obj_multi.chart_template_id.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
@@ -2723,6 +2746,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['code']= _('BNK') + str(current_num)
vals_journal['sequence_id'] = seq_id
vals_journal['type'] = 'cash'
vals_journal['company_id'] = company_id
if line.currency_id:
vals_journal['view_id'] = view_id_cur
vals_journal['currency'] = line.currency_id.id
-1
View File
@@ -51,7 +51,6 @@ class account_analytic_line(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
if context.get('from_date',False):
args.append(['date', '>=',context['from_date']])
+112 -362
View File
@@ -214,22 +214,121 @@ class account_bank_statement(osv.osv):
self.write(cr, uid, ids, {}, context)
return True
def button_confirm_bank(self, cr, uid, ids, context=None):
done = []
def create_move_from_st_line(self, cr, uid, st_line, company_currency_id, next_number, context=None):
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
account_analytic_line_obj = self.pool.get('account.analytic.line')
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
st = st_line.statement_id
context.update({'date': st_line.date})
move_id = account_move_obj.create(cr, uid, {
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'date': st_line.date,
}, context=context)
account_bank_statement_line_obj.write(cr, uid, [st_line.id], {
'move_ids': [(4, move_id, False)]
})
torec = []
if st_line.amount >= 0:
account_id = st.journal_id.default_credit_account_id.id
else:
account_id = st.journal_id.default_debit_account_id.id
acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id
amount = res_currency_obj.compute(cr, uid, st.currency.id,
company_currency_id, st_line.amount, context=context,
account=acc_cur)
val = {
'name': st_line.name,
'date': st_line.date,
'ref': st_line.ref,
'move_id': move_id,
'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False,
'account_id': (st_line.account_id) and st_line.account_id.id,
'credit': ((amount>0) and amount) or 0.0,
'debit': ((amount<0) and -amount) or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'currency_id': st.currency.id,
'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False
}
amount = res_currency_obj.compute(cr, uid, st.currency.id,
company_currency_id, st_line.amount, context=context,
account=acc_cur)
if st.currency.id <> company_currency_id:
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
st.currency.id, amount, context=context,
account=acc_cur)
val['amount_currency'] = -amount_cur
if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id:
val['currency_id'] = st_line.account_id.currency_id.id
if company_currency_id==st_line.account_id.currency_id.id:
amount_cur = st_line.amount
else:
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
st_line.account_id.currency_id.id, amount, context=context,
account=acc_cur)
val['amount_currency'] = amount_cur
move_line_id = account_move_line_obj.create(cr, uid, val , context=context)
torec.append(move_line_id)
# Fill the secondary amount/currency
# if currency is not the same than the company
amount_currency = False
currency_id = False
if st.currency.id <> company_currency_id:
amount_currency = st_line.amount
currency_id = st.currency.id
account_move_line_obj.create(cr, uid, {
'name': st_line.name,
'date': st_line.date,
'ref': st_line.ref,
'move_id': move_id,
'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False,
'account_id': account_id,
'credit': ((amount < 0) and -amount) or 0.0,
'debit': ((amount > 0) and amount) or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'amount_currency': amount_currency,
'currency_id': currency_id,
}, context=context)
for line in account_move_line_obj.browse(cr, uid, [x.id for x in
account_move_obj.browse(cr, uid, move_id,
context=context).line_id],
context=context):
if line.state <> 'valid':
raise osv.except_osv(_('Error !'),
_('Journal Item "%s" is not valid') % line.name)
move_name = next_number + ' - ' + str(st_line.sequence)
account_move_obj.write(cr, uid, [move_id], {'name': move_name})
# Bank statements will not consider boolean on journal entry_posted
account_move_obj.post(cr, uid, [move_id], context=context)
return move_id
def button_confirm_bank(self, cr, uid, ids, context=None):
done = []
obj_seq = self.pool.get('ir.sequence')
if context is None:
context = {}
company_currency_id = res_users_obj.browse(cr, uid, uid,
context=context).company_id.currency_id.id
for st in self.browse(cr, uid, ids, context):
company_currency_id = st.journal_id.company_id.currency_id.id
if not st.state=='draft':
continue
@@ -245,181 +344,24 @@ class account_bank_statement(osv.osv):
if not st.name == '/':
next_number = st.name
else:
next_number = obj_seq.get(cr, uid, 'account.bank.statement')
if st.journal_id.sequence_id:
c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
next_number = obj_seq.get_id(cr, uid, st.journal_id.sequence_id.id, context=c)
else:
next_number = obj_seq.get(cr, uid, 'account.bank.statement')
for line in st.move_line_ids:
if line.state <> 'valid':
raise osv.except_osv(_('Error !'),
_('The account entries lines are not in valid state.'))
# for bank.statement.lines
# In line we get reconcile_id on bank.ste.rec.
# in bank stat.rec we get line_new_ids on bank.stat.rec.line
for move in st.line_ids:
if move.analytic_account_id:
for st_line in st.line_ids:
if st_line.analytic_account_id:
if not st.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (st.journal_id.name,))
context.update({'date': move.date})
move_id = account_move_obj.create(cr, uid, {
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'date': move.date,
}, context=context)
account_bank_statement_line_obj.write(cr, uid, [move.id], {
'move_ids': [(4, move_id, False)]
})
if not move.amount:
if not st_line.amount:
continue
torec = []
if move.amount >= 0:
account_id = st.journal_id.default_credit_account_id.id
else:
account_id = st.journal_id.default_debit_account_id.id
acc_cur = ((move.amount<=0) and st.journal_id.default_debit_account_id) or move.account_id
amount = res_currency_obj.compute(cr, uid, st.currency.id,
company_currency_id, move.amount, context=context,
account=acc_cur)
if move.reconcile_id and move.reconcile_id.line_new_ids:
for newline in move.reconcile_id.line_new_ids:
amount += newline.amount
val = {
'name': move.name,
'date': move.date,
'ref': move.ref,
'move_id': move_id,
'partner_id': ((move.partner_id) and move.partner_id.id) or False,
'account_id': (move.account_id) and move.account_id.id,
'credit': ((amount>0) and amount) or 0.0,
'debit': ((amount<0) and -amount) or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'currency_id': st.currency.id,
'analytic_account_id': move.analytic_account_id and move.analytic_account_id.id or False
}
amount = res_currency_obj.compute(cr, uid, st.currency.id,
company_currency_id, move.amount, context=context,
account=acc_cur)
if st.currency.id <> company_currency_id:
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
st.currency.id, amount, context=context,
account=acc_cur)
val['amount_currency'] = -amount_cur
if move.account_id and move.account_id.currency_id and move.account_id.currency_id.id <> company_currency_id:
val['currency_id'] = move.account_id.currency_id.id
if company_currency_id==move.account_id.currency_id.id:
amount_cur = move.amount
else:
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
move.account_id.currency_id.id, amount, context=context,
account=acc_cur)
val['amount_currency'] = amount_cur
move_line_id = account_move_line_obj.create(cr, uid, val , context=context)
torec.append(move_line_id)
if move.analytic_account_id:
anal_val = {}
amt = (val['credit'] or 0.0) - (val['debit'] or 0.0)
anal_val = {
'name': val['name'],
'ref': val['ref'],
'date': val['date'],
'amount': amt,
'account_id': val['analytic_account_id'],
'currency_id': val['currency_id'],
'general_account_id': val['account_id'],
'journal_id': st.journal_id.analytic_journal_id.id,
'period_id': val['period_id'],
'user_id': uid,
'move_id': move_line_id
}
if val.get('amount_currency', False):
anal_val['amount_currency'] = val['amount_currency']
account_analytic_line_obj.create(cr, uid, anal_val, context=context)
if move.reconcile_id and move.reconcile_id.line_new_ids:
for newline in move.reconcile_id.line_new_ids:
account_move_line_obj.create(cr, uid, {
'name': newline.name or move.name,
'date': move.date,
'ref': move.ref,
'move_id': move_id,
'partner_id': ((move.partner_id) and move.partner_id.id) or False,
'account_id': (newline.account_id) and newline.account_id.id,
'debit': newline.amount>0 and newline.amount or 0.0,
'credit': newline.amount<0 and -newline.amount or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'analytic_account_id':newline.analytic_id and newline.analytic_id.id or False,
}, context=context)
# Fill the secondary amount/currency
# if currency is not the same than the company
amount_currency = False
currency_id = False
if st.currency.id <> company_currency_id:
amount_currency = move.amount
currency_id = st.currency.id
account_move_line_obj.create(cr, uid, {
'name': move.name,
'date': move.date,
'ref': move.ref,
'move_id': move_id,
'partner_id': ((move.partner_id) and move.partner_id.id) or False,
'account_id': account_id,
'credit': ((amount < 0) and -amount) or 0.0,
'debit': ((amount > 0) and amount) or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'amount_currency': amount_currency,
'currency_id': currency_id,
}, context=context)
for line in account_move_line_obj.browse(cr, uid, [x.id for x in
account_move_obj.browse(cr, uid, move_id,
context=context).line_id],
context=context):
if line.state <> 'valid':
raise osv.except_osv(_('Error !'),
_('Journal Item "%s" is not valid') % line.name)
if move.reconcile_id and move.reconcile_id.line_ids:
## Search if move has already a partial reconciliation
previous_partial = False
for line_reconcile_move in move.reconcile_id.line_ids:
if line_reconcile_move.reconcile_partial_id:
previous_partial = True
break
##
torec += map(lambda x: x.id, move.reconcile_id.line_ids)
#try:
if abs(move.reconcile_amount-move.amount)<0.0001:
writeoff_acc_id = False
#There should only be one write-off account!
for entry in move.reconcile_id.line_new_ids:
writeoff_acc_id = entry.account_id.id
break
## If we have already a partial reconciliation
## We need to make a partial reconciliation
## To add this amount to previous paid amount
if previous_partial:
account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context)
## If it's the first reconciliation, we do a full reconciliation as regular
else:
account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context)
else:
account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context)
move_name = next_number + ' - ' + str(move.sequence)
account_move_obj.write(cr, uid, [move_id], {'name': move_name, 'state': 'posted'}) # Bank statements will not consider boolean on journal entry_posted
self.create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context)
self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name)
done.append(st.id)
@@ -474,175 +416,6 @@ class account_bank_statement(osv.osv):
account_bank_statement()
class account_bank_statement_reconcile(osv.osv):
_name = "account.bank.statement.reconcile"
_description = "Statement Reconcile"
def _total_entry(self, cursor, user, ids, name, attr, context=None):
result = {}
for o in self.browse(cursor, user, ids, context=context):
result[o.id] = 0.0
for line in o.line_ids:
result[o.id] += line.debit - line.credit
return result
def _total_new(self, cursor, user, ids, name, attr, context=None):
result = {}
for o in self.browse(cursor, user, ids, context=context):
result[o.id] = 0.0
for line in o.line_new_ids:
result[o.id] += line.amount
return result
def _total_balance(self, cursor, user, ids, name, attr, context=None):
result = {}
for o in self.browse(cursor, user, ids, context=context):
result[o.id] = o.total_new - o.total_entry + o.total_amount
return result
def _total_amount(self, cursor, user, ids, name, attr, context=None):
res = {}
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
company_currency_id = res_users_obj.browse(cursor, user, user,
context=context).company_id.currency_id.id
currency_id = context.get('currency_id', company_currency_id)
acc_cur = None
if context.get('journal_id', False) and context.get('account_id',False):
st =self.pool.get('account.journal').browse(cursor, user, context['journal_id'])
acc = self.pool.get('account.account').browse(cursor, user, context['account_id'])
acc_cur = (( context.get('amount',0.0)<=0) and st.default_debit_account_id) or acc
for reconcile_id in ids:
res[reconcile_id] = res_currency_obj.compute(cursor, user,
currency_id, company_currency_id,
context.get('amount', 0.0), context=context, account=acc_cur)
return res
def _default_amount(self, cursor, user, context=None):
if context is None:
context = {}
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
company_currency_id = res_users_obj.browse(cursor, user, user,
context=context).company_id.currency_id.id
currency_id = context.get('currency_id', company_currency_id)
acc_cur = None
if context.get('journal_id', False) and context.get('account_id',False):
st =self.pool.get('account.journal').browse(cursor, user, context['journal_id'])
acc = self.pool.get('account.account').browse(cursor, user, context['account_id'])
acc_cur = (( context.get('amount',0.0)<=0) and st.default_debit_account_id) or acc
return res_currency_obj.compute(cursor, user,
currency_id, company_currency_id,
context.get('amount', 0.0), context=context, account=acc_cur)
def _total_currency(self, cursor, user, ids, name, attrs, context=None):
res = {}
res_users_obj = self.pool.get('res.users')
company_currency_id = res_users_obj.browse(cursor, user, user,
context=context).company_id.currency_id.id
for reconcile_id in ids:
res[reconcile_id] = company_currency_id
return res
def _default_currency(self, cursor, user, context=None):
res_users_obj = self.pool.get('res.users')
return res_users_obj.browse(cursor, user, user,
context=context).company_id.currency_id.id
def _total_second_amount(self, cursor, user, ids, name, attr,
context=None):
res = {}
for reconcile_id in ids:
res[reconcile_id] = context.get('amount', 0.0)
return res
def _total_second_currency(self, cursor, user, ids, name, attr, context=None):
res = {}
for reconcile_id in ids:
res[reconcile_id] = context.get('currency_id', False)
return res
def name_get(self, cursor, user, ids, context=None):
res= []
for o in self.browse(cursor, user, ids, context=context):
result = 0.0
res_currency = ''
for line in o.line_ids:
if line.amount_currency and line.currency_id:
result += line.amount_currency
res_currency = line.currency_id.code
else:
result += line.debit - line.credit
if res_currency:
res_currency = ' ' + res_currency
res.append((o.id, '[%.2f'% (result - o.total_new,) + res_currency + ']' ))
return res
_columns = {
'name': fields.char('Date', size=64, required=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'line_new_ids': fields.one2many('account.bank.statement.reconcile.line',
'line_id', 'Write-Off'),
'total_entry': fields.function(_total_entry, method=True,
string='Total entries'),
'total_new': fields.function(_total_new, method=True,
string='Total write-off'),
'total_second_amount': fields.function(_total_second_amount,
method=True, string='Payment amount',
help='The amount in the currency of the journal'),
'total_second_currency': fields.function(_total_second_currency, method=True,
string='Currency', type='many2one', relation='res.currency',
help='The currency of the journal'),
'total_amount': fields.function(_total_amount, method=True,
string='Payment amount'),
'total_currency': fields.function(_total_currency, method=True,
string='Currency', type='many2one', relation='res.currency'),
'total_balance': fields.function(_total_balance, method=True,
string='Balance'),
#line_ids define in account.py
'statement_line': fields.one2many('account.bank.statement.line',
'reconcile_id', 'Bank Statement Line'),
}
_defaults = {
'name': lambda *a: time.strftime('%Y-%m-%d'),
'partner_id': lambda obj, cursor, user, context=None: \
context.get('partner', False),
'total_amount': _default_amount,
'total_currency': _default_currency,
'total_second_amount': lambda obj, cursor, user, context=None: \
context.get('amount', 0.0),
'total_second_currency': lambda obj, cursor, user, context=None: \
context.get('currency_id', False),
'total_balance': _default_amount,
}
account_bank_statement_reconcile()
class account_bank_statement_reconcile_line(osv.osv):
_name = "account.bank.statement.reconcile.line"
_description = "Statement reconcile line"
_columns = {
'name': fields.char('Description', size=64, required=True),
'account_id': fields.many2one('account.account', 'Account', required=True),
'line_id': fields.many2one('account.bank.statement.reconcile', 'Reconcile'),
'amount': fields.float('Amount', required=True),
'analytic_id': fields.many2one('account.analytic.account',"Analytic Account", domain=[('parent_id', '!=', False)])
}
_defaults = {
'name': 'Write-Off',
}
account_bank_statement_reconcile_line()
class account_bank_statement_line(osv.osv):
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None):
@@ -683,25 +456,6 @@ class account_bank_statement_line(osv.osv):
res['value']['amount'] = balance
return res
def _reconcile_amount(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
res = {}
company_currency_id = res_users_obj.browse(cursor, user, user,
context=context).company_id.currency_id.id
for line in self.browse(cursor, user, ids, context=context):
if line.reconcile_id:
res[line.id] = res_currency_obj.compute(cursor, user,
company_currency_id, line.statement_id.currency.id,
line.reconcile_id.total_entry, context=context)
else:
res[line.id] = 0.0
return res
_order = "statement_id desc, sequence"
_name = "account.bank.statement.line"
_description = "Bank Statement Line"
@@ -719,16 +473,12 @@ class account_bank_statement_line(osv.osv):
required=True),
'statement_id': fields.many2one('account.bank.statement', 'Statement',
select=True, required=True, ondelete='cascade'),
'reconcile_id': fields.many2one('account.bank.statement.reconcile',
'Reconcile'),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'),
'move_ids': fields.many2many('account.move',
'account_bank_statement_line_move_rel', 'move_id','statement_id',
'Moves'),
'ref': fields.char('Reference', size=32),
'note': fields.text('Notes'),
'reconcile_amount': fields.function(_reconcile_amount,
string='Amount reconciled', method=True, type='float'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of bank statement lines."),
'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
}
+21 -21
View File
@@ -270,7 +270,7 @@ class account_cash_statement(osv.osv):
super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs))
return True
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context={}):
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
""" Changes balance start and starting details if journal_id changes"
@param statement_id: Changed statement_id
@param journal_id: Changed journal_id
@@ -288,7 +288,7 @@ class account_cash_statement(osv.osv):
'balance_start': balance_start
})
return res
res = super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context)
res = super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context)
return res
def _equal_balance(self, cr, uid, ids, statement, context={}):
@@ -454,25 +454,25 @@ class account_cash_statement(osv.osv):
move_line_id = account_move_line_obj.create(cr, uid, val , context=context)
torec.append(move_line_id)
if move.analytic_account_id:
anal_val = {}
amt = (val['credit'] or 0.0) - (val['debit'] or 0.0)
anal_val = {
'name': val['name'],
'ref': val['ref'],
'date': val['date'],
'amount': amt,
'account_id': val['analytic_account_id'],
'currency_id': val['currency_id'],
'general_account_id': val['account_id'],
'journal_id': st.journal_id.analytic_journal_id.id,
'period_id': val['period_id'],
'user_id': uid,
'move_id': move_line_id
}
if val.get('amount_currency', False):
anal_val['amount_currency'] = val['amount_currency']
account_analytic_line_obj.create(cr, uid, anal_val, context=context)
# if move.analytic_account_id:
# anal_val = {}
# amt = (val['credit'] or 0.0) - (val['debit'] or 0.0)
# anal_val = {
# 'name': val['name'],
# 'ref': val['ref'],
# 'date': val['date'],
# 'amount': amt,
# 'account_id': val['analytic_account_id'],
# 'currency_id': val['currency_id'],
# 'general_account_id': val['account_id'],
# 'journal_id': st.journal_id.analytic_journal_id.id,
# 'period_id': val['period_id'],
# 'user_id': uid,
# 'move_id': move_line_id
# }
# if val.get('amount_currency', False):
# anal_val['amount_currency'] = val['amount_currency']
# account_analytic_line_obj.create(cr, uid, anal_val, context=context)
if move.reconcile_id and move.reconcile_id.line_new_ids:
for newline in move.reconcile_id.line_new_ids:
+7 -8
View File
@@ -150,7 +150,7 @@
<field name="arch" type="xml">
<form string="Supplier invoice">
<group col="8" colspan="4">
<field domain="[('type', '=', 'purchase')]" name="journal_id"/>
<field domain="[('type', '=', 'purchase')]" name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
@@ -161,14 +161,14 @@
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="account.group_account_user"/>
<field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/>
<group colspan="2" col="1" groups="account.group_account_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
</group>
<notebook colspan="4">
<page string="Invoice">
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id" groups="account.group_account_user"/>
<field domain="[('company_id', '=', company_id), ('type', '=', 'payable')]" name="account_id" groups="account.group_account_user"/>
<field name="reference_type" nolabel="1" size="0"/>
<field name="reference" nolabel="1"/>
<field name="date_due"/>
@@ -221,7 +221,6 @@
</page>
<page string="Other Info">
<field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)"/>
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="payment_term" widget="selection"/>
@@ -260,7 +259,7 @@
<field name="arch" type="xml">
<form string="Invoice">
<group colspan="4" col="8">
<field name="journal_id" groups="base.group_user"/>
<field name="journal_id" groups="base.group_user" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
@@ -271,14 +270,14 @@
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="account.group_account_user"/>
<field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/>
<group colspan="2" col="1" groups="account.group_account_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
</group>
<notebook colspan="4">
<page string="Invoice">
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id" groups="account.group_account_user"/>
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]" name="account_id" groups="account.group_account_user"/>
<field name="name"/>
<field name="payment_term" widget="selection"/>
<field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list"/>
@@ -316,7 +315,7 @@
</group>
</page>
<page string="Other Info">
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="date_due"/>
<field name="user_id"/>
+3 -9
View File
@@ -131,7 +131,8 @@ class account_move_line(osv.osv):
'general_account_id': obj_line.account_id.id,
'journal_id': obj_line.journal_id.analytic_journal_id.id,
'ref': obj_line.ref,
'move_id':obj_line.id
'move_id':obj_line.id,
'user_id': uid
}
new_id = self.pool.get('account.analytic.line').create(cr,uid,vals_lines)
return True
@@ -1181,6 +1182,7 @@ class account_move_line(osv.osv):
'general_account_id': vals.get('account_id', False),
'journal_id': journal.analytic_journal_id.id,
'ref': vals.get('ref', False),
'user_id': uid
})]
result = super(osv.osv, self).create(cr, uid, vals, context)
@@ -1257,13 +1259,5 @@ class account_move_line(osv.osv):
return result
account_move_line()
class account_bank_statement_reconcile(osv.osv):
_inherit = "account.bank.statement.reconcile"
_columns = {
'line_ids': fields.many2many('account.move.line', 'account_bank_statement_line_rel', 'statement_id', 'line_id', 'Entries'),
}
account_bank_statement_reconcile()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2 -37
View File
@@ -521,7 +521,7 @@
attrs="{'invisible':[('state','=','confirm')]}"/>
</group>
<notebook colspan="4">
<page string="Transaction">
<page string="Transaction" name="statement_line_ids">
<field colspan="4" name="line_ids" nolabel="1">
<tree editable="bottom" string="Statement lines">
<field name="sequence" readonly="1"/>
@@ -533,8 +533,6 @@
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
<field name="analytic_account_id" groups="base.group_extended"/>
<field name="amount"/>
<field context="{'partner_id': partner_id, 'amount': amount, 'account_id': account_id, 'currency_id': parent.currency, 'journal_id': parent.journal_id, 'date':date}" name="reconcile_id"/>
<field invisible="1" name="reconcile_amount"/>
</tree>
<form string="Statement lines">
<field name="date"/>
@@ -544,7 +542,6 @@
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="analytic_account_id" groups="base.group_extended" />
<field name="amount"/>
<field context="{'partner_id':partner_id,'amount':amount,'account_id':account_id,'currency_id': parent.currency,'journal_id':parent.journal_id, 'date':date}" name="reconcile_id"/>
<field name="ref"/>
<field name="sequence" readonly="0"/>
<separator colspan="4" string="Notes"/>
@@ -552,7 +549,7 @@
</form>
</field>
</page>
<page string="Journal Entries">
<page string="Journal Entries" name="move_live_ids">
<field colspan="4" name="move_line_ids" nolabel="1"/>
</page>
</notebook>
@@ -657,38 +654,6 @@
<field name="filter" eval="True"/>
</record>
<record id="view_bank_statement_reconcile" model="ir.ui.view">
<field name="name">account.bank.statement.reconcile.form</field>
<field name="model">account.bank.statement.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconcile">
<field name="name" select="1"/>
<newline/>
<field name="total_second_amount"/>
<field name="total_second_currency"/>
<newline/>
<field name="total_amount"/>
<field name="total_currency"/>
<newline/>
<separator colspan="4" string="Entries"/>
<field colspan="4" domain="[('partner_id','=',context.get('partner_id', False)),('state','=','valid'),('account_id','=',context.get('account_id', False)),('reconcile_id', '=', False)]" name="line_ids" nolabel="1" view_mode="tree"/>
<field colspan="4" name="line_new_ids" nolabel="1">
<tree editable="bottom" string="Write-Off">
<field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="amount"/>
<field name="name"/>
</tree>
</field>
<group col="7" colspan="4">
<field name="total_entry"/>
<field name="total_new"/>
<field name="total_balance"/>
<button name="dummy" string="Compute" icon="terp-stock_format-scientific"/>
</group>
</form>
</field>
</record>
<!--
Account Types
-->
@@ -187,8 +187,8 @@
<field name="code">1104</field>
<field name="name">Bank Current Account</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset_view1"/>
<field name="type">liquidity</field>
<field name="user_type" ref="conf_account_type_asset"/>
</record>
<record id="conf_cli" model="account.account.template">
+16 -3
View File
@@ -211,7 +211,7 @@ class account_installer(osv.osv_memory):
vals={
'name': (obj_acc_root.id == account_template.id) and company_id.name or account_template.name,
#'sign': account_template.sign,
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
#'currency_id': account_template.currency_id and account_template.currency_id.id or False,
'code': code_acc,
'type': account_template.type,
'user_type': account_template.user_type and account_template.user_type.id or False,
@@ -225,6 +225,19 @@ class account_installer(osv.osv_memory):
new_account = obj_acc.create(cr, uid, vals)
acc_template_ref[account_template.id] = new_account
if account_template.name == 'Bank Current Account':
b_vals={
'name': 'Bank Accounts',
'code': '110500',
'type': 'view',
'user_type': account_template.parent_id.user_type and account_template.user_type.id or False,
'shortcut': account_template.shortcut,
'note': account_template.note,
'parent_id': account_template.parent_id and ((account_template.parent_id.id in acc_template_ref) and acc_template_ref[account_template.parent_id.id]) or False,
'tax_ids': [(6,0,tax_ids)],
'company_id': company_id.id,
}
bank_account = obj_acc.create(cr, uid, b_vals)
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Bank/Cash Journal View')])[0] #why fixed name here?
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Bank/Cash Journal (Multi-Currency) View')])[0] #Why Fixed name here?
ref_acc_bank = obj_multi.bank_account_view_id
@@ -281,10 +294,10 @@ class account_installer(osv.osv_memory):
vals_bnk = {'name': val.acc_name or '',
'currency_id': val.currency_id.id or False,
'code': str(110400 + code_cnt),
'code': str(110500 + code_cnt),
'type': 'liquidity',
'user_type': type,
'parent_id':new_account,
'parent_id':bank_account,
'company_id': company_id.id }
child_bnk_acc = obj_acc.create(cr, uid, vals_bnk)
vals_seq_child = {
+11 -1
View File
@@ -455,6 +455,17 @@ class account_invoice(osv.osv):
_('Can not select currency that is not related to current company.\nPlease select accordingly !.'))
return {}
def onchange_journal_id(self, cr, uid, ids, journal_id=False):
result = {}
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
currency_id = journal.currency and journal.currency.id or journal.company_id.currency_id.id
result = {'value': {
'currency_id': currency_id,
}
}
return result
def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice):
if not payment_term_id:
return {}
@@ -553,7 +564,6 @@ class account_invoice(osv.osv):
val['currency_id'] = False
else:
val['currency_id'] = currency.id
if company_id:
company = self.pool.get('res.company').browse(cr, uid, company_id)
if company.currency_id.company_id and company.currency_id.company_id.id != company_id:
+76 -32
View File
@@ -43,6 +43,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
self.init_query = data['form']['initial_bal_query']
self.init_balance = data['form']['initial_balance']
self.display_account = data['form']['display_account']
self.target_move = data['form'].get('target_move', 'all')
if (data['model'] == 'ir.ui.menu'):
new_ids = [data['form']['chart_account_id']]
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
@@ -78,14 +79,14 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
self.context = context
def _sum_currency_amount_account(self, account):
self.cr.execute("SELECT sum(l.amount_currency) AS tot_currency "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s" %(account.id, self.query))
self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
FROM account_move_line l \
WHERE l.account_id = %s AND %s' %(account.id, self.query))
sum_currency = self.cr.fetchone()[0] or 0.0
if self.init_balance:
self.cr.execute("SELECT sum(l.amount_currency) AS tot_currency "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
FROM account_move_line l \
WHERE l.account_id = %s AND %s '%(account.id, self.init_query))
sum_currency += self.cr.fetchone()[0] or 0.0
return str(sum_currency)
@@ -117,13 +118,23 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
def lines(self, account):
""" Return all the account_move_line of account with their account code counterparts """
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted', '']
# First compute all counterpart strings for every move_id where this account appear.
# Currently, the counterpart info is used only in landscape mode
sql = """
SELECT m1.move_id,
array_to_string(ARRAY(SELECT DISTINCT a.code FROM account_move_line m2 LEFT JOIN account_account a ON (m2.account_id=a.id) WHERE m2.move_id = m1.move_id AND m2.account_id<>%%s), ', ') AS counterpart
FROM (SELECT move_id FROM account_move_line l WHERE %s AND l.account_id = %%s GROUP BY move_id) m1
""" % self.query
array_to_string(ARRAY(SELECT DISTINCT a.code
FROM account_move_line m2
LEFT JOIN account_account a ON (m2.account_id=a.id)
WHERE m2.move_id = m1.move_id
AND m2.account_id<>%%s), ', ') AS counterpart
FROM (SELECT move_id
FROM account_move_line l
LEFT JOIN account_move am ON (am.id = l.move_id)
WHERE am.state IN %s and %s AND l.account_id = %%s GROUP BY move_id) m1
"""% (tuple(move_state), self.query)
self.cr.execute(sql, (account.id, account.id))
counterpart_res = self.cr.dictfetchall()
counterpart_accounts = {}
@@ -143,13 +154,13 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number,
p.name AS partner_name
FROM account_move_line l
LEFT JOIN account_move m on (l.move_id=m.id)
JOIN account_move m on (l.move_id=m.id)
LEFT JOIN res_currency c on (l.currency_id=c.id)
LEFT JOIN res_partner p on (l.partner_id=p.id)
LEFT JOIN account_invoice i on (m.id =i.move_id)
JOIN account_journal j on (l.journal_id=j.id)
WHERE %s AND l.account_id = %%s ORDER by %s
""" % (self.query, sql_sort)
WHERE %s AND m.state IN %s AND l.account_id = %%s ORDER by %s
""" %(self.query, tuple(move_state), sql_sort)
self.cr.execute(sql, (account.id,))
res_lines = self.cr.dictfetchall()
res_init = []
@@ -167,8 +178,8 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
LEFT JOIN res_partner p on (l.partner_id=p.id)
LEFT JOIN account_invoice i on (m.id =i.move_id)
JOIN account_journal j on (l.journal_id=j.id)
WHERE %s AND l.account_id = %%s
""" %(self.init_query)
WHERE %s AND m.state IN %s AND l.account_id = %%s
""" %(self.init_query, tuple(move_state))
self.cr.execute(sql, (account.id,))
res_init = self.cr.dictfetchall()
@@ -192,40 +203,73 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
return res
def _sum_debit_account(self, account):
self.cr.execute("SELECT sum(debit) "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted','']
self.cr.execute('SELECT sum(debit) \
FROM account_move_line l \
JOIN account_move am ON (am.id = l.move_id) \
WHERE (l.account_id = %s) \
AND (am.state IN %s) \
AND '+ self.query +' '
,(account.id, tuple(move_state)))
sum_debit = self.cr.fetchone()[0] or 0.0
if self.init_balance:
self.cr.execute("SELECT sum(debit) "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
self.cr.execute('SELECT sum(debit) \
FROM account_move_line l \
JOIN account_move am ON (am.id = l.move_id) \
WHERE (l.account_id = %s) \
AND (am.state IN %s) \
AND '+ self.init_query +' '
,(account.id, tuple(move_state)))
# Add initial balance to the result
sum_debit += self.cr.fetchone()[0] or 0.0
return sum_debit
def _sum_credit_account(self, account):
self.cr.execute("SELECT sum(credit) "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted','']
self.cr.execute('SELECT sum(credit) \
FROM account_move_line l \
JOIN account_move am ON (am.id = l.move_id) \
WHERE (l.account_id = %s) \
AND (am.state IN %s) \
AND '+ self.query +' '
,(account.id, tuple(move_state)))
sum_credit = self.cr.fetchone()[0] or 0.0
if self.init_balance:
self.cr.execute("SELECT sum(credit) "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
self.cr.execute('SELECT sum(credit) \
FROM account_move_line l \
JOIN account_move am ON (am.id = l.move_id) \
WHERE (l.account_id = %s) \
AND (am.state IN %s) \
AND '+ self.init_query +' '
,(account.id, tuple(move_state)))
# Add initial balance to the result
sum_credit += self.cr.fetchone()[0] or 0.0
return sum_credit
def _sum_balance_account(self, account):
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_balance "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s"%(account.id, self.query))
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted','']
self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
FROM account_move_line l \
JOIN account_move am ON (am.id = l.move_id) \
WHERE (l.account_id = %s) \
AND (am.state IN %s) \
AND '+ self.query +' '
,(account.id, tuple(move_state)))
sum_balance = self.cr.fetchone()[0] or 0.0
if self.init_balance:
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_balance "\
"FROM account_move_line l "\
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
FROM account_move_line l \
JOIN account_move am ON (am.id = l.move_id) \
WHERE (l.account_id = %s) \
AND (am.state IN %s) \
AND '+ self.init_query +' '
,(account.id, tuple(move_state)))
# Add initial balance to the result
sum_balance += self.cr.fetchone()[0] or 0.0
return sum_balance
@@ -29,8 +29,6 @@
"access_account_chart_template","account.chart.template","model_account_chart_template","account.group_account_manager",1,1,1,1
"access_account_tax_template","account.tax.template","model_account_tax_template","account.group_account_manager",1,0,0,0
"access_account_bank_statement","account.bank.statement","model_account_bank_statement","account.group_account_user",1,0,0,0
"access_account_bank_statement_reconcile","account.bank.statement.reconcile","model_account_bank_statement_reconcile","account.group_account_user",1,1,1,1
"access_account_bank_statement_reconcile_line","account.bank.statement.reconcile.line","model_account_bank_statement_reconcile_line","account.group_account_user",1,1,1,1
"access_account_bank_statement_line","account.bank.statement.line","model_account_bank_statement_line","account.group_account_user",1,0,0,0
"access_account_analytic_line","account.analytic.line","model_account_analytic_line","account.group_account_user",1,1,1,1
"access_account_analytic_line_manager","account.analytic.line manager","model_account_analytic_line","account.group_account_manager",1,0,0,0
@@ -182,7 +180,6 @@
"access_account_tax_code_accounting_accountant","account.tax.code","model_account_tax_code","account.group_accounting_accountant",1,0,0,0
"access_account_bank_statement_accounting_accountant","account.bank.statement","model_account_bank_statement","account.group_accounting_accountant",1,1,1,1
"access_account_cashbox_line_accounting_accountant","account.cashbox.line","model_account_cashbox_line","account.group_accounting_accountant",1,1,1,1
"access_account_bank_statement_reconcile_line","account.bank.statement.reconcile.line","model_account_bank_statement_reconcile_line","account.group_accounting_accountant",1,1,1,1
"access_account_bank_statement_line_accounting_accountant","account.bank.statement.line","model_account_bank_statement_line","account.group_accounting_accountant",1,1,1,1
"access_account_invoice_report_accounting_accountant","account.invoice.report","model_account_invoice_report","account.group_accounting_accountant",1,0,0,0
"access_report_account_receivable_accounting_accountant","report.account.receivable","model_report_account_receivable","account.group_accounting_accountant",1,0,0,0
@@ -197,7 +194,6 @@
"access_account_analytic_account_accounting_accountant","account.analytic.account","analytic.model_account_analytic_account","account.group_accounting_accountant",1,0,0,0
"access_account_analytic_line_accounting_accountant","account.analytic.line","analytic.model_account_analytic_line","account.group_accounting_accountant",1,0,0,0
"access_account_analytic_journal_accounting_accountant","account.analytic.journal","model_account_analytic_journal","account.group_accounting_accountant",1,0,0,0
"access_account_bank_statement_reconcile_accounting_accountant","account.bank.statement.reconcile","model_account_bank_statement_reconcile","account.group_accounting_accountant",1,1,1,1
"access_account_analytic_journal_analytic_accounting","account.analytic.journal","model_account_analytic_journal","analytic.group_analytic_accounting",1,1,1,1
"access_account_account_analytic_accounting","account.account","model_account_account","analytic.group_analytic_accounting",1,0,0,0
"access_product_product_analytic_accounting","product.product","product.model_product_product","analytic.group_analytic_accounting",1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
29 access_account_chart_template account.chart.template model_account_chart_template account.group_account_manager 1 1 1 1
30 access_account_tax_template account.tax.template model_account_tax_template account.group_account_manager 1 0 0 0
31 access_account_bank_statement account.bank.statement model_account_bank_statement account.group_account_user 1 0 0 0
access_account_bank_statement_reconcile account.bank.statement.reconcile model_account_bank_statement_reconcile account.group_account_user 1 1 1 1
access_account_bank_statement_reconcile_line account.bank.statement.reconcile.line model_account_bank_statement_reconcile_line account.group_account_user 1 1 1 1
32 access_account_bank_statement_line account.bank.statement.line model_account_bank_statement_line account.group_account_user 1 0 0 0
33 access_account_analytic_line account.analytic.line model_account_analytic_line account.group_account_user 1 1 1 1
34 access_account_analytic_line_manager account.analytic.line manager model_account_analytic_line account.group_account_manager 1 0 0 0
180 access_account_tax_code_accounting_accountant account.tax.code model_account_tax_code account.group_accounting_accountant 1 0 0 0
181 access_account_bank_statement_accounting_accountant account.bank.statement model_account_bank_statement account.group_accounting_accountant 1 1 1 1
182 access_account_cashbox_line_accounting_accountant account.cashbox.line model_account_cashbox_line account.group_accounting_accountant 1 1 1 1
access_account_bank_statement_reconcile_line account.bank.statement.reconcile.line model_account_bank_statement_reconcile_line account.group_accounting_accountant 1 1 1 1
183 access_account_bank_statement_line_accounting_accountant account.bank.statement.line model_account_bank_statement_line account.group_accounting_accountant 1 1 1 1
184 access_account_invoice_report_accounting_accountant account.invoice.report model_account_invoice_report account.group_accounting_accountant 1 0 0 0
185 access_report_account_receivable_accounting_accountant report.account.receivable model_report_account_receivable account.group_accounting_accountant 1 0 0 0
194 access_account_analytic_account_accounting_accountant account.analytic.account analytic.model_account_analytic_account account.group_accounting_accountant 1 0 0 0
195 access_account_analytic_line_accounting_accountant account.analytic.line analytic.model_account_analytic_line account.group_accounting_accountant 1 0 0 0
196 access_account_analytic_journal_accounting_accountant account.analytic.journal model_account_analytic_journal account.group_accounting_accountant 1 0 0 0
access_account_bank_statement_reconcile_accounting_accountant account.bank.statement.reconcile model_account_bank_statement_reconcile account.group_accounting_accountant 1 1 1 1
197 access_account_analytic_journal_analytic_accounting account.analytic.journal model_account_analytic_journal analytic.group_analytic_accounting 1 1 1 1
198 access_account_account_analytic_accounting account.account model_account_account analytic.group_analytic_accounting 1 0 0 0
199 access_product_product_analytic_accounting product.product product.model_product_product analytic.group_analytic_accounting 1 0 0 0
+5 -5
View File
@@ -54,14 +54,14 @@ class account_chart(osv.osv_memory):
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
res = {}
res['value'] = {'period_from': False, 'period_to': False}
res['value'] = {}
if fiscalyear_id:
start_period = end_period = False
cr.execute('''
SELECT * FROM (SELECT p.id
FROM account_period p
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
WHERE f.id = %s
SELECT * FROM (SELECT p.id
FROM account_period p
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
WHERE f.id = %s
ORDER BY p.date_start ASC
LIMIT 1) AS period_start
UNION
+3 -3
View File
@@ -9,11 +9,11 @@
<form string="Account charts">
<group colspan="4">
<field name="fiscalyear" on_change="onchange_fiscalyear(fiscalyear)"/>
<field name="target_move"/>
<label align="0.7" colspan="4" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
<separator string="Periods" colspan="4"/>
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear)]"/>
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear)]"/>
<field name="target_move"/>
<field name="period_from"/>
<field name="period_to"/>
</group>
<separator string="" colspan="4"/>
<group colspan="4" col="6">
@@ -37,14 +37,11 @@ class account_aged_trial_balance(osv.osv_memory):
'direction_selection': fields.selection([('past','Past'),
('future','Future')],
'Analysis Direction', required=True),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
_defaults = {
'period_length': 30,
'date_from' : time.strftime('%Y-%m-%d'),
'direction_selection': 'past',
'target_move': 'all',
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
@@ -64,7 +61,7 @@ class account_aged_trial_balance(osv.osv_memory):
context = {}
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['period_length', 'direction_selection', 'target_move'])[0])
data['form'].update(self.read(cr, uid, ids, ['period_length', 'direction_selection'])[0])
period_length = data['form']['period_length']
if period_length<=0:
@@ -81,7 +78,7 @@ class account_aged_trial_balance(osv.osv_memory):
'name': (i!=0 and (str((5-(i+1)) * period_length) + '-' + str((5-i) * period_length)) or ('+'+str(4 * period_length))),
'stop': start.strftime('%Y-%m-%d'),
'start': (i!=0 and stop.strftime('%Y-%m-%d') or False),
}
}
start = stop - RelativeDateTime(days=1)
else:
for i in range(5):
@@ -90,7 +87,7 @@ class account_aged_trial_balance(osv.osv_memory):
'name' : (i!=4 and str((i) * period_length)+'-' + str((i+1) * period_length) or ('+'+str(4 * period_length))),
'start': start.strftime('%Y-%m-%d'),
'stop': (i!=4 and stop.strftime('%Y-%m-%d') or False),
}
}
start = stop + RelativeDateTime(days=1)
data['form'].update(res)
@@ -98,7 +95,7 @@ class account_aged_trial_balance(osv.osv_memory):
'type': 'ir.actions.report.xml',
'report_name': 'account.aged_trial_balance',
'datas': data
}
}
account_aged_trial_balance()
@@ -30,15 +30,19 @@ class account_common_partner_report(osv.osv_memory):
('supplier','Payable Accounts'),
('customer_supplier' ,'Receivable and Payable Accounts')],
"Partner's", required=True),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
_defaults = {
'result_selection': 'customer',
'target_move': 'all'
}
def pre_print_report(self, cr, uid, ids, data, query_line, context=None):
if context is None:
context = {}
data['form'].update(self.read(cr, uid, ids, ['result_selection'])[0])
data['form'].update(self.read(cr, uid, ids, ['result_selection', 'target_move'])[0])
return data
account_common_partner_report()
@@ -32,12 +32,15 @@ class account_report_general_ledger(osv.osv_memory):
help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort By', required=True),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
_defaults = {
'landscape': True,
'amount_currency': True,
'sortby': 'sort_date',
'initial_balance': False,
'target_move': 'all',
}
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, context=None):
@@ -50,7 +53,7 @@ class account_report_general_ledger(osv.osv_memory):
if context is None:
context = {}
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby'])[0])
data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby', 'target_move'])[0])
if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record
data['form'].update({'initial_balance': False})
if data['form']['landscape']:
@@ -10,6 +10,7 @@
<field name="arch" type="xml">
<field name="fiscalyear_id" position="after">
<field name="display_account"/>
<field name="target_move"/>
<field name="sortby"/>
<field name="landscape"/>
<field name="initial_balance" attrs="{'readonly':[('fiscalyear_id','=', False)]}"/>
@@ -33,25 +33,23 @@ class account_partner_balance(osv.osv_memory):
# ,help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
'display_partner': fields.selection([('non-zero_balance', 'With balance is not equal to 0'), ('all', 'All Partners')]
,'Display Partners'),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
}
_defaults = {
# 'initial_balance': True,
'display_partner': 'non-zero_balance',
'target_move': 'all'
}
}
def _print_report(self, cr, uid, ids, data, query_line, context=None):
if context is None:
context = {}
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['display_partner', 'target_move'])[0])
data['form'].update(self.read(cr, uid, ids, ['display_partner'])[0])
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.partner.balance',
'datas': data,
}
}
account_partner_balance()
@@ -35,28 +35,25 @@ class account_partner_ledger(osv.osv_memory):
'reconcil': fields.boolean('Include Reconciled Entries', help='Consider reconciled entries'),
'page_split': fields.boolean('One Partner Per Page', help='Display Ledger Report with One partner per page'),
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
_defaults = {
'reconcil': True,
'initial_balance': True,
'page_split': False,
'target_move': 'all'
}
def _print_report(self, cr, uid, ids, data, query_line, context=None):
if context is None:
context = {}
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'reconcil', 'page_split', 'amount_currency', 'target_move'])[0])
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'reconcil', 'page_split', 'amount_currency'])[0])
if data['form']['page_split']:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.third_party_ledger',
'datas': data,
}
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.third_party_ledger_other',
+44 -3
View File
@@ -45,7 +45,7 @@ account_move_line()
class account_voucher(osv.osv):
def _get_type(self, cr, uid, ids, context={}):
return context.get('type')
return context.get('type', False)
def _get_period(self, cr, uid, context={}):
if context.get('period_id', False):
@@ -101,7 +101,8 @@ class account_voucher(osv.osv):
def _get_narration(self, cr, uid, context={}):
return context.get('narration', False)
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "date desc, id desc"
@@ -308,7 +309,7 @@ class account_voucher(osv.osv):
tr_type = 'receipt'
default['value']['account_id'] = account_id
default['value']['type'] = tr_type
default['value']['type'] = ttype or tr_type
vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context)
default['value'].update(vals.get('value'))
@@ -810,3 +811,43 @@ class account_voucher_line(osv.osv):
})
return values
account_voucher_line()
class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
def create_move_from_st_line(self, cr, uid, st_line, company_currency_id, next_number, context=None):
if st_line.voucher_id:
return self.pool.get('account.voucher').proforma_voucher(cr, uid, [st_line.voucher_id.id])
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context)
account_bank_statement()
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
res_currency_obj = self.pool.get('res.currency')
res = {}
company_currency_id = False
for line in self.browse(cursor, user, ids, context=context):
if not company_currency_id:
company_currency_id = line.company_id.id
if line.voucher_id:
res[line.id] = res_currency_obj.compute(cursor, user,
company_currency_id, line.statement_id.currency.id,
line.voucher_id.amount, context=context)
else:
res[line.id] = 0.0
return res
_columns = {
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', method=True, type='float'),
'voucher_id': fields.many2one('account.voucher', 'Payment'),
}
account_bank_statement_line()
@@ -80,6 +80,72 @@
</search>
</field>
</record>
<record model="ir.ui.view" id="view_low_priority_payment_form">
<field name="name">account.voucher.payment.low.priority.form</field>
<field name="model">account.voucher</field>
<field name="type">form</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Bill Payment">
<group col="6" colspan="4">
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" context="{'invoice_currency':currency_id}" string="Vendor"/>
<field name="journal_id"
domain="[('type','in',['bank', 'cash'])]"
widget="selection" select="1"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"
string="Payment Method"/>
<field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="4"/>
<field name="account_id"
widget="selection"
invisible="True"/>
<field name="pre_line" invisible="1"/>
<field name="type" invisible="True"/>
</group>
<notebook colspan="4">
<page string="Payment Information">
<field name="line_dr_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140">
<tree string="Vendor Invoices and Outstanding transactions" editable="bottom">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
on_change="onchange_move_line_id(move_line_id)"
domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
/>
<field name="account_id" groups="base.group_extended" domain="[('type','=','payable')]"/>
<field name="date_original" readonly="1"/>
<field name="date_due" readonly="1"/>
<field name="amount_original" readonly="1"/>
<field name="amount_unreconciled" sum="Open Balance" readonly="1"/>
<field name="amount" sum="Payment"/>
</tree>
<form string="Payment Information">
<label string="Form view not available for Payment Lines"/>
</form>
</field>
<field name="line_cr_ids" colspan="4" nolabel="1" attrs="{'invisible': [('pre_line','=',False)]}" default_get="{'journal_id':journal_id, 'partner_id':partner_id}">
<tree string="Credits" editable="bottom">
<field name="move_line_id"/>
<field name="account_id" groups="base.group_extended" domain="[('type','=','receivable')]"/>
<field name="date_original"/>
<field name="amount_original"/>
<field name="amount" sum="Payment"/>
</tree>
</field>
<group col="2" colspan="3">
<separator string="Internal Notes" colspan="2"/>
<field name="narration" colspan="2" nolabel="1"/>
</group>
<group col="2" colspan="1">
<separator string="Other Information" colspan="2"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="currency_id" invisible="True"/>
<field name="number"/>
</group>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_vendor_payment_form">
<field name="name">account.voucher.payment.form</field>
@@ -102,6 +102,7 @@
<field name="name" colspan="4"/>
<field name="date" on_change="onchange_date(date)"/>
<field name="type" invisible="True"/>
<field name="currency_id" invisible="True" nolabel="1"/>
</group>
<notebook colspan="4">
<page string="Sales Information">
@@ -133,7 +134,7 @@
<group col="4" colspan="1">
<separator string="Total" colspan="4"/>
<field name="tax_id" on_change="onchange_price(line_cr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('sale','all'))]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" groups="base.group_extended" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
<label string="" colspan="1"/><field name="currency_id" invisible="True" nolabel="1"/><field name="amount" string="Total"/>
<label string="" colspan="1"/><field name="amount" string="Total"/>
</group>
</group>
</page>
@@ -211,6 +212,7 @@
<field name="reference" select="1"/>
<field name="account_id" domain="[('type','=','other')]" invisible="True"/>
<field name="type" invisible="True"/>
<field name="currency_id" invisible="True" nolabel="1"/>
</group>
<notebook colspan="4">
<page string="Bill Information">
@@ -235,7 +237,7 @@
<group col="4" colspan="1">
<separator string="Total" colspan="4"/>
<field name="tax_id" on_change="onchange_price(line_dr_ids, tax_id, partner_id)" widget="selection" domain="[('type_tax_use','in',('purchase','all'))]"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" groups="base.group_extended" attrs="{'invisible': [('state','!=','draft')]}"/>
<label string="" colspan="1"/><field name="currency_id" invisible="True" nolabel="1"/><field name="amount" string="Total"/>
<label string="" colspan="1"/><field name="amount" string="Total"/>
</group>
</group>
</page>
+25
View File
@@ -147,6 +147,17 @@
<field name="view_id" eval="view_voucher_tree"/>
<field name="search_view_id" ref="view_voucher_filter"/>
</record>
<record id="action_journal_voucher_tree" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="action_voucher_list"/>
</record>
<record id="action_journal_voucher_form" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_voucher_form"/>
<field name="act_window_id" ref="action_voucher_list"/>
</record>
<menuitem action="action_voucher_list" id="menu_encode_entries_by_voucher" parent="account.menu_finance_entries" sequence="6"/>
<act_window
@@ -168,5 +179,19 @@
<field name="search_view_id" ref="view_voucher_filter"/>
</record>
<record id="view_bank_statement_form_voucher" model="ir.ui.view">
<field name="name">account.bank.statement.voucher.form.inherit</field>
<field name="model">account.bank.statement</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
<field name="voucher_id" context="{'default_type': amount &lt; 0 and 'payment' or 'receipt', 'type': amount &lt; 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
<field name="amount_reconciled"/>
</xpath>
</field>
</record>
</data>
</openerp>
-4
View File
@@ -128,10 +128,6 @@ class pos_order(osv.osv):
cr.execute(" SELECT max(l.date) from account_move_line l, account_move m, account_invoice i, account_move_reconcile r, pos_order o where i.move_id=m.id and l.move_id=m.id and l.reconcile_id=r.id and o.id=%d and o.invoice_id=i.id"%(order.id))
val=cr.fetchone()
val= val and val[0] or None
if not val:
cr.execute("select max(date) from account_bank_statement_line l, account_bank_statement_reconcile s where l.pos_statement_id=%d and l.reconcile_id=s.id"%(order.id))
val=cr.fetchone()
val=val and val[0] or None
if val:
res[order.id]=val
return res
+34 -34
View File
@@ -24,13 +24,13 @@ from osv import fields, osv
from tools.translate import _
import difflib
class Wiki(osv.osv):
class wiki_wiki(osv.osv):
""" wiki """
_name = "wiki.wiki"
Wiki()
wiki_wiki()
class WikiGroup(osv.osv):
class wiki_group(osv.osv):
""" Wiki Groups """
_name = "wiki.groups"
@@ -45,8 +45,8 @@ class WikiGroup(osv.osv):
'template': fields.text('Wiki Template'),
'section': fields.boolean("Make Section ?"),
'method':fields.selection([('list', 'List'), ('page', 'Home Page'), \
('tree', 'Tree')], 'Display Method'),
'home':fields.many2one('wiki.wiki', 'Home Page'),
('tree', 'Tree')], 'Display Method', help="Define the default behaviour of the menu created on this group"),
'home':fields.many2one('wiki.wiki', 'Home Page', help="Required to select home page if display method is Home Page"),
'menu_id': fields.many2one('ir.ui.menu', "Menu", readonly=True),
}
@@ -71,7 +71,7 @@ class WikiGroup(osv.osv):
group_id = ids[0]
if not group_id:
return {}
value = {
value = {
'name': 'Wiki Page',
'view_type': 'form',
'view_mode': 'form,tree',
@@ -94,10 +94,10 @@ class WikiGroup(osv.osv):
value['view_type'] = 'tree'
return value
WikiGroup()
wiki_group()
class Wiki2(osv.osv):
class wiki_wiki2(osv.osv):
""" Wiki Page """
_inherit = "wiki.wiki"
@@ -111,7 +111,7 @@ class Wiki2(osv.osv):
'create_uid': fields.many2one('res.users', 'Author', select=True),
'create_date': fields.datetime("Created on", select=True),
'write_date': fields.datetime("Modification Date", select=True),
'tags': fields.char('Tags', size=1024, select=True),
'tags': fields.char('Keywords', size=1024, select=True),
'history_id': fields.one2many('wiki.wiki.history', 'wiki_id', 'History Lines'),
'minor_edit': fields.boolean('Minor edit', select=True),
'summary': fields.char('Summary', size=256),
@@ -119,12 +119,17 @@ class Wiki2(osv.osv):
'group_id': fields.many2one('wiki.groups', 'Wiki Group', select=1, ondelete='set null',
help="Topic, also called Wiki Group"),
'toc': fields.boolean('Table of Contents',
help="Indicates that this pages is a table of contents (linking to other pages)"),
help="Indicates that this pages have a table of contents or not"),
'review': fields.boolean('Needs Review', select=True,
help="Indicates that this page should be reviewed, raising the attention of other contributors"),
'parent_id': fields.many2one('wiki.wiki', 'Parent Page'),
'parent_id': fields.many2one('wiki.wiki', 'Parent Page', help="Allows you to link with the other page with in the current topic"),
'child_ids': fields.one2many('wiki.wiki', 'parent_id', 'Child Pages'),
}
_defaults = {
'toc': lambda *a: True,
'review': lambda *a: True,
'minor_edit': lambda *a: True,
}
def onchange_group_id(self, cr, uid, ids, group_id, content, context={}):
@@ -161,22 +166,27 @@ class Wiki2(osv.osv):
return super(Wiki, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
def create(self, cr, uid, vals, context=None):
""" @param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks, """
id = super(Wiki, self).create(cr, uid, vals, context)
def create_history(self, cr, uid, ids, vals, context=None):
history_id = False
history = self.pool.get('wiki.wiki.history')
if vals.get('text_area'):
res = {
'minor_edit': vals.get('minor_edit', True),
'text_area': vals.get('text_area', ''),
'write_uid': uid,
'wiki_id': id,
'wiki_id': ids[0],
'summary':vals.get('summary', '')
}
history.create(cr, uid, res)
history_id = history.create(cr, uid, res)
return history_id
def create(self, cr, uid, vals, context=None):
""" @param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks, """
id = super(wiki_wiki2, self).create(cr, uid, vals, context)
self.create_history(cr, uid, [id], vals, context)
return id
def write(self, cr, uid, ids, vals, context=None):
@@ -184,24 +194,14 @@ class Wiki2(osv.osv):
""" @param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks, """
result = super(Wiki, self).write(cr, uid, ids, vals, context)
history = self.pool.get('wiki.wiki.history')
if vals.get('text_area'):
for id in ids:
res = {
'minor_edit': vals.get('minor_edit', True),
'text_area': vals.get('text_area', ''),
'write_uid': uid,
'wiki_id': id,
'summary': vals.get('summary', '')
}
history.create(cr, uid, res)
result = super(wiki_wiki2, self).write(cr, uid, ids, vals, context)
self.create_history(cr, uid, ids, vals, context)
return result
Wiki2()
wiki_wiki2()
class History(osv.osv):
class wiki_history(osv.osv):
""" Wiki History """
_name = "wiki.wiki.history"
@@ -240,6 +240,6 @@ class History(osv.osv):
diff = difflib.HtmlDiff()
return diff.make_file(line1, line2, "Revision-%s" % (v1), "Revision-%s" % (v2), context=False)
History()
wiki_history()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+37 -39
View File
@@ -12,8 +12,7 @@
parent="knowledge.menu_document_configuration" sequence="2" />
<!-- Wiki Groups Tree view -->
<!-- Wiki Groups Tree view -->
<record model="ir.ui.view" id="wiki_group_tree">
<field name="name">wiki.groups.tree</field>
<field name="model">wiki.groups</field>
@@ -25,23 +24,25 @@
</field>
</record>
<!-- Wiki Groups Form view -->
<!-- Wiki Groups Form view -->
<record model="ir.ui.view" id="wiki_group_form">
<field name="name">wiki.groups.form</field>
<field name="model">wiki.groups</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Wiki Groups">
<group colspan="4" col="4">
<group col="4" colspan="3" >
<field name="name" select="1"/>
<field name="create_date" readonly="2"/>
</group>
<group col="2" colspan="1">
<field name="method" select="1"/>
<field name="home" select="1"
<field name="home" select="1" domain="[('group_id','=',active_id)]"
attrs="{'required':[('method','=','page')], 'readonly':[('method','!=','page')]}" />
</group>
<notebook colspan="4">
<page string="Notes">
<separator string="Group Description" colspan="4"/>
<field name="notes" colspan="4" nolabel="1"/>
</page><page string="Configuration">
<separator string="Page Template" colspan="4"/>
@@ -64,8 +65,7 @@
</field>
</record>
<!-- Wiki Groups Action -->
<!-- Wiki Groups Action -->
<record model="ir.actions.act_window" id="action_wiki_groups">
<field name="name">Wiki Groups</field>
<field name="res_model">wiki.groups</field>
@@ -84,8 +84,7 @@
<field name="view_type">tree</field>
</record>
<!-- wiki Tree view For child -->
<!-- wiki Tree view For child -->
<record id="view_wiki_tree_childs" model="ir.ui.view">
<field name="name">wiki.wiki.tree.childs</field>
<field name="model">wiki.wiki</field>
@@ -103,8 +102,7 @@
</field>
</record>
<!-- wiki Tree view -->
<!-- wiki Tree view -->
<record model="ir.ui.view" id="view_wiki_tree">
<field name="name">wiki.wiki.tree</field>
<field name="model">wiki.wiki</field>
@@ -112,27 +110,28 @@
<field name="arch" type="xml">
<tree string="Wiki">
<field name="name"/>
<field name="group_id"/>
<field name="section" invisible="not context.get('section',False)"/>
<field name="group_id" invisible="context.get('group_id',False)"/>
<field name="review"/>
<field name="create_uid" invisible="context.get('create_uid',False)"/>
<field name="write_uid"/>
<field name="write_date"/>
</tree>
</field>
</record>
<!-- wiki Form view -->
<!-- wiki Form view -->
<record model="ir.ui.view" id="view_wiki_form">
<field name="name">wiki.wiki.form</field>
<field name="model">wiki.wiki</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Wiki">
<group col="8" colspan="4">
<field name="name" select="1" colspan="8"/>
<group col="6" colspan="4">
<field name="name" select="1" colspan="6"/>
<field name="group_id" string="Topic" select="1" on_change="onchange_group_id(group_id, text_area)"/>
<field name="section"/>
<field name="parent_id" groups="base.group_extended" domain="[('group_id','=',group_id)]"/>
<field name="section"/>
</group>
<notebook colspan="4">
<page string="Content">
@@ -140,44 +139,47 @@
<field name="text_area" nolabel="1" colspan="4" select="1" widget="text_wiki"/>
</page>
</notebook>
<separator colspan="4" string="Modifications"/>
<group col="4" colspan="4">
<group col="2" colspan="2">
<separator colspan="4" string="Modification Information"/>
<field name="write_date" readonly="1"/>
<field name="review" select="1"/>
<field name="tags" select="1" groups="base.group_extended"/>
<field name="toc"/>
<field name="minor_edit" groups="base.group_extended"/>
<field name="review" select="1" groups="base.group_extended"/>
</group>
<group col="2" colspan="2">
<separator colspan="4" string="Meta Information"/>
<field name="tags" select="1"/>
<field name="toc" groups="base.group_extended"/>
</group>
</form>
</field>
</record>
<!-- wiki Search view -->
<!-- wiki Search view -->
<record id="view_wiki_filter" model="ir.ui.view">
<field name="name">wiki.wiki.search</field>
<field name="model">wiki.wiki</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Wiki">
<filter icon="terp-check" string="Need Review" domain="[('review','=',True)]"/>
<filter icon="terp-gtk-jump-to-ltr" string="Need Review" domain="[('review','=',True)]"/>
<separator orientation="vertical"/>
<field name="section" select="1"/>
<field name="name" select="1"/>
<field name="group_id" select="1"/>
<field name="tags" select="1"/>
<field name="section" select="1" groups="base.group_extended"/>
<field name="write_uid" select="1"/>
<field name="write_date" select="1"/>
<newline/>
<group expand="0" string="Group By..." colspan="8" col="6">
<filter icon="terp-check" string="Wiki Group" domain="[]" context="{'group_by':'group_id'}"/>
<filter icon="terp-folder-blue" string="Wiki Group" domain="[]" context="{'group_by':'group_id'}"/>
<filter icon="terp-personal" string="Author" domain="[]" context="{'group_by':'create_uid'}"/>
<filter icon="terp-personal-" string="Last Contributor" domain="[]" context="{'group_by':'write_uid'}"/>
<filter icon="terp-personal+" string="Last Contributor" domain="[]" context="{'group_by':'write_uid'}"/>
</group>
</search>
</field>
</record>
<!-- search page for wiki -->
<!-- search page for wiki -->
<record model="ir.actions.act_window" id="action_wiki">
<field name="name">Wiki Pages</field>
<field name="res_model">wiki.wiki</field>
@@ -192,8 +194,7 @@
id="menu_action_wiki_wiki" name="Wiki Pages"
action="action_wiki" />
<!-- Pages Waiting Review -->
<!-- Pages Waiting Review -->
<record model="ir.actions.act_window" id="action_wiki_review">
<field name="name">Pages Waiting Review</field>
<field name="res_model">wiki.wiki</field>
@@ -205,8 +206,7 @@
<field name="filter" eval="True"/>
</record>
<!-- History Tree view -->
<!-- History Tree view -->
<record model="ir.ui.view" id="view_wiki_history_tree">
<field name="name">wiki.wiki.history.tree</field>
<field name="model">wiki.wiki.history</field>
@@ -221,8 +221,7 @@
</field>
</record>
<!-- History Form view -->
<!-- History Form view -->
<record model="ir.ui.view" id="wiki_history_form">
<field name="name">wiki.wiki.history.form</field>
<field name="model">wiki.wiki.history</field>
@@ -238,8 +237,7 @@
</field>
</record>
<!-- History Action -->
<!-- History Action -->
<record model="ir.actions.act_window" id="action_history">
<field name="name">All Page Histories</field>
<field name="res_model">wiki.wiki.history</field>