[MERGE] merge with main addons branch
bzr revid: al@openerp.com-20100915142406-vcdenfm6xnlpmj7h
This commit is contained in:
commit
5c6b4bb865
|
@ -31,10 +31,11 @@ class account_bank_statement(osv.osv):
|
|||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
seq = 0
|
||||
for line in vals['line_ids']:
|
||||
seq += 1
|
||||
line[2]['sequence'] = seq
|
||||
vals[seq - 1] = line
|
||||
if 'line_ids' in vals:
|
||||
for line in vals['line_ids']:
|
||||
seq += 1
|
||||
line[2]['sequence'] = seq
|
||||
vals[seq - 1] = line
|
||||
return super(account_bank_statement, self).create(cr, uid, vals, context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
|
|
|
@ -132,7 +132,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
|
|||
history = []
|
||||
for i in range(5):
|
||||
args_list = (tuple(self.ACCOUNT_TYPE), tuple(partner_ids) ,self.date_from,)
|
||||
dates_query = '(COALESCE(date_maturity,date)'
|
||||
dates_query = "(COALESCE(date_maturity,date)"
|
||||
if form[str(i)]['start'] and form[str(i)]['stop']:
|
||||
dates_query += ' BETWEEN %s AND %s)'
|
||||
args_list += (form[str(i)]['start'], form[str(i)]['stop'])
|
||||
|
@ -255,17 +255,30 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
|
|||
for i in t:
|
||||
future_past['No Partner Defined'] = i[0]
|
||||
history = []
|
||||
|
||||
for i in range(5):
|
||||
args_list = (tuple(self.ACCOUNT_TYPE), self.date_from)
|
||||
dates_query = "(COALESCE(date_maturity,date)"
|
||||
if form[str(i)]['start'] and form[str(i)]['stop']:
|
||||
dates_query += ' BETWEEN %s AND %s)'
|
||||
args_list += (form[str(i)]['start'], form[str(i)]['stop'])
|
||||
elif form[str(i)]['start']:
|
||||
dates_query += ' > %s)'
|
||||
args_list += (form[str(i)]['start'],)
|
||||
else:
|
||||
dates_query += ' < %s)'
|
||||
args_list += (form[str(i)]['stop'],)
|
||||
|
||||
self.cr.execute('SELECT SUM(debit-credit)\
|
||||
FROM account_move_line AS l, account_account\
|
||||
WHERE (l.account_id = account_account.id)\
|
||||
AND (l.partner_id IS NULL)\
|
||||
AND (account_account.type IN %s)\
|
||||
AND (COALESCE(date_maturity,date) BETWEEN %s AND %s)\
|
||||
AND ((reconcile_id IS NULL)\
|
||||
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
|
||||
AND '+ self.query + '\
|
||||
AND account_account.active ' , (tuple(self.ACCOUNT_TYPE), form[str(i)]['start'], form[str(i)]['stop'], self.date_from,))
|
||||
AND '+ dates_query + '\
|
||||
AND account_account.active ' , args_list)
|
||||
t = self.cr.fetchall()
|
||||
d = {}
|
||||
for i in t:
|
||||
|
|
|
@ -69,19 +69,19 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
|||
return super(account_balance ,self)._get_account(data)
|
||||
|
||||
def lines(self, form, ids=[], done=None):#, level=1):
|
||||
def _process_child(accounts,disp_acc,parent):
|
||||
def _process_child(accounts, disp_acc, parent):
|
||||
account_rec = [acct for acct in accounts if acct['id']==parent][0]
|
||||
res = {
|
||||
'id': account_rec['id'],
|
||||
'type': account_rec['type'],
|
||||
'type': account_rec['type'],
|
||||
'code': account_rec['code'],
|
||||
'name': account_rec['name'],
|
||||
'level': account_rec['level'],
|
||||
'debit': account_rec['debit'],
|
||||
'credit': account_rec['credit'],
|
||||
'balance': account_rec['balance'],
|
||||
'parent_id':account_rec['parent_id'],
|
||||
'bal_type':'',
|
||||
'parent_id': account_rec['parent_id'],
|
||||
'bal_type': '',
|
||||
}
|
||||
self.sum_debit += account_rec['debit']
|
||||
self.sum_credit += account_rec['credit']
|
||||
|
@ -96,7 +96,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
|||
if account_rec['child_id']:
|
||||
for child in account_rec['child_id']:
|
||||
_process_child(accounts,disp_acc,child)
|
||||
|
||||
|
||||
obj_account = self.pool.get('account.account')
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
|
@ -113,6 +113,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
|||
elif form['filter'] == 'filter_date':
|
||||
ctx['date_from'] = form['date_from']
|
||||
ctx['date_to'] = form['date_to']
|
||||
ctx['state'] = form['target_move']
|
||||
parents = ids
|
||||
child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx)
|
||||
if child_ids:
|
||||
|
|
|
@ -40,6 +40,9 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
new_ids = ids
|
||||
self.sortby = data['form'].get('sortby', 'sort_date')
|
||||
self.query = data['form'].get('query_line', '')
|
||||
self.init_query = data['form']['initial_bal_query']
|
||||
self.init_balance = data['form']['initial_balance']
|
||||
self.display_account = data['form']['display_account']
|
||||
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)
|
||||
|
@ -79,10 +82,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
"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 form.get('initial_balance', False):
|
||||
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, form['initial_bal_query']))
|
||||
"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)
|
||||
|
||||
|
@ -99,10 +102,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
num_entry = self.cr.fetchone()[0] or 0
|
||||
sold_account = self._sum_balance_account(child_account,form)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
if form['display_account'] == 'bal_movement':
|
||||
if self.display_account == 'bal_movement':
|
||||
if child_account.type != 'view' and num_entry <> 0 :
|
||||
res.append(child_account)
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
elif self.display_account == 'bal_solde':
|
||||
if child_account.type != 'view' and num_entry <> 0 :
|
||||
if ( sold_account <> 0.0):
|
||||
res.append(child_account)
|
||||
|
@ -150,7 +153,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
self.cr.execute(sql, (account.id,))
|
||||
res_lines = self.cr.dictfetchall()
|
||||
res_init = []
|
||||
if res_lines and form['initial_balance']:
|
||||
if res_lines and self.init_balance:
|
||||
#FIXME: replace the label of lname with a string translatable
|
||||
sql = """
|
||||
SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
|
||||
|
@ -165,7 +168,7 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
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
|
||||
""" %(form['initial_bal_query'])
|
||||
""" %(self.init_query)
|
||||
|
||||
self.cr.execute(sql, (account.id,))
|
||||
res_init = self.cr.dictfetchall()
|
||||
|
@ -193,10 +196,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
|
||||
sum_debit = self.cr.fetchone()[0] or 0.0
|
||||
if form.get('initial_balance', False):
|
||||
if self.init_balance:
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
|
||||
# Add initial balance to the result
|
||||
sum_debit += self.cr.fetchone()[0] or 0.0
|
||||
return sum_debit
|
||||
|
@ -206,10 +209,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
|
||||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
if form.get('initial_balance', False):
|
||||
if self.init_balance:
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, form['initial_bal_query']))
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
|
||||
# Add initial balance to the result
|
||||
sum_credit += self.cr.fetchone()[0] or 0.0
|
||||
return sum_credit
|
||||
|
@ -219,10 +222,10 @@ class general_ledger(rml_parse.rml_parse, common_report_header):
|
|||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s"%(account.id, self.query))
|
||||
sum_balance = self.cr.fetchone()[0] or 0.0
|
||||
if form.get('initial_balance', False):
|
||||
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, form['initial_bal_query']))
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.init_query))
|
||||
# Add initial balance to the result
|
||||
sum_balance += self.cr.fetchone()[0] or 0.0
|
||||
return sum_balance
|
||||
|
|
|
@ -99,12 +99,12 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
def set_context(self, objects, data, ids, report_type=None):
|
||||
## Compute Code
|
||||
#
|
||||
self.initial_balance = data['form'].get('initial_balance', True)
|
||||
self.display_partner = data['form'].get('display_partner', 'non-zero_balance')
|
||||
# self.initial_balance = data['form'].get('initial_balance', True)
|
||||
self.display_partner = data['form'].get('display_partner', 'non-zero_balance')
|
||||
self.query = data['form'].get('query_line', '')
|
||||
self.init_query = data['form'].get('initial_bal_query', '')
|
||||
self.result_selection = data['form'].get('result_selection')
|
||||
|
||||
|
||||
if (self.result_selection == 'customer' ):
|
||||
self.ACCOUNT_TYPE = ('receivable',)
|
||||
elif (self.result_selection == 'supplier'):
|
||||
|
@ -150,81 +150,81 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
res = self.cr.dictfetchall()
|
||||
|
||||
#For include intial balance..
|
||||
if self.initial_balance:
|
||||
self.cr.execute(
|
||||
"SELECT '1' AS type, '' AS ref, l.account_id AS account_id, '' AS account_name, '' AS code, '' AS name, sum(debit) AS debit, sum(credit) AS credit, " \
|
||||
"CASE WHEN sum(debit) > sum(credit) " \
|
||||
"THEN sum(debit) - sum(credit) " \
|
||||
"ELSE 0 " \
|
||||
"END AS sdebit, " \
|
||||
"CASE WHEN sum(debit) < sum(credit) " \
|
||||
"THEN sum(credit) - sum(debit) " \
|
||||
"ELSE 0 " \
|
||||
"END AS scredit, " \
|
||||
"(SELECT sum(debit-credit) " \
|
||||
"FROM account_move_line l " \
|
||||
"WHERE partner_id = p.id " \
|
||||
" AND " + self.init_query + " " \
|
||||
"AND blocked = TRUE " \
|
||||
") AS enlitige " \
|
||||
"FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \
|
||||
"JOIN account_account ac ON (l.account_id = ac.id) " \
|
||||
"WHERE ac.type IN %s " \
|
||||
"AND " + self.init_query + "" \
|
||||
"GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \
|
||||
"ORDER BY l.account_id, p.name",
|
||||
(self.ACCOUNT_TYPE, ))
|
||||
res1 = self.cr.dictfetchall()
|
||||
final_init = {}
|
||||
res_init = {}
|
||||
debit = credit = 0
|
||||
for r in res1:
|
||||
if final_init.get(r['account_id'], False):
|
||||
res_init = final_init[r['account_id']]
|
||||
debit += final_init[r['account_id']]['debit']
|
||||
credit += final_init[r['account_id']]['credit']
|
||||
res_init['credit'] = credit
|
||||
res_init['debit'] = debit
|
||||
res_init['type'] = 3
|
||||
res_init['ref'] = ''
|
||||
res_init['code'] = ''
|
||||
res_init['name'] = 'Initial Balance'
|
||||
res_init['balance'] = debit - credit
|
||||
res_init['enlitige'] = 0.0 # fix me
|
||||
res_init['account_id'] = final_init[r['account_id']]['account_id']
|
||||
else:
|
||||
res_init = {}
|
||||
debit = r['debit']
|
||||
credit = r['credit']
|
||||
res_init['credit'] = credit
|
||||
res_init['debit'] = debit
|
||||
res_init['type'] = 3
|
||||
res_init['ref'] = ''
|
||||
res_init['code'] = ''
|
||||
res_init['name'] = 'Initial Balance'
|
||||
res_init['balance'] = debit - credit
|
||||
res_init['enlitige'] = 0.0 # fix me
|
||||
res_init['account_id'] = r['account_id']
|
||||
final_init[r['account_id']] = res_init
|
||||
|
||||
# if self.initial_balance:
|
||||
# self.cr.execute(
|
||||
# "SELECT '1' AS type, '' AS ref, l.account_id AS account_id, '' AS account_name, '' AS code, '' AS name, sum(debit) AS debit, sum(credit) AS credit, " \
|
||||
# "CASE WHEN sum(debit) > sum(credit) " \
|
||||
# "THEN sum(debit) - sum(credit) " \
|
||||
# "ELSE 0 " \
|
||||
# "END AS sdebit, " \
|
||||
# "CASE WHEN sum(debit) < sum(credit) " \
|
||||
# "THEN sum(credit) - sum(debit) " \
|
||||
# "ELSE 0 " \
|
||||
# "END AS scredit, " \
|
||||
# "(SELECT sum(debit-credit) " \
|
||||
# "FROM account_move_line l " \
|
||||
# "WHERE partner_id = p.id " \
|
||||
# " AND " + self.init_query + " " \
|
||||
# "AND blocked = TRUE " \
|
||||
# ") AS enlitige " \
|
||||
# "FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \
|
||||
# "JOIN account_account ac ON (l.account_id = ac.id) " \
|
||||
# "WHERE ac.type IN %s " \
|
||||
# "AND " + self.init_query + "" \
|
||||
# "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \
|
||||
# "ORDER BY l.account_id, p.name",
|
||||
# (self.ACCOUNT_TYPE, ))
|
||||
# res1 = self.cr.dictfetchall()
|
||||
# final_init = {}
|
||||
# res_init = {}
|
||||
# debit = credit = 0
|
||||
# for r in res1:
|
||||
# if final_init.get(r['account_id'], False):
|
||||
# res_init = final_init[r['account_id']]
|
||||
# debit += final_init[r['account_id']]['debit']
|
||||
# credit += final_init[r['account_id']]['credit']
|
||||
# res_init['credit'] = credit
|
||||
# res_init['debit'] = debit
|
||||
# res_init['type'] = 3
|
||||
# res_init['ref'] = ''
|
||||
# res_init['code'] = ''
|
||||
# res_init['name'] = 'Initial Balance'
|
||||
# res_init['balance'] = debit - credit
|
||||
# res_init['enlitige'] = 0.0 # fix me
|
||||
# res_init['account_id'] = final_init[r['account_id']]['account_id']
|
||||
# else:
|
||||
# res_init = {}
|
||||
# debit = r['debit']
|
||||
# credit = r['credit']
|
||||
# res_init['credit'] = credit
|
||||
# res_init['debit'] = debit
|
||||
# res_init['type'] = 3
|
||||
# res_init['ref'] = ''
|
||||
# res_init['code'] = ''
|
||||
# res_init['name'] = 'Initial Balance'
|
||||
# res_init['balance'] = debit - credit
|
||||
# res_init['enlitige'] = 0.0 # fix me
|
||||
# res_init['account_id'] = r['account_id']
|
||||
# final_init[r['account_id']] = res_init
|
||||
|
||||
if self.display_partner == 'non-zero_balance':
|
||||
full_account = [r for r in res if r['sdebit'] > 0 or r['scredit'] > 0]
|
||||
else:
|
||||
full_account = [r for r in res]
|
||||
|
||||
|
||||
## We will now compute Total
|
||||
subtotal_row = self._add_subtotal(full_account)
|
||||
if not self.initial_balance:
|
||||
return subtotal_row
|
||||
|
||||
#If include initial balance is selected..
|
||||
subtotal = copy.deepcopy(subtotal_row)
|
||||
init_acnt = []
|
||||
for row in subtotal_row:
|
||||
if final_init and row.get('account_id', False) and not row['account_id'] in init_acnt and final_init.get(row['account_id'], False):
|
||||
subtotal.insert(subtotal.index(row), final_init[row['account_id']])
|
||||
init_acnt.append(row['account_id'])
|
||||
return subtotal
|
||||
# if not self.initial_balance:
|
||||
# return subtotal_row
|
||||
#
|
||||
# #If include initial balance is selected..
|
||||
# subtotal = copy.deepcopy(subtotal_row)
|
||||
# init_acnt = []
|
||||
# for row in subtotal_row:
|
||||
# if final_init and row.get('account_id', False) and not row['account_id'] in init_acnt and final_init.get(row['account_id'], False):
|
||||
# subtotal.insert(subtotal.index(row), final_init[row['account_id']])
|
||||
# init_acnt.append(row['account_id'])
|
||||
return subtotal_row
|
||||
|
||||
def _add_subtotal(self, cleanarray):
|
||||
i = 0
|
||||
|
@ -354,14 +354,14 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
"AND " + self.query + "" ,
|
||||
(tuple(self.account_ids), ))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
if self.initial_balance:
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line AS l " \
|
||||
"WHERE l.account_id IN %s " \
|
||||
"AND " + self.init_query + "" ,
|
||||
(tuple(self.account_ids), ))
|
||||
temp_res += float(self.cr.fetchone()[0] or 0.0)
|
||||
# if self.initial_balance:
|
||||
# self.cr.execute(
|
||||
# "SELECT sum(debit) " \
|
||||
# "FROM account_move_line AS l " \
|
||||
# "WHERE l.account_id IN %s " \
|
||||
# "AND " + self.init_query + "" ,
|
||||
# (tuple(self.account_ids), ))
|
||||
# temp_res += float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
||||
def _sum_credit(self):
|
||||
|
@ -375,14 +375,14 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
"AND " + self.query + "" ,
|
||||
(tuple(self.account_ids),))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
if self.initial_balance:
|
||||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line AS l " \
|
||||
"WHERE l.account_id IN %s " \
|
||||
"AND " + self.init_query + "" ,
|
||||
(tuple(self.account_ids),))
|
||||
temp_res += float(self.cr.fetchone()[0] or 0.0)
|
||||
# if self.initial_balance:
|
||||
# self.cr.execute(
|
||||
# "SELECT sum(credit) " \
|
||||
# "FROM account_move_line AS l " \
|
||||
# "WHERE l.account_id IN %s " \
|
||||
# "AND " + self.init_query + "" ,
|
||||
# (tuple(self.account_ids),))
|
||||
# temp_res += float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
||||
def _sum_litige(self):
|
||||
|
@ -397,15 +397,15 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
"AND l.blocked=TRUE ",
|
||||
(tuple(self.account_ids), ))
|
||||
temp_res = float(self.cr.fetchone()[0] or 0.0)
|
||||
if self.initial_balance:
|
||||
self.cr.execute(
|
||||
"SELECT sum(debit-credit) " \
|
||||
"FROM account_move_line AS l " \
|
||||
"WHERE l.account_id IN %s " \
|
||||
"AND l.blocked=TRUE "\
|
||||
"AND " + self.init_query + "" ,
|
||||
(tuple(self.account_ids), ))
|
||||
temp_res += float(self.cr.fetchone()[0] or 0.0)
|
||||
# if self.initial_balance:
|
||||
# self.cr.execute(
|
||||
# "SELECT sum(debit-credit) " \
|
||||
# "FROM account_move_line AS l " \
|
||||
# "WHERE l.account_id IN %s " \
|
||||
# "AND l.blocked=TRUE "\
|
||||
# "AND " + self.init_query + "" ,
|
||||
# (tuple(self.account_ids), ))
|
||||
# temp_res += float(self.cr.fetchone()[0] or 0.0)
|
||||
return temp_res
|
||||
|
||||
def _sum_sdebit(self):
|
||||
|
|
|
@ -123,11 +123,12 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
|
|||
else:
|
||||
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
|
||||
self.cr.execute(
|
||||
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit,l.amount_currency,c.code AS currency_code " \
|
||||
"SELECT l.id,l.date,j.code, l.ref, m.name as move_name, l.name, l.debit, l.credit,l.amount_currency,c.code AS currency_code " \
|
||||
"FROM account_move_line l " \
|
||||
"LEFT JOIN account_journal j " \
|
||||
"ON (l.journal_id = j.id) " \
|
||||
"LEFT JOIN res_currency c on (l.currency_id=c.id)" \
|
||||
"LEFT JOIN account_move m on (m.id=l.move_id)" \
|
||||
"WHERE l.partner_id = %s " \
|
||||
"AND l.account_id IN %s AND " + self.query +" " \
|
||||
" " + RECONCILE_TAG + " "\
|
||||
|
@ -313,4 +314,4 @@ report_sxw.report_sxw('report.account.third_party_ledger_other', 'res.partner',
|
|||
'addons/account/report/account_partner_ledger_other.rml',parser=third_party_ledger,
|
||||
header='internal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -362,10 +362,10 @@
|
|||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
<para style="P3">[[ line['move_name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['name'] ]]</para>
|
||||
<para style="P3"><b>b</b>[[ (line['ref'] or '') + ' ' + line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang((line['debit'])) ]]</para>
|
||||
|
@ -487,10 +487,10 @@
|
|||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
<para style="P3">[[ line['move_name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['name'] ]]</para>
|
||||
<para style="P3"><b>a</b>[[ (line['ref'] or '') + ' ' + line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang((line['debit'])) ]]</para>
|
||||
|
|
|
@ -431,7 +431,7 @@
|
|||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="65.0,28.0,45.0,175.0,77.0,75.0,74.0" style="Table_header_1">[[ display_currency(data) == False or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="65.0,28.0,65.0,155.0,77.0,75.0,74.0" style="Table_header_1">[[ display_currency(data) == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Date</para>
|
||||
|
@ -508,7 +508,7 @@
|
|||
</blockTable>
|
||||
<section>
|
||||
<para style="P1">[[ repeatIn(lines(p), 'line') ]]</para>
|
||||
<blockTable colWidths="65.0,28.0,45.0,175.0,77.0,75.0,74.0" style="Table3">[[ display_currency(data) == False or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="65.0,28.0,65.0,155.0,77.0,75.0,74.0" style="Table3">[[ display_currency(data) == False or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3">[[ formatLang(line['date'],date=True) ]]</para>
|
||||
|
@ -517,10 +517,10 @@
|
|||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
<para style="P3">[[ line['move_name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['name'] ]]</para>
|
||||
<para style="P3">[[ (line['ref'] or '')+ ' ' + line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang((line['debit'])) ]]</para>
|
||||
|
@ -628,7 +628,7 @@
|
|||
</blockTable>
|
||||
<section>
|
||||
<para style="P1">[[ repeatIn(lines(p), 'line') ]]</para>
|
||||
<blockTable colWidths="57.0,25.0,40.0,154.0,67.0,66.0,65.0,65.0" style="Table7">[[ display_currency(data) == True or removeParentNode('blockTable') ]]
|
||||
<blockTable colWidths="57.0,25.0,60.0,134.0,67.0,66.0,65.0,65.0" style="Table7">[[ display_currency(data) == True or removeParentNode('blockTable') ]]
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3"> [[ formatLang(line['date'],date=True) ]]</para>
|
||||
|
@ -637,10 +637,10 @@
|
|||
<para style="P3">[[ line['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['ref'] ]]</para>
|
||||
<para style="P3">[[ line['move_name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['name'] ]]</para>
|
||||
<para style="P3">[[ (line['ref'] or '') + ' ' + line['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang((line['debit'])) ]]</para>
|
||||
|
@ -662,4 +662,4 @@
|
|||
</para>
|
||||
</section>
|
||||
</story>
|
||||
</document>
|
||||
</document>
|
||||
|
|
|
@ -198,3 +198,8 @@
|
|||
"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
|
||||
"access_product_category_analytic_accounting","product.category","product.model_product_category","analytic.group_analytic_accounting",1,0,0,0
|
||||
"access_product_template_analytic_accounting","product.template","product.model_product_template","analytic.group_analytic_accounting",1,0,0,0
|
||||
|
|
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
|
@ -29,16 +29,55 @@ class account_chart(osv.osv_memory):
|
|||
_name = "account.chart"
|
||||
_description = "Account chart"
|
||||
_columns = {
|
||||
'fiscalyear': fields.many2one('account.fiscalyear', \
|
||||
'fiscalyear': fields.many2one('account.fiscalyear', \
|
||||
'Fiscal year', \
|
||||
help = 'Keep empty for all open fiscal years'),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
'period_from': fields.many2one('account.period', 'Start period'),
|
||||
'period_to': fields.many2one('account.period', 'End period'),
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required = True),
|
||||
}
|
||||
|
||||
def _get_fiscalyear(self, cr, uid, context=None):
|
||||
"""Return default Fiscalyear value"""
|
||||
return self.pool.get('account.fiscalyear').find(cr, uid)
|
||||
now = time.strftime('%Y-%m-%d')
|
||||
fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now)], limit=1 )
|
||||
return fiscalyears and fiscalyears[0] or False
|
||||
|
||||
def _build_periods(self, cr, uid, period_from, period_to):
|
||||
period_obj = self.pool.get('account.period')
|
||||
period_date_start = period_obj.read(cr, uid, period_from, ['date_start'])['date_start']
|
||||
period_date_stop = period_obj.read(cr, uid, period_to, ['date_stop'])['date_stop']
|
||||
if period_date_start > period_date_stop:
|
||||
raise osv.except_osv(_('Error'),_('Start period should be smaller then End period'))
|
||||
return period_obj.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop)])
|
||||
|
||||
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
|
||||
res = {}
|
||||
res['value'] = {'period_from': False, 'period_to': False}
|
||||
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
|
||||
ORDER BY p.date_start ASC
|
||||
LIMIT 1) AS period_start
|
||||
UNION
|
||||
SELECT * FROM (SELECT p.id
|
||||
FROM account_period p
|
||||
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
|
||||
WHERE f.id = %s
|
||||
AND p.date_start < NOW()
|
||||
ORDER BY p.date_stop DESC
|
||||
LIMIT 1) AS period_stop''', (fiscalyear_id, fiscalyear_id))
|
||||
periods = [i[0] for i in cr.fetchall()]
|
||||
if periods and len(periods) > 1:
|
||||
start_period = periods[0]
|
||||
end_period = periods[1]
|
||||
res['value'] = {'period_from': start_period, 'period_to': end_period}
|
||||
return res
|
||||
|
||||
def account_chart_open_window(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
|
@ -56,7 +95,10 @@ class account_chart(osv.osv_memory):
|
|||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['context'] = str({'fiscalyear': data['fiscalyear'], \
|
||||
result['periods'] = []
|
||||
if data['period_from'] and data['period_to']:
|
||||
result['periods'] = self._build_periods(cr, uid, data['period_from'], data['period_to'])
|
||||
result['context'] = str({'fiscalyear': data['fiscalyear'], 'periods': result['periods'], \
|
||||
'state': data['target_move']})
|
||||
if data['fiscalyear']:
|
||||
result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']], context=context)[0]['code']
|
||||
|
|
|
@ -7,16 +7,18 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Account charts">
|
||||
<group colspan="4" >
|
||||
<field name="fiscalyear"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
|
||||
<group colspan="4">
|
||||
<field name="fiscalyear" on_change="onchange_fiscalyear(fiscalyear)"/>
|
||||
<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"/>
|
||||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<separator string="" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel" />
|
||||
<button icon="terp-gtk-go-back-rtl" string="Open Charts" name="account_chart_open_window" type="object" />
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Open Charts" name="account_chart_open_window" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
@ -21,15 +21,21 @@
|
|||
|
||||
from lxml import etree
|
||||
|
||||
from osv import osv
|
||||
from osv import osv, fields
|
||||
|
||||
class account_balance_report(osv.osv_memory):
|
||||
_inherit = "account.common.account.report"
|
||||
_name = 'account.balance.report'
|
||||
_description = 'Account Balance Report'
|
||||
|
||||
_columns = {
|
||||
'target_move': fields.selection([('all', 'All Entries'),
|
||||
('posted', 'All Posted Entries')], 'Target Moves', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'journal_ids': [],
|
||||
'target_move': 'all'
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
|
@ -45,6 +51,7 @@ class account_balance_report(osv.osv_memory):
|
|||
|
||||
def _print_report(self, cr, uid, ids, data, query_line, context=None):
|
||||
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
|
||||
data['form'].update(self.read(cr, uid, ids, ['target_move'])[0])
|
||||
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data}
|
||||
|
||||
account_balance_report()
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<field name="fiscalyear_id" position="after">
|
||||
<field name="display_account"/>
|
||||
<field name="target_move"/>
|
||||
<newline/>
|
||||
</field>
|
||||
</field>
|
||||
|
|
|
@ -77,7 +77,7 @@ class account_aged_trial_balance(osv.osv_memory):
|
|||
res[str(i)] = {
|
||||
'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 None),
|
||||
'start': (i!=0 and stop.strftime('%Y-%m-%d') or False),
|
||||
}
|
||||
start = stop - RelativeDateTime(days=1)
|
||||
else:
|
||||
|
@ -86,7 +86,7 @@ class account_aged_trial_balance(osv.osv_memory):
|
|||
res[str(5-(i+1))] = {
|
||||
'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 None),
|
||||
'stop': (i!=4 and stop.strftime('%Y-%m-%d') or False),
|
||||
}
|
||||
start = stop + RelativeDateTime(days=1)
|
||||
data['form'].update(res)
|
||||
|
|
|
@ -47,10 +47,9 @@ class account_bs_report(osv.osv_memory):
|
|||
mod_obj = self.pool.get('ir.model.data')
|
||||
res = super(account_bs_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
nodes = doc.xpath("//page[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
node.set('invisible', '1')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
|
@ -78,4 +77,4 @@ class account_bs_report(osv.osv_memory):
|
|||
|
||||
account_bs_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -8,35 +8,27 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Report Options">
|
||||
<group colspan="4" expand="1">
|
||||
<field name="chart_account_id" widget='selection'/>
|
||||
<field name="fiscalyear_id"/>
|
||||
<group colspan="2" name='Journals'>
|
||||
<notebook tabpos="up">
|
||||
<page string="Journals" >
|
||||
<notebook tabpos="up" colspan="4">
|
||||
<page string="Filters" name="filters">
|
||||
<field name="filter" on_change="onchange_filter(filter, fiscalyear_id)" colspan="4"/>
|
||||
<separator string="Dates" colspan="4"/>
|
||||
<field name="date_from" attrs="{'readonly':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}" colspan="4"/>
|
||||
<field name="date_to" attrs="{'readonly':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}" colspan="4"/>
|
||||
<separator string="Periods" colspan="4"/>
|
||||
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" colspan="4"/>
|
||||
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" colspan="4"/>
|
||||
</page>
|
||||
<page string="Journals" name="journal_ids">
|
||||
<field name="journal_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</group>
|
||||
<group colspan="2" name='Filters'>
|
||||
<notebook tabpos="up">
|
||||
<page string="Filters">
|
||||
<field name="filter" on_change="onchange_filter(filter, fiscalyear_id)" />
|
||||
<separator string="Dates" colspan="4"/>
|
||||
<field name="date_from" attrs="{'readonly':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}" colspan="4"/>
|
||||
<field name="date_to" attrs="{'readonly':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}" colspan="4"/>
|
||||
<separator string="Periods" colspan="4"/>
|
||||
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" colspan="4"/>
|
||||
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel" colspan="2"/>
|
||||
<button icon="gtk-print" name="check_report" string="Print" type="object" colspan="2" default_focus="1" />
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -37,7 +37,7 @@ class account_report_general_ledger(osv.osv_memory):
|
|||
'landscape': True,
|
||||
'amount_currency': True,
|
||||
'sortby': 'sort_date',
|
||||
'initial_balance': True,
|
||||
'initial_balance': False,
|
||||
}
|
||||
|
||||
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, context=None):
|
||||
|
|
|
@ -29,13 +29,13 @@ class account_partner_balance(osv.osv_memory):
|
|||
_name = 'account.partner.balance'
|
||||
_description = 'Print Account Partner Balance'
|
||||
_columns = {
|
||||
'initial_balance': fields.boolean('Include Initial Balances'
|
||||
,help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
|
||||
# 'initial_balance': fields.boolean('Include Initial Balances'
|
||||
# ,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')
|
||||
}
|
||||
_defaults = {
|
||||
'initial_balance': True,
|
||||
# 'initial_balance': True,
|
||||
'display_partner': 'non-zero_balance'
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class account_partner_balance(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, ['initial_balance', 'display_partner'])[0])
|
||||
data['form'].update(self.read(cr, uid, ids, ['display_partner'])[0])
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<field name="fiscalyear_id" position="after">
|
||||
<field name="result_selection"/>
|
||||
<field name="initial_balance"/>
|
||||
<!-- <field name="initial_balance"/> -->
|
||||
<field name="display_partner"/>
|
||||
<newline/>
|
||||
</field>
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
"voucher_sequence.xml",
|
||||
"voucher_workflow.xml",
|
||||
"voucher_report.xml",
|
||||
"wizard/account_voucher_open_view.xml",
|
||||
"wizard/account_voucher_unreconcile_view.xml",
|
||||
"voucher_view.xml",
|
||||
"voucher_payment_receipt_view.xml",
|
||||
|
@ -53,7 +52,6 @@
|
|||
"test/sales_receipt.yml",
|
||||
"test/sales_payment.yml",
|
||||
],
|
||||
|
||||
'certificate': '0037580727101',
|
||||
"active": False,
|
||||
"installable": True,
|
||||
|
|
|
@ -54,7 +54,7 @@ class report_voucher(report_sxw.rml_parse):
|
|||
voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)])
|
||||
if voucher_line:
|
||||
voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0]
|
||||
return voucher.ref
|
||||
return voucher.name
|
||||
else:
|
||||
return
|
||||
report_sxw.report_sxw(
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
<images/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P8">[[ repeatIn(objects,'voucher') ]]</para>
|
||||
<para style="P8">[[ repeatIn(objects,'voucher') ]]</para>ref
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
@ -167,7 +167,7 @@
|
|||
<para style="terp_tblheader_Details">Journal:</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ voucher.type ]]</para>
|
||||
<para style="terp_default_9">[[ voucher.journal_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Number:</para>
|
||||
|
@ -252,7 +252,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]</para>
|
||||
<para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ voucher.reference or '' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9_50">
|
||||
|
|
|
@ -122,7 +122,7 @@ class account_voucher(osv.osv):
|
|||
\n* The \'Cancelled\' state is used when user cancel voucher.'),
|
||||
'amount': fields.float('Total', digits=(16, 2), required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'tax_amount':fields.float('Tax Amount', digits=(14,2), readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction referance number."),
|
||||
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
|
||||
'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
|
||||
'move_id':fields.many2one('account.move', 'Account Entry'),
|
||||
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Journal Items', readonly=True),
|
||||
|
@ -134,8 +134,7 @@ class account_voucher(osv.osv):
|
|||
],'Payment', select=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'pre_line':fields.boolean('Previous Payments ?', required=False),
|
||||
'date_due': fields.date('Due Date'),
|
||||
# 'term_id':fields.many2one('account.payment.term', 'Term', required=False),
|
||||
'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
}
|
||||
_defaults = {
|
||||
'period_id': _get_period,
|
||||
|
@ -166,6 +165,7 @@ class account_voucher(osv.osv):
|
|||
voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
|
||||
|
||||
if not voucher.tax_id:
|
||||
self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
|
||||
continue
|
||||
|
||||
tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)]
|
||||
|
@ -177,7 +177,7 @@ class account_voucher(osv.osv):
|
|||
total_tax = 0.0
|
||||
|
||||
if not tax[0].price_include:
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes'):
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]):
|
||||
total_tax += tax_line.get('amount')
|
||||
total += total_tax
|
||||
else:
|
||||
|
@ -186,7 +186,7 @@ class account_voucher(osv.osv):
|
|||
line_total = 0.0
|
||||
line_tax = 0.0
|
||||
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes'):
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]):
|
||||
line_tax += tax_line.get('amount')
|
||||
line_total += tax_line.get('price_unit')
|
||||
total_tax += line_tax
|
||||
|
@ -196,7 +196,6 @@ class account_voucher(osv.osv):
|
|||
self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
|
||||
return True
|
||||
|
||||
# TODO: review this code.
|
||||
def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context={}):
|
||||
tax_pool = self.pool.get('account.tax')
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
|
@ -215,17 +214,26 @@ class account_voucher(osv.osv):
|
|||
|
||||
for line in line_ids:
|
||||
line_amount = 0.0
|
||||
if line[1]:
|
||||
line_amount = voucher_line_pool.browse(cr, uid, line[1]).untax_amount
|
||||
else:
|
||||
line_amount = line[2].get('amount')
|
||||
line_amount = line[2].get('amount')
|
||||
voucher_line_ids += [line[1]]
|
||||
voucher_total += line_amount
|
||||
|
||||
total = voucher_total
|
||||
total_tax = 0.0
|
||||
if tax_id:
|
||||
tax = [tax_pool.browse(cr, uid, tax_id)]
|
||||
if partner_id:
|
||||
partner = partner_pool.browse(cr, uid, partner_id) or False
|
||||
taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
|
||||
tax = tax_pool.browse(cr, uid, taxes)
|
||||
|
||||
if not tax[0].price_include:
|
||||
for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]):
|
||||
total_tax += tax_line.get('amount')
|
||||
total += total_tax
|
||||
|
||||
res.update({
|
||||
'amount':total,
|
||||
'amount':total or voucher_total,
|
||||
'tax_amount':total_tax
|
||||
})
|
||||
return {
|
||||
|
@ -246,6 +254,44 @@ class account_voucher(osv.osv):
|
|||
})
|
||||
return {'value':default}
|
||||
|
||||
def onchange_journal_voucher(self, cr, uid, ids, partner_id=False, journal_id=False, context={}):
|
||||
"""price
|
||||
Returns a dict that contains new values and context
|
||||
|
||||
@param partner_id: latest value from user input for field partner_id
|
||||
@param args: other arguments
|
||||
@param context: context arguments, like lang, time zone
|
||||
|
||||
@return: Returns a dict which contains new values, and context
|
||||
"""
|
||||
default = {
|
||||
'value':{},
|
||||
}
|
||||
|
||||
if not partner_id or not journal_id:
|
||||
return default
|
||||
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
||||
journal = journal_pool.browse(cr, uid, journal_id)
|
||||
partner = partner_pool.browse(cr, uid, partner_id)
|
||||
account_id = False
|
||||
tr_type = False
|
||||
if journal.type in ('sale','sale_refund'):
|
||||
account_id = partner.property_account_receivable.id
|
||||
tr_type = 'sale'
|
||||
elif journal.type in ('purchase', 'purchase_refund','expense'):
|
||||
account_id = partner.property_account_payable.id
|
||||
tr_type = 'purchase'
|
||||
else:
|
||||
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
|
||||
tr_type = 'receipt'
|
||||
|
||||
default['value']['account_id'] = account_id
|
||||
default['value']['type'] = tr_type
|
||||
return default
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, currency_id=False, ttype=False, context={}):
|
||||
"""price
|
||||
Returns a dict that contains new values and context
|
||||
|
@ -281,17 +327,14 @@ class account_voucher(osv.osv):
|
|||
journal = journal_pool.browse(cr, uid, journal_id)
|
||||
partner = partner_pool.browse(cr, uid, partner_id)
|
||||
account_id = False
|
||||
term_id = False
|
||||
if journal.type in ('sale','sale_refund'):
|
||||
account_id = partner.property_account_receivable.id
|
||||
elif journal.type in ('purchase', 'purchase_refund','expense'):
|
||||
account_id = partner.property_account_payable.id
|
||||
else:
|
||||
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
|
||||
default['value'].update({
|
||||
'account_id':account_id,
|
||||
'term_id':term_id
|
||||
})
|
||||
|
||||
default['value']['account_id'] = account_id
|
||||
if journal.type not in ('cash', 'bank'):
|
||||
return default
|
||||
|
||||
|
@ -314,17 +357,22 @@ class account_voucher(osv.osv):
|
|||
total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit)
|
||||
elif company_currency != currency_id and ttype == 'receipt':
|
||||
total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit)
|
||||
|
||||
|
||||
for line in moves:
|
||||
if line.credit and line.reconcile_partial_id:
|
||||
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
|
||||
continue
|
||||
if line.debit and line.reconcile_partial_id and ttype == 'payment':
|
||||
continue
|
||||
|
||||
total_credit += line.credit or 0.0
|
||||
total_debit += line.debit or 0.0
|
||||
|
||||
for line in moves:
|
||||
if line.credit and line.reconcile_partial_id:
|
||||
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
|
||||
continue
|
||||
if line.debit and line.reconcile_partial_id and ttype == 'payment':
|
||||
continue
|
||||
|
||||
rs = {
|
||||
'name':line.move_id.name,
|
||||
'type': line.credit and 'dr' or 'cr',
|
||||
|
@ -354,7 +402,6 @@ class account_voucher(osv.osv):
|
|||
default['value']['pre_line'] = 1
|
||||
elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
|
||||
default['value']['pre_line'] = 1
|
||||
|
||||
return default
|
||||
|
||||
def onchange_date(self, cr, user, ids, date, context={}):
|
||||
|
@ -374,7 +421,7 @@ class account_voucher(osv.osv):
|
|||
}
|
||||
}
|
||||
|
||||
def onchange_journal(self, cr, uid, ids, journal_id):
|
||||
def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context={}):
|
||||
if not journal_id:
|
||||
return False
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
@ -383,8 +430,10 @@ class account_voucher(osv.osv):
|
|||
tax_id = False
|
||||
if account_id and account_id.tax_ids:
|
||||
tax_id = account_id.tax_ids[0].id
|
||||
|
||||
return {'value':{'tax_id':tax_id}}
|
||||
|
||||
vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
|
||||
vals['value'].update({'tax_id':tax_id})
|
||||
return vals
|
||||
|
||||
def proforma_voucher(self, cr, uid, ids):
|
||||
self.action_move_line_create(cr, uid, ids)
|
||||
|
@ -428,7 +477,7 @@ class account_voucher(osv.osv):
|
|||
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
|
||||
return super(account_voucher, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
# TODO
|
||||
# TODO: may be we can remove this method if not used anyware
|
||||
def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
|
||||
res = {}
|
||||
if not partner_id:
|
||||
|
@ -500,7 +549,7 @@ class account_voucher(osv.osv):
|
|||
if credit < 0:
|
||||
debit = -credit
|
||||
credit = 0.0
|
||||
|
||||
|
||||
move_line = {
|
||||
'name':inv.name or '/',
|
||||
'debit':debit,
|
||||
|
@ -514,7 +563,9 @@ class account_voucher(osv.osv):
|
|||
'date':inv.date,
|
||||
'date_maturity':inv.date_due
|
||||
}
|
||||
master_line = move_line_pool.create(cr, uid, move_line)
|
||||
|
||||
if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
|
||||
master_line = move_line_pool.create(cr, uid, move_line)
|
||||
|
||||
rec_list_ids = []
|
||||
line_total = debit - credit
|
||||
|
@ -528,6 +579,7 @@ class account_voucher(osv.osv):
|
|||
if not line.amount:
|
||||
continue
|
||||
amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
|
||||
|
||||
move_line = {
|
||||
'journal_id':inv.journal_id.id,
|
||||
'period_id':inv.period_id.id,
|
||||
|
@ -536,6 +588,7 @@ class account_voucher(osv.osv):
|
|||
'move_id':move_id,
|
||||
'partner_id':inv.partner_id.id,
|
||||
'currency_id':inv.currency_id.id,
|
||||
'amount_currency':line.amount,
|
||||
'analytic_account_id':line.account_analytic_id and line.account_analytic_id.id or False,
|
||||
'quantity':1,
|
||||
'credit':0.0,
|
||||
|
@ -556,11 +609,10 @@ class account_voucher(osv.osv):
|
|||
line_total -= amount
|
||||
move_line['credit'] = amount
|
||||
|
||||
if inv.tax_id:
|
||||
if inv.tax_id and inv.type in ('sale', 'purchase'):
|
||||
move_line.update({
|
||||
'account_tax_id':inv.tax_id.id,
|
||||
})
|
||||
|
||||
master_line = move_line_pool.create(cr, uid, move_line)
|
||||
if line.move_line_id.id:
|
||||
rec_ids = [master_line, line.move_line_id.id]
|
||||
|
@ -578,7 +630,8 @@ class account_voucher(osv.osv):
|
|||
'debit':diff<0 and -diff or 0.0,
|
||||
}
|
||||
account_id = False
|
||||
if inv.journal_id.type in ('sale','sale_refund', 'cash','bank'):
|
||||
if inv.type in ('sale', 'receipt'):
|
||||
# if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'):
|
||||
account_id = inv.partner_id.property_account_receivable.id
|
||||
else:
|
||||
account_id = inv.partner_id.property_account_payable.id
|
||||
|
@ -589,7 +642,7 @@ class account_voucher(osv.osv):
|
|||
'move_id': move_id,
|
||||
'state':'posted'
|
||||
})
|
||||
move_pool.post(cr, uid, [move_id], context={})
|
||||
#move_pool.post(cr, uid, [move_id], context={})
|
||||
for rec_ids in rec_list_ids:
|
||||
if len(rec_ids) >= 2:
|
||||
move_line_pool.reconcile_partial(cr, uid, rec_ids)
|
||||
|
@ -608,49 +661,6 @@ class account_voucher(osv.osv):
|
|||
default['date'] = time.strftime('%Y-%m-%d')
|
||||
return super(account_voucher, self).copy(cr, uid, id, default, context)
|
||||
|
||||
# TODO
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
"""
|
||||
Returns views and fields for current model where view will depend on {view_type}.
|
||||
@param view_id: list of fields, which required to read signatures
|
||||
@param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
|
||||
@param context: context arguments, like lang, time zone
|
||||
@param toolbar: contains a list of reports, wizards, and links related to current model
|
||||
|
||||
@return: Returns a dict that contains definition for fields, views, and toolbars
|
||||
"""
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
voucher_type = {
|
||||
'sale':'view_sale_receipt_form',
|
||||
'purchase':'view_purchase_receipt_form',
|
||||
'payment':'view_vendor_payment_form',
|
||||
'receipt':'view_vendor_receipt_form'
|
||||
}
|
||||
if view_type == 'form':
|
||||
tview = voucher_type.get(context.get('type'))
|
||||
tview = tview or 'view_voucher_form'
|
||||
result = data_pool._get_id(cr, uid, 'account_voucher', tview)
|
||||
view_id = data_pool.browse(cr, uid, result, context=context).res_id
|
||||
|
||||
res = super(account_voucher, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
|
||||
|
||||
#Restrict the list of journal view in search view
|
||||
if view_type == 'search':
|
||||
type_search = {
|
||||
'bank':[('type','in',['bank','cash'])],
|
||||
'cash':[('type','in',['bank','cash'])],
|
||||
'sale':[('type','in',['sale','purchase_refund'])],
|
||||
'purchase':[('type','in',['purchase','sale_refund'])],
|
||||
'expense':[('type','in',['purchase'])],
|
||||
'sale_refund':[('type','in',['sale','purchase_refund'])],
|
||||
'purchase_refund':[('type','in',['purchase','sale_refund'])]
|
||||
}
|
||||
domain = type_search.get(context.get('journal_type'))
|
||||
journal_list = journal_pool.name_search(cr, uid, '', domain)
|
||||
res['fields']['journal_id']['selection'] = journal_list
|
||||
return res
|
||||
|
||||
account_voucher()
|
||||
|
||||
class account_voucher_line(osv.osv):
|
||||
|
@ -737,9 +747,10 @@ class account_voucher_line(osv.osv):
|
|||
journal = journal_pool.browse(cr, user, journal_id)
|
||||
account_id = False
|
||||
ttype = 'cr'
|
||||
if journal.type in ('sale', 'purchase_refund'):
|
||||
if journal.type in ('sale', 'sale_refund'):
|
||||
account_id = journal.default_credit_account_id and journal.default_credit_account_id.id or False
|
||||
elif journal.type in ('purchase', 'expense', 'sale_refund'):
|
||||
ttype = 'cr'
|
||||
elif journal.type in ('purchase', 'expense', 'purchase_refund'):
|
||||
account_id = journal.default_debit_account_id and journal.default_debit_account_id.id or False
|
||||
ttype = 'dr'
|
||||
elif partner_id:
|
||||
|
|
|
@ -1,6 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_voucher_filter_customer_pay" model="ir.ui.view">
|
||||
<field name="name">account.voucher.customer.pay.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Customer"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_voucher_filter_vendor_pay" model="ir.ui.view">
|
||||
<field name="name">account.voucher.purchase.pay.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_vendor_payment_form">
|
||||
<field name="name">account.voucher.payment.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
|
@ -18,9 +98,7 @@
|
|||
<field name="reference" select="1" string="Payment Ref"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="account_id"
|
||||
domain="[('type','=','other')]"
|
||||
widget="selection"
|
||||
on_change="onchange_account(account_id)"
|
||||
invisible="True"/>
|
||||
<field name="pre_line" invisible="1"/>
|
||||
<field name="type" invisible="True"/>
|
||||
|
@ -28,7 +106,7 @@
|
|||
<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="Payment Lines" editable="bottom">
|
||||
<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)]"
|
||||
|
@ -87,13 +165,27 @@
|
|||
|
||||
<record id="action_vendor_payment" model="ir.actions.act_window">
|
||||
<field name="name">Vendor Payment</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'payment'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'type':'payment'}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter_vendor_pay"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_vendor_payment_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_vendor_payment"/>
|
||||
</record>
|
||||
<record id="action_vendor_payment_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_vendor_payment_form"/>
|
||||
<field name="act_window_id" ref="action_vendor_payment"/>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
|
||||
id="menu_action_vendor_payment" parent="account.menu_finance_payables"/>
|
||||
|
||||
|
@ -115,9 +207,7 @@
|
|||
<field name="reference" select="1" string="Payment Ref"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="account_id"
|
||||
domain="[('type','=','other')]"
|
||||
widget="selection"
|
||||
on_change="onchange_account(account_id)"
|
||||
invisible="True"/>
|
||||
<field name="pre_line" invisible="1"/>
|
||||
<field name="type" invisible="True"/>
|
||||
|
@ -181,13 +271,26 @@
|
|||
|
||||
<record id="action_vendor_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Sales Payment</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'receipt'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'type':'receipt'}</field>
|
||||
<field name="search_view_id" ref="view_voucher_filter_customer_pay"/>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_vendor_receipt_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_vendor_receipt"/>
|
||||
</record>
|
||||
<record id="action_vendor_receipt_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_vendor_receipt_form"/>
|
||||
<field name="act_window_id" ref="action_vendor_receipt"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
|
||||
id="menu_action_vendor_receipt" parent="account.menu_finance_receivables"/>
|
||||
</data>
|
||||
|
|
|
@ -1,16 +1,96 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_voucher_filter_vendor" model="ir.ui.view">
|
||||
<field name="name">account.voucher.purchase.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_voucher_filter_sale" model="ir.ui.view">
|
||||
<field name="name">account.voucher.sale.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id" string="Customer"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
|
||||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="act_pay_voucher" model="ir.actions.act_window">
|
||||
<field name="name">Sales Payment</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt'), ('partner_id','=',partner_id)]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id}</field>
|
||||
<field name="context">{'type':'receipt', 'partner_id': partner_id, 'default_reference':reference}</field>
|
||||
<field name="view_id" ref="view_vendor_receipt_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_receipt_form">
|
||||
<field name="name">account.voucher.sale.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
|
@ -19,7 +99,7 @@
|
|||
<form string="Sales Receipt">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id)" string="Customer"/>
|
||||
<field name="journal_id" domain="[('type','in',['sale','purchase_refund'])]" widget="selection" on_change="onchange_journal(journal_id)"/>
|
||||
<field name="journal_id" domain="[('type','in',['sale','sale_refund'])]" widget="selection" on_change="onchange_journal(journal_id, line_cr_ids, tax_id, partner_id)"/>
|
||||
<field name="number"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="date" on_change="onchange_date(date)"/>
|
||||
|
@ -50,10 +130,11 @@
|
|||
<field name="reference"
|
||||
attrs="{'invisible':[('pay_now','!=','pay_now')]}"
|
||||
/>
|
||||
<field name="date_due" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
|
||||
</group>
|
||||
<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" on_change="onchange_price(line_ids, tax_id, partner_id)" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
|
||||
<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 colspan="1" string=""/><field name="amount" string="Total"/>
|
||||
</group>
|
||||
</group>
|
||||
|
@ -73,7 +154,7 @@
|
|||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
|
||||
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_voucher)d" context="{'title':'Sales Payment', 'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id}" type="action" string="Pay" attrs="{'invisible':[('pay_now','!=','pay_now'),('state','!=','posted')]}"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_voucher)d" context="{'title':'Sales Payment', 'type':'receipt', 'partner_id': partner_id}" type="action" string="Pay" attrs="{'invisible':[('pay_now','!=','pay_now'),('state','!=','posted')]}"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
</group>
|
||||
</form>
|
||||
|
@ -83,23 +164,38 @@
|
|||
<!-- Sales Voucher -->
|
||||
<record id="action_sale_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Sales Receipt</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type','in',['sale','purchase_refund']), ('type','=','sale')]</field>
|
||||
<field name="context">{'journal_type':'sale', 'type':'sale'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="domain">[('journal_id.type','in',['sale','sale_refund']), ('type','=','sale')]</field>
|
||||
<field name="context">{'type':'sale'}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter_sale"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_sale_receipt_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_sale_receipt"/>
|
||||
</record>
|
||||
<record id="action_sale_receipt_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_sale_receipt_form"/>
|
||||
<field name="act_window_id" ref="action_sale_receipt"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_action_sale_receipt" icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_sale_receipt" parent="account.menu_finance_receivables" sequence="10"/>
|
||||
|
||||
action="action_sale_receipt"
|
||||
parent="account.menu_finance_receivables"
|
||||
sequence="10"/>
|
||||
|
||||
<!-- Purchase Vouchers -->
|
||||
<record id="act_pay_bills" model="ir.actions.act_window">
|
||||
<field name="name">Bill Payment</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment'), ('partner_id','=',partner_id)]</field>
|
||||
<field name="context">{'journal_type':'bank', 'type':'payment', 'partner_id': partner_id}</field>
|
||||
<field name="context">{'type':'payment', 'partner_id': partner_id, 'default_reference':reference}</field>
|
||||
<field name="view_id" ref="view_vendor_payment_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
@ -111,10 +207,10 @@
|
|||
<form string="Vendor Bills">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" string="Vendor" on_change="onchange_partner_id(partner_id, journal_id, amount)"/>
|
||||
<field name="journal_id" domain="[('type','in',['purchase','sale_refund'])]" widget="selection" select="1" on_change="onchange_journal(journal_id)"/>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="journal_id" domain="[('type','in',['purchase','purchase_refund'])]" widget="selection" select="1" on_change="onchange_journal(journal_id, line_dr_ids, tax_id, partner_id)"/>
|
||||
<field name="number"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="account_id" domain="[('type','=','other')]" invisible="True"/>
|
||||
<field name="type" invisible="True"/>
|
||||
</group>
|
||||
|
@ -137,11 +233,10 @@
|
|||
<separator string="Payment Terms" colspan="2"/>
|
||||
<field name="date" string="Bill Date" select="1" on_change="onchange_date(date)"/>
|
||||
<field name="date_due"/>
|
||||
<field name="amount" required="0" string="Amount Due"/>
|
||||
</group>
|
||||
<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" on_change="onchange_price(line_ids, tax_id, partner_id)" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
|
||||
<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 colspan="1" string=""/><field name="amount" string="Total"/>
|
||||
</group>
|
||||
</group>
|
||||
|
@ -161,7 +256,7 @@
|
|||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
|
||||
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_bills)d" context="{'title':'Bill Payment', 'journal_type':'bank', 'type':'payment', 'partner_id': partner_id}" type="action" string="Pay Bill" attrs="{'invisible':[('state','!=','posted')]}"/>
|
||||
<button icon="terp-dolar_ok!" name="%(act_pay_bills)d" context="{'title':'Bill Payment', 'type':'payment', 'partner_id': partner_id}" type="action" string="Pay Bill" attrs="{'invisible':[('state','!=','posted')]}"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
</group>
|
||||
</form>
|
||||
|
@ -169,13 +264,26 @@
|
|||
</record>
|
||||
<record id="action_purchase_receipt" model="ir.actions.act_window">
|
||||
<field name="name">Vendor Bills</field>
|
||||
<field name="res_model">account.voucher.open</field>
|
||||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('journal_id.type','in',['purchase','sale_refund']), ('type','=','purchase')]</field>
|
||||
<field name="context">{'journal_type':'purchase', 'type':'purchase'}</field>
|
||||
<field name="view_id" ref="account_open_vouchers_view"/>
|
||||
<field name="target">new</field>
|
||||
<field name="domain">[('journal_id.type','in',['purchase','purchase_refund']), ('type','=','purchase')]</field>
|
||||
<field name="context">{'type':'purchase'}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" eval="view_voucher_filter_vendor"/>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
<record id="action_purchase_receipt_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_purchase_receipt"/>
|
||||
</record>
|
||||
<record id="action_purchase_receipt_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_purchase_receipt_form"/>
|
||||
<field name="act_window_id" ref="action_purchase_receipt"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_voucher_form">
|
||||
<field name="name">account.voucher.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
|
@ -28,22 +28,22 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Accounting Voucher">
|
||||
<group col="6" colspan="4">
|
||||
<field name="partner_id" required="1" on_change="onchange_journal_voucher(partner_id, journal_id)"/>
|
||||
<field name="journal_id" widget="selection" select="1" on_change="onchange_journal_voucher(partner_id, journal_id)"/>
|
||||
<field name="type" required="1"/>
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id)"/>
|
||||
<field name="type" on_change="onchange_partner_id(partner_id, journal_id)"/>
|
||||
<field name="journal_id" widget="selection" select="1" on_change="onchange_partner_id(partner_id, journal_id)"/>
|
||||
<field name="account_id" widget="selection" invisible="True"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Voucher Entry">
|
||||
<field name="line_ids" on_change="onchange_price(line_ids, False, partner_id)" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
|
||||
<tree string="Voucher Lines" editable="top">
|
||||
<field name="line_ids" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
|
||||
<tree string="Voucher Items" editable="bottom">
|
||||
<field name="account_id"/>
|
||||
<field name="name"/>
|
||||
<field name="amount"/>
|
||||
<field name="amount" sum="Total Amount"/>
|
||||
<field name="type"/>
|
||||
<field name="account_analytic_id" domain="[('parent_id','!=',False)]"/>
|
||||
<field name="account_analytic_id" groups="base.group_extended"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group col="2" colspan="3">
|
||||
|
@ -51,16 +51,22 @@
|
|||
<field name="narration" colspan="2" nolabel="1"/>
|
||||
</group>
|
||||
<group col="2" colspan="1">
|
||||
<separator string="Other Information" colspan="2"/>
|
||||
<field name="amount" string="Total"/>
|
||||
<field name="number"/>
|
||||
<field name="date" select="1" on_change="onchange_date(date)"/>
|
||||
<field name="currency_id" select="1" attrs="{'readonly':[('type','in',['sale', 'purchase'])]}"/>
|
||||
<group col="2" colspan="1" >
|
||||
<separator string="Other Information" colspan="2"/>
|
||||
<field name="number"/>
|
||||
<field name="date" on_change="onchange_date(date)"/>
|
||||
<field name="currency_id" attrs="{'readonly':[('type','in',['sale', 'purchase'])]}"/>
|
||||
</group>
|
||||
<group col="4" colspan="1" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
|
||||
<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 colspan="1" string=""/><field name="amount" string="Total"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
|
||||
<group col="6" colspan="4">
|
||||
<field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="period_id"/>
|
||||
<field name="audit"/>
|
||||
</group>
|
||||
|
@ -73,7 +79,7 @@
|
|||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
|
||||
<button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
<button name="%(action_view_account_voucher_unreconcile)d" string="Cancel" type="action" states="posted" icon="terp-stock_effects-object-colorize"/>
|
||||
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -83,48 +89,7 @@
|
|||
<field name="name">account.voucher.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-check" string="Proforma" domain="[('state','=','proforma')]" help="Proforma Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<filter icon="gtk-cancel" string="Cancel" domain="[('state','=','cancel')]" help="Cancel Vouchers" groups="base.group_extended"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="number" select='1'/>
|
||||
<field name="account_id" select="1"/>
|
||||
<field name="partner_id" select='1'/>
|
||||
<field name="date" select='1'/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" />
|
||||
<field name="period_id" context="{'period_id': self}" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." col='8' colspan='4'>
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
|
||||
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="name" select='1'/>
|
||||
<field name="narration" select="1"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_voucher_filter_new" model="ir.ui.view">
|
||||
<field name="name">account.voucher.select</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">search</field>
|
||||
<field name="priority">1</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Vouchers">
|
||||
<group col='8' colspan='4'>
|
||||
|
@ -133,9 +98,9 @@
|
|||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date" select='1'/>
|
||||
<field name="number" select='1'/>
|
||||
<field name="partner_id" select='1'/>
|
||||
<field name="date"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='4'>
|
||||
|
@ -143,18 +108,19 @@
|
|||
<field name="period_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="12" col="10">
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="narration"/>
|
||||
<field name="amount"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="10">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
|
||||
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." col='8' colspan='4'>
|
||||
<field name="reference" select="1"/>
|
||||
<field name="name" select='1'/>
|
||||
<field name="narration" select="1"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -199,7 +165,7 @@
|
|||
<field name="view_id" eval="view_voucher_tree"/>
|
||||
<field name="domain">[('state','=','posted')]</field>
|
||||
<field name="context">{'state':'posted'}</field>
|
||||
<field name="search_view_id" ref="view_voucher_filter_new"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
|
|
@ -19,5 +19,4 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import account_voucher_open
|
||||
import account_voucher_unreconcile
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
class account_voucher_open(osv.osv_memory):
|
||||
_name = "account.voucher.open"
|
||||
_description = "Account Voucher"
|
||||
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
"""
|
||||
Return default account period value
|
||||
"""
|
||||
ids = self.pool.get('account.period').find(cr, uid, context=context)
|
||||
period_id = False
|
||||
if len(ids):
|
||||
period_id = ids[0]
|
||||
return period_id
|
||||
|
||||
def _get_journal(self, cr, uid, context={}):
|
||||
"""
|
||||
Return journal based on the journal type
|
||||
"""
|
||||
journal_id = False
|
||||
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
if context.get('journal_type', False):
|
||||
jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))])
|
||||
journal_id = jids[0]
|
||||
return journal_id
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
"""
|
||||
Returns views and fields for current model where view will depend on {view_type}.
|
||||
@param cr: A database cursor
|
||||
@param user: ID of the user currently logged in
|
||||
@param view_id: list of fields, which required to read signatures
|
||||
@param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
|
||||
@param context: context arguments, like lang, time zone
|
||||
@param toolbar: contains a list of reports, wizards, and links related to current model
|
||||
|
||||
@return: Returns a dict that contains definition for fields, views, and toolbars
|
||||
"""
|
||||
res = super(account_voucher_open, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
|
||||
|
||||
if not view_id:
|
||||
return res
|
||||
|
||||
period_pool = self.pool.get('account.period')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
||||
journal_id = self._get_journal(cr, uid, context)
|
||||
period_id = self._get_period(cr, uid, context)
|
||||
|
||||
journal = False
|
||||
if journal_id:
|
||||
journal = journal_pool.read(cr, uid, [journal_id], ['name'])[0]['name']
|
||||
else:
|
||||
journal = "All"
|
||||
|
||||
period = False
|
||||
if period_id:
|
||||
period = period_pool.browse(cr, uid, [period_id], ['name'])[0]['name']
|
||||
|
||||
menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
|
||||
name = menu.name
|
||||
|
||||
view = """<?xml version="1.0" encoding="utf-8"?>
|
||||
<form string="Standard entries">
|
||||
<separator string="Open %s !" colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<label width="300" string="Journal : %s"/>
|
||||
<newline/>
|
||||
<label width="300" string="Period : %s"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Ok" name="action_open_window" type="object"/>
|
||||
</group>
|
||||
</form>""" % (str(name), str(journal), str(period))
|
||||
|
||||
res.update({
|
||||
'arch':view
|
||||
})
|
||||
return res
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function Open action move line window on given period and Journal/Payment Mode
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: account move journal’s ID or list of IDs
|
||||
@return: dictionary of Open action move line window on given period and Journal/Payment Mode
|
||||
"""
|
||||
|
||||
period_pool = self.pool.get('account.journal.period')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
journal_id = self._get_journal(cr, uid, context)
|
||||
period_id = self._get_period(cr, uid, context)
|
||||
|
||||
menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
|
||||
name = context.get('title', menu.name)
|
||||
|
||||
result = data_pool._get_id(cr, uid, 'account_voucher', 'view_voucher_filter_new')
|
||||
res_id = data_pool.browse(cr, uid, result, context=context).res_id
|
||||
|
||||
res = {
|
||||
'domain':menu.action.domain,
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,graph,form',
|
||||
'res_model': 'account.voucher',
|
||||
'view_id': False,
|
||||
'context': "{'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, period_id, context.get('partner_id',False)),
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res_id
|
||||
}
|
||||
return res
|
||||
|
||||
account_voucher_open()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_open_vouchers_view" model="ir.ui.view">
|
||||
<field name="name">Open Vouchers</field>
|
||||
<field name="model">account.voucher.open</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Vouchers">
|
||||
<separator string="Open Vouchers !" colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<label width="300" string="Journal :"/>
|
||||
<newline/>
|
||||
<label width="300" string="Period :"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Ok" name="action_open_window" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -70,7 +70,7 @@ class account_analytic_account(osv.osv):
|
|||
where_date += " AND l.date >= '" + context['from_date'] + "'"
|
||||
if context.get('to_date', False):
|
||||
where_date += " AND l.date <= '" + context['to_date'] + "'"
|
||||
cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount_currency<0 and a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
|
||||
cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount<0 and a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
|
||||
r = dict(cr.fetchall())
|
||||
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, r, context)
|
||||
|
||||
|
@ -90,7 +90,7 @@ class account_analytic_account(osv.osv):
|
|||
where_date += " AND l.date >= '" + context['from_date'] + "'"
|
||||
if context.get('to_date',False):
|
||||
where_date += " AND l.date <= '" + context['to_date'] + "'"
|
||||
cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount_currency>0 and a.id IN %s GROUP BY a.id" ,(tuple(parent_ids),))
|
||||
cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount>0 and a.id IN %s GROUP BY a.id" ,(tuple(parent_ids),))
|
||||
r = dict(cr.fetchall())
|
||||
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, r, context=context)
|
||||
|
||||
|
@ -111,11 +111,10 @@ class account_analytic_account(osv.osv):
|
|||
where_date += " AND l.date >= '" + context['from_date'] + "'"
|
||||
if context.get('to_date',False):
|
||||
where_date += " AND l.date <= '" + context['to_date'] + "'"
|
||||
cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
|
||||
cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
|
||||
|
||||
for account_id, sum in cr.fetchall():
|
||||
res[account_id] = sum
|
||||
|
||||
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
|
||||
|
||||
def _quantity_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
|
@ -182,10 +181,10 @@ class account_analytic_account(osv.osv):
|
|||
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
|
||||
'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
|
||||
'line_ids': fields.one2many('account.analytic.line', 'account_id', 'Analytic Entries'),
|
||||
'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance',store=True),
|
||||
'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit',store=True),
|
||||
'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit',store=True),
|
||||
'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity',store=True),
|
||||
'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance'),
|
||||
'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit'),
|
||||
'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit'),
|
||||
'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity'),
|
||||
'quantity_max': fields.float('Maximum Quantity', help='Sets the higher limit of quantity of hours.'),
|
||||
'partner_id' : fields.many2one('res.partner', 'Associated Partner'),
|
||||
'contact_id' : fields.many2one('res.partner.address', 'Contact'),
|
||||
|
@ -216,7 +215,7 @@ class account_analytic_account(osv.osv):
|
|||
'user_id' : lambda self, cr, uid, ctx : uid,
|
||||
'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
|
||||
'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False),
|
||||
'date_start': time.strftime('%Y-%m-%d')
|
||||
'date_start': time.strftime('%Y-%m-%d')
|
||||
}
|
||||
|
||||
def check_recursion(self, cr, uid, ids, parent=None):
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_account_analytic_line_analytic_accounting","account.analytic.line","analytic.model_account_analytic_line","analytic.group_analytic_accounting",1,1,1,1
|
||||
"access_account_analytic_account_analytic_accounting","account.analytic.account","analytic.model_account_analytic_account","analytic.group_analytic_accounting",1,1,1,1
|
||||
"access_account_analytic_journal_analytic_accounting","account.analytic.journal","account.model_account_analytic_journal","analytic.group_analytic_accounting",1,1,1,1
|
||||
"access_account_account_analytic_accounting","account.account","account.model_account_account","analytic.group_analytic_accounting",1,0,0,0
|
||||
"access_product_template_analytic_accounting","product.template","product.model_product_template","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
|
||||
"access_product_category_analytic_accounting","product.category","product.model_product_category","analytic.group_analytic_accounting",1,0,0,0
|
||||
|
||||
|
|
|
|
@ -85,7 +85,6 @@ Create dashboard for CRM that includes:
|
|||
|
||||
'wizard/crm_send_email_view.xml',
|
||||
'wizard/crm_forward_to_partner_view.xml',
|
||||
'wizard/crm_custom_create_menu_view.xml',
|
||||
'wizard/crm_merge_opportunities_view.xml',
|
||||
|
||||
'crm_view.xml',
|
||||
|
|
|
@ -499,7 +499,7 @@ class crm_case_section(osv.osv):
|
|||
|
||||
_name = "crm.case.section"
|
||||
_description = "Sales Teams"
|
||||
_order = "name"
|
||||
_order = "parent_id, name"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Sales Team', size=64, required=True, translate=True),
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
string="Convert to Opportunity"
|
||||
help="Convert to Opportunity"
|
||||
icon="gtk-index"
|
||||
colspan="2"
|
||||
type="object"/>
|
||||
<newline />
|
||||
<field name="section_id" widget="selection" />
|
||||
|
|
|
@ -30,7 +30,6 @@ import crm_phonecall_to_partner
|
|||
import crm_phonecall_to_opportunity
|
||||
import crm_partner_to_opportunity
|
||||
|
||||
import crm_custom_create_menu
|
||||
import crm_merge_opportunities
|
||||
|
||||
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
|
||||
|
||||
class crm_case_custom_create_menu(osv.osv_memory):
|
||||
'''
|
||||
Create menu for custom Cases
|
||||
'''
|
||||
_name = 'crm.custom.create.menu'
|
||||
_description = 'Create menu for custom Cases'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Menu Name', size=64, required=True),
|
||||
'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
|
||||
'section_id': fields.many2one('crm.case.section.custom', 'Section', required=True),
|
||||
'view_form': fields.many2one('ir.ui.view', 'Form View', domain=[('type','=','form'),('model','=','crm.case.custom')]),
|
||||
'view_tree': fields.many2one('ir.ui.view', 'Tree View', domain=[('type','=','tree'),('model','=','crm.case.custom')]),
|
||||
'view_calendar': fields.many2one('ir.ui.view', 'Calendar View', domain=[('type','=','calendar'),('model','=','crm.case.custom')]),
|
||||
'view_search': fields.many2one('ir.ui.view', 'Search View', domain=[('type','=','search'),('model','=','crm.case.custom')]),
|
||||
}
|
||||
|
||||
def menu_create(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Creates Menus for selected custom section
|
||||
"""
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
domain = [('section_id', '=', this.section_id.id)]
|
||||
view_mode = [this.view_tree and 'tree', this.view_form and 'form', this.view_calendar and 'calendar']
|
||||
view_mode = filter(None , view_mode)
|
||||
action_id = self.pool.get('ir.actions.act_window').create(cr,uid, {
|
||||
'name': this.name,
|
||||
'res_model': 'crm.case.custom',
|
||||
'domain': domain,
|
||||
'view_type': 'form',
|
||||
'view_mode': ','.join(view_mode),
|
||||
'search_view_id': this.view_search.id or False,
|
||||
'context': {'default_section_id': this.section_id.id, 'default_user_id': uid}
|
||||
})
|
||||
menu_id=self.pool.get('ir.ui.menu').create(cr, uid, {
|
||||
'name': this.name,
|
||||
'parent_id': this.menu_parent_id.id,
|
||||
'icon': 'STOCK_JUSTIFY_FILL'
|
||||
})
|
||||
self.pool.get('ir.values').create(cr, uid, {
|
||||
'name': 'Custom Cases',
|
||||
'key2': 'tree_but_open',
|
||||
'model': 'ir.ui.menu',
|
||||
'res_id': menu_id,
|
||||
'value': 'ir.actions.act_window,%d'%action_id,
|
||||
'object': True
|
||||
})
|
||||
return {}
|
||||
|
||||
crm_case_custom_create_menu()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="crm_custom_create_menu_form">
|
||||
<field name="name">crm.custom.create.menu.form</field>
|
||||
<field name="model">crm.custom.create.menu</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Menu for Custom Cases">
|
||||
<separator string="Menu Information" colspan="4"/>
|
||||
<field name="name"/>
|
||||
<field name="menu_parent_id"/>
|
||||
<field name="section_id"/>
|
||||
<separator string="Select Views (Empty for Default)" colspan="4"/>
|
||||
<field name="view_form"/>
|
||||
<field name="view_tree"/>
|
||||
<field name="view_calendar"/>
|
||||
<field name="view_search"/>
|
||||
<separator string="" colspan="4"/>
|
||||
<label string="" colspan="2"/>
|
||||
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
|
||||
<button name="menu_create" string="Create _Menu" type="object" icon='gtk-ok'/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_custom_create_menu_action">
|
||||
<field name="name">Create Menu</field>
|
||||
<field name="res_model">crm.custom.create.menu</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -286,7 +286,7 @@
|
|||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@string='Sale Order']/group[1]/button[@name='button_dummy']" position="after">
|
||||
<xpath expr="/form/notebook/page[@string='Sales Order']/group[1]/button[@name='button_dummy']" position="after">
|
||||
<button name="%(action_delivery_cost)d" states="draft" string="Delivery Costs" type="action" icon="gtk-add" context="{'order_id':id}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2009 Sharoon Thomas
|
||||
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
# Copyright (C) 2010-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2009 Sharoon Thomas
|
||||
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
# Copyright (C) 2010-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2009 Sharoon Thomas
|
||||
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
# Copyright (C) 2010-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2009 Sharoon Thomas
|
||||
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
# Copyright (C) 2010-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2009 Sharoon Thomas
|
||||
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
# Copyright (C) 2010-2010 OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
Loading…
Reference in New Issue