diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 9d6db6bdaca..662fdda69d5 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -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):
diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py
index 119c1edef1a..77c64176330 100644
--- a/addons/account/report/account_aged_partner_balance.py
+++ b/addons/account/report/account_aged_partner_balance.py
@@ -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:
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index 19b06b10510..f2177f80b3a 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -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:
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
index 2cf9a489a1a..340cb991941 100644
--- a/addons/account/report/account_general_ledger.py
+++ b/addons/account/report/account_general_ledger.py
@@ -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
diff --git a/addons/account/report/account_partner_balance.py b/addons/account/report/account_partner_balance.py
index 5d6788f240c..83e9f03e0a4 100644
--- a/addons/account/report/account_partner_balance.py
+++ b/addons/account/report/account_partner_balance.py
@@ -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):
diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py
index db69e51ecf5..4211a516aa7 100644
--- a/addons/account/report/account_partner_ledger.py
+++ b/addons/account/report/account_partner_ledger.py
@@ -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:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml
index 57ebc6f44e3..4136fdcc727 100644
--- a/addons/account/report/account_partner_ledger.rml
+++ b/addons/account/report/account_partner_ledger.rml
@@ -362,10 +362,10 @@
[[ line['code'] ]]
- [[ line['ref'] ]]
+ [[ line['move_name'] ]]
|
- [[ line['name'] ]]
+ b[[ (line['ref'] or '') + ' ' + line['name'] ]]
|
[[ formatLang((line['debit'])) ]]
@@ -487,10 +487,10 @@
[[ line['code'] ]]
|
- [[ line['ref'] ]]
+ [[ line['move_name'] ]]
|
- [[ line['name'] ]]
+ a[[ (line['ref'] or '') + ' ' + line['name'] ]]
|
[[ formatLang((line['debit'])) ]]
diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml
index 1869144cfc9..d34ffdbb7c7 100644
--- a/addons/account/report/account_partner_ledger_other.rml
+++ b/addons/account/report/account_partner_ledger_other.rml
@@ -431,7 +431,7 @@
- [[ display_currency(data) == False or removeParentNode('blockTable') ]]
+ [[ display_currency(data) == False or removeParentNode('blockTable') ]]
Date
@@ -508,7 +508,7 @@
[[ repeatIn(lines(p), 'line') ]]
- [[ display_currency(data) == False or removeParentNode('blockTable') ]]
+ [[ display_currency(data) == False or removeParentNode('blockTable') ]]
|
[[ formatLang(line['date'],date=True) ]]
@@ -517,10 +517,10 @@
[[ line['code'] ]]
|
- [[ line['ref'] ]]
+ [[ line['move_name'] ]]
|
- [[ line['name'] ]]
+ [[ (line['ref'] or '')+ ' ' + line['name'] ]]
|
[[ formatLang((line['debit'])) ]]
@@ -628,7 +628,7 @@
[[ repeatIn(lines(p), 'line') ]]
- [[ display_currency(data) == True or removeParentNode('blockTable') ]]
+ [[ display_currency(data) == True or removeParentNode('blockTable') ]]
|
[[ formatLang(line['date'],date=True) ]]
@@ -637,10 +637,10 @@
[[ line['code'] ]]
|
- [[ line['ref'] ]]
+ [[ line['move_name'] ]]
|
- [[ line['name'] ]]
+ [[ (line['ref'] or '') + ' ' + line['name'] ]]
|
[[ formatLang((line['debit'])) ]]
@@ -662,4 +662,4 @@
-
\ No newline at end of file
+
diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv
index 903001a2b30..b87f0e45cd3 100644
--- a/addons/account/security/ir.model.access.csv
+++ b/addons/account/security/ir.model.access.csv
@@ -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
diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py
index 3d5f308f7bd..84683d17b30 100644
--- a/addons/account/wizard/account_chart.py
+++ b/addons/account/wizard/account_chart.py
@@ -18,7 +18,7 @@
# along with this program. If not, see .
#
##############################################################################
-
+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']
diff --git a/addons/account/wizard/account_chart_view.xml b/addons/account/wizard/account_chart_view.xml
index 62f5c225a81..eb662058f32 100644
--- a/addons/account/wizard/account_chart_view.xml
+++ b/addons/account/wizard/account_chart_view.xml
@@ -7,16 +7,18 @@
form
diff --git a/addons/account/wizard/account_report_account_balance.py b/addons/account/wizard/account_report_account_balance.py
index 398fba01054..3869744bf96 100644
--- a/addons/account/wizard/account_report_account_balance.py
+++ b/addons/account/wizard/account_report_account_balance.py
@@ -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()
diff --git a/addons/account/wizard/account_report_account_balance_view.xml b/addons/account/wizard/account_report_account_balance_view.xml
index 36af271a5ed..8ffdf6ae02f 100644
--- a/addons/account/wizard/account_report_account_balance_view.xml
+++ b/addons/account/wizard/account_report_account_balance_view.xml
@@ -11,6 +11,7 @@
+
diff --git a/addons/account/wizard/account_report_aged_partner_balance.py b/addons/account/wizard/account_report_aged_partner_balance.py
index fb0e404401a..b8b2a013d78 100644
--- a/addons/account/wizard/account_report_aged_partner_balance.py
+++ b/addons/account/wizard/account_report_aged_partner_balance.py
@@ -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)
diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py
index ebe3b4c8ba8..9a53314c7a2 100644
--- a/addons/account/wizard/account_report_balance_sheet.py
+++ b/addons/account/wizard/account_report_balance_sheet.py
@@ -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:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_report_common_view.xml b/addons/account/wizard/account_report_common_view.xml
index aa140c7f8fc..ec3aa6b227b 100644
--- a/addons/account/wizard/account_report_common_view.xml
+++ b/addons/account/wizard/account_report_common_view.xml
@@ -8,35 +8,27 @@
form
diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py
index 07a590e01fa..9f8a548c5ba 100644
--- a/addons/account/wizard/account_report_general_ledger.py
+++ b/addons/account/wizard/account_report_general_ledger.py
@@ -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):
diff --git a/addons/account/wizard/account_report_partner_balance.py b/addons/account/wizard/account_report_partner_balance.py
index 819889b5128..d67954c3784 100644
--- a/addons/account/wizard/account_report_partner_balance.py
+++ b/addons/account/wizard/account_report_partner_balance.py
@@ -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',
diff --git a/addons/account/wizard/account_report_partner_balance_view.xml b/addons/account/wizard/account_report_partner_balance_view.xml
index dc75d032329..81dfada99cc 100644
--- a/addons/account/wizard/account_report_partner_balance_view.xml
+++ b/addons/account/wizard/account_report_partner_balance_view.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index 7cdd9ded9f2..fd77dce3f91 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -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,
diff --git a/addons/account_voucher/report/report_voucher.py b/addons/account_voucher/report/report_voucher.py
index 8c7b1ccbbea..effe335317e 100644
--- a/addons/account_voucher/report/report_voucher.py
+++ b/addons/account_voucher/report/report_voucher.py
@@ -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(
diff --git a/addons/account_voucher/report/report_voucher.rml b/addons/account_voucher/report/report_voucher.rml
index ee40fb247bc..1b11f977a24 100755
--- a/addons/account_voucher/report/report_voucher.rml
+++ b/addons/account_voucher/report/report_voucher.rml
@@ -154,7 +154,7 @@
- [[ repeatIn(objects,'voucher') ]]
+ [[ repeatIn(objects,'voucher') ]]ref
@@ -167,7 +167,7 @@
Journal:
|
- [[ voucher.type ]]
+ [[ voucher.journal_id.name ]]
|
Number:
@@ -252,7 +252,7 @@
|
|
- [[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]
+ [[ move_ids.name ]] - [[ voucher.reference or '' ]]
|
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index 7d848242a1b..3a9855e35f3 100644
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -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:
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index e529c624804..a708f42e257 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -1,6 +1,86 @@
+
+
+ account.voucher.customer.pay.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.voucher.purchase.pay.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
account.voucher.payment.form
account.voucher
@@ -18,9 +98,7 @@
@@ -28,7 +106,7 @@
-
+
Vendor Payment
- account.voucher.open
+ account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]
- {'journal_type':'bank', 'type':'payment'}
-
- new
+ {'type':'payment'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
+
@@ -115,9 +207,7 @@
@@ -181,13 +271,26 @@
Sales Payment
- account.voucher.open
+ account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]
- {'journal_type':'bank', 'type':'receipt'}
-
- new
+ {'type':'receipt'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml
index 1abf4ec1ea1..9a55d5e4f83 100644
--- a/addons/account_voucher/voucher_sales_purchase_view.xml
+++ b/addons/account_voucher/voucher_sales_purchase_view.xml
@@ -1,16 +1,96 @@
+
+ account.voucher.purchase.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.voucher.sale.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sales Payment
account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt'), ('partner_id','=',partner_id)]
- {'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id}
+ {'type':'receipt', 'partner_id': partner_id, 'default_reference':reference}
new
+
account.voucher.sale.form
account.voucher
@@ -19,7 +99,7 @@
@@ -83,23 +164,38 @@
Sales Receipt
- account.voucher.open
+ account.voucher
form
- [('journal_id.type','in',['sale','purchase_refund']), ('type','=','sale')]
- {'journal_type':'sale', 'type':'sale'}
-
- new
+ [('journal_id.type','in',['sale','sale_refund']), ('type','=','sale')]
+ {'type':'sale'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
-
+ action="action_sale_receipt"
+ parent="account.menu_finance_receivables"
+ sequence="10"/>
+
Bill Payment
account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment'), ('partner_id','=',partner_id)]
- {'journal_type':'bank', 'type':'payment', 'partner_id': partner_id}
+ {'type':'payment', 'partner_id': partner_id, 'default_reference':reference}
new
@@ -111,10 +207,10 @@
@@ -169,13 +264,26 @@
Vendor Bills
- account.voucher.open
+ account.voucher
form
- [('journal_id.type','in',['purchase','sale_refund']), ('type','=','purchase')]
- {'journal_type':'purchase', 'type':'purchase'}
-
- new
+ [('journal_id.type','in',['purchase','purchase_refund']), ('type','=','purchase')]
+ {'type':'purchase'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index 6e8e4ffe690..94f7f18c4a0 100644
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -20,7 +20,7 @@
-
+
account.voucher.form
account.voucher
@@ -28,22 +28,22 @@
@@ -83,48 +89,7 @@
account.voucher.select
account.voucher
search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- account.voucher.select
- account.voucher
- search
+ 1
@@ -133,9 +98,9 @@
-
-
-
+
+
+
@@ -143,18 +108,19 @@
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
@@ -199,7 +165,7 @@
[('state','=','posted')]
{'state':'posted'}
-
+
diff --git a/addons/account_voucher/wizard/__init__.py b/addons/account_voucher/wizard/__init__.py
index a5c9a5e4f59..b7a7e00111a 100644
--- a/addons/account_voucher/wizard/__init__.py
+++ b/addons/account_voucher/wizard/__init__.py
@@ -19,5 +19,4 @@
#
##############################################################################
-import account_voucher_open
import account_voucher_unreconcile
diff --git a/addons/account_voucher/wizard/account_voucher_open.py b/addons/account_voucher/wizard/account_voucher_open.py
deleted file mode 100644
index 88a52c3145c..00000000000
--- a/addons/account_voucher/wizard/account_voucher_open.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-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 = """
- """ % (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:
diff --git a/addons/account_voucher/wizard/account_voucher_open_view.xml b/addons/account_voucher/wizard/account_voucher_open_view.xml
deleted file mode 100644
index 6168866b85c..00000000000
--- a/addons/account_voucher/wizard/account_voucher_open_view.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
- Open Vouchers
- account.voucher.open
- form
-
-
-
-
-
-
-
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index 26f57c984c0..eef25f665d8 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -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):
diff --git a/addons/analytic/security/ir.model.access.csv b/addons/analytic/security/ir.model.access.csv
index 73dba08900c..6be5774177c 100644
--- a/addons/analytic/security/ir.model.access.csv
+++ b/addons/analytic/security/ir.model.access.csv
@@ -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
+
diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py
index 4512892897f..94f3d977842 100644
--- a/addons/crm/__openerp__.py
+++ b/addons/crm/__openerp__.py
@@ -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',
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 84e884043ba..1ee2f295778 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -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),
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 9517edc5f3a..6e1b851f52a 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -65,7 +65,6 @@
string="Convert to Opportunity"
help="Convert to Opportunity"
icon="gtk-index"
- colspan="2"
type="object"/>
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index 70dd08a23cf..03ddbc43622 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -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
diff --git a/addons/crm/wizard/crm_custom_create_menu.py b/addons/crm/wizard/crm_custom_create_menu.py
deleted file mode 100644
index 8cf8619c074..00000000000
--- a/addons/crm/wizard/crm_custom_create_menu.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-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:
diff --git a/addons/crm/wizard/crm_custom_create_menu_view.xml b/addons/crm/wizard/crm_custom_create_menu_view.xml
deleted file mode 100644
index ad36e51b744..00000000000
--- a/addons/crm/wizard/crm_custom_create_menu_view.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml
index 0dbba7323e2..91513709e03 100644
--- a/addons/delivery/delivery_view.xml
+++ b/addons/delivery/delivery_view.xml
@@ -286,7 +286,7 @@
sale.order
-
+
diff --git a/addons/email_template/__init__.py b/addons/email_template/__init__.py
index a21bd4bec06..dd87232679d 100644
--- a/addons/email_template/__init__.py
+++ b/addons/email_template/__init__.py
@@ -3,7 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
-# Copyright (C) 2004-2010 OpenERP SA ()
+# Copyright (C) 2010-2010 OpenERP SA ()
#
# 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
diff --git a/addons/email_template/__openerp__.py b/addons/email_template/__openerp__.py
index 3654f22047c..6aa4899feb6 100644
--- a/addons/email_template/__openerp__.py
+++ b/addons/email_template/__openerp__.py
@@ -3,7 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
-# Copyright (C) 2004-2010 OpenERP SA ()
+# Copyright (C) 2010-2010 OpenERP SA ()
#
# 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
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 85225505237..f87c4bf750e 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -3,7 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
-# Copyright (C) 2004-2010 OpenERP SA ()
+# Copyright (C) 2010-2010 OpenERP SA ()
#
# 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
diff --git a/addons/email_template/wizard/__init__.py b/addons/email_template/wizard/__init__.py
old mode 100755
new mode 100644
index eb7cd23f704..1641152490e
--- a/addons/email_template/wizard/__init__.py
+++ b/addons/email_template/wizard/__init__.py
@@ -3,7 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
-# Copyright (C) 2004-2010 OpenERP SA ()
+# Copyright (C) 2010-2010 OpenERP SA ()
#
# 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
diff --git a/addons/email_template/wizard/email_template_send_wizard.py b/addons/email_template/wizard/email_template_send_wizard.py
old mode 100755
new mode 100644
index 73cf5af6ede..3588ca20ded
--- a/addons/email_template/wizard/email_template_send_wizard.py
+++ b/addons/email_template/wizard/email_template_send_wizard.py
@@ -3,7 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
-# Copyright (C) 2004-2010 OpenERP SA ()
+# Copyright (C) 2010-2010 OpenERP SA ()
#
# 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
diff --git a/addons/email_template/wizard/email_template_send_wizard_view.xml b/addons/email_template/wizard/email_template_send_wizard_view.xml
old mode 100755
new mode 100644
| | | |