openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #01416
[Merge] lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3
psi (OpenERP) has proposed merging lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
Requested reviews:
OpenERP R&D Team (openerp-dev)
Related bugs:
#568537 The __compute method of account_account needs optmization to improve Accounting Performance!
https://bugs.launchpad.net/bugs/568537
#686508 Not able to validate sales receipt
https://bugs.launchpad.net/bugs/686508
#686513 Not able to validate supplier vouchers
https://bugs.launchpad.net/bugs/686513
#692139 Account Journal onchange_type method context undefined error
https://bugs.launchpad.net/bugs/692139
hello sir,
used is_zero function of res.currency in account reports.
Fixes https://bugs.launchpad.net/openobject-addons/+bug/692139
Thanks
PSI
--
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2/+merge/44205
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'account/account.py'
--- account/account.py 2010-12-17 04:37:32 +0000
+++ account/account.py 2010-12-20 10:01:22 +0000
@@ -708,7 +708,7 @@
return self.name_get(cr, user, ids, context=context)
- def onchange_type(self, cr, uid, ids, type, currency):
+ def onchange_type(self, cr, uid, ids, type, currency, context=None):
obj_data = self.pool.get('ir.model.data')
user_pool = self.pool.get('res.users')
=== modified file 'account/report/account_balance.py'
--- account/report/account_balance.py 2010-12-09 12:09:18 +0000
+++ account/report/account_balance.py 2010-12-20 10:01:22 +0000
@@ -70,6 +70,9 @@
def lines(self, form, ids=[], done=None):#, level=1):
def _process_child(accounts, disp_acc, parent):
account_rec = [acct for acct in accounts if acct['id']==parent][0]
+ currency_obj = self.pool.get('res.currency')
+ acc_id = self.pool.get('account.account').browse(self.cr, self.uid, account_rec['id'])
+ currency = acc_id.currency_id and acc_id.currency_id or acc_id.company_id.currency_id
res = {
'id': account_rec['id'],
'type': account_rec['type'],
@@ -84,12 +87,11 @@
}
self.sum_debit += account_rec['debit']
self.sum_credit += account_rec['credit']
- acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account')
if disp_acc == 'bal_movement':
- if round(res['credit'], acc_digit) > 0 or round(res['debit'], acc_digit) > 0 or round(res['balance'], acc_digit) != 0:
+ if currency_obj.is_zero(self.cr, self.uid, currency, res['credit']) > 0 or currency_obj.is_zero(self.cr, self.uid, currency, res['debit']) > 0 or currency_obj.is_zero(self.cr, self.uid, currency, res['balance']) != 0:
self.result_acc.append(res)
elif disp_acc == 'bal_solde':
- if round(res['balance'], acc_digit) != 0:
+ if currency_obj.is_zero(self.cr, self.uid, currency, res['debit']) != 0:
self.result_acc.append(res)
else:
self.result_acc.append(res)
=== modified file 'account/report/account_balance_sheet.py'
--- account/report/account_balance_sheet.py 2010-12-10 05:42:16 +0000
+++ account/report/account_balance_sheet.py 2010-12-20 10:01:22 +0000
@@ -89,6 +89,7 @@
self.res_bl = self.obj_pl.final_result()
account_pool = db_pool.get('account.account')
+ currency_pool = db_pool.get('res.currency')
types = [
'liability',
@@ -136,16 +137,16 @@
'level': account.level,
'balance':account.balance,
}
- acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account')
+ currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += account.balance
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += account.balance
if data['form']['display_account'] == 'bal_movement':
- if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0:
+ if currency_pool.is_zero(self.cr, self.uid, currency, account.credit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.debit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account_dict)
elif data['form']['display_account'] == 'bal_solde':
- if round(account.balance, acc_digit) != 0:
+ if currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account_dict)
else:
accounts_temp.append(account_dict)
=== modified file 'account/report/account_profit_loss.py'
--- account/report/account_profit_loss.py 2010-12-10 05:42:16 +0000
+++ account/report/account_profit_loss.py 2010-12-20 10:01:22 +0000
@@ -82,6 +82,7 @@
db_pool = pooler.get_pool(self.cr.dbname)
account_pool = db_pool.get('account.account')
+ currency_pool = db_pool.get('res.currency')
types = [
'expense',
@@ -106,16 +107,16 @@
accounts_temp = []
for account in accounts:
if (account.user_type.report_type) and (account.user_type.report_type == typ):
- acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account')
+ currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += abs(account.debit - account.credit)
if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += abs(account.debit - account.credit)
if data['form']['display_account'] == 'bal_movement':
- if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0:
+ if currency_pool.is_zero(self.cr, self.uid, currency, account.credit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.debit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account)
elif data['form']['display_account'] == 'bal_solde':
- if round(account.balance, acc_digit) != 0:
+ if currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account)
else:
accounts_temp.append(account)
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2010-12-17 08:46:02 +0000
+++ account_voucher/account_voucher.py 2010-12-20 10:01:22 +0000
@@ -27,6 +27,7 @@
import decimal_precision as dp
from tools.translate import _
+
class account_move_line(osv.osv):
_inherit = 'account.move.line'
@@ -844,7 +845,7 @@
'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly=1),
'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Originial Amount', store=True),
'amount_unreconciled': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Open Balance', store=True),
- 'company_id': fields.related('voucher_id','company_id', relation='res.company', type='many2one', string='Company', store=True),
+ 'company_id': fields.related('voucher_id','company_id', relation='res.company', string='Company', store=True),
}
_defaults = {
'name': ''
@@ -1004,4 +1005,4 @@
account_bank_statement_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Follow ups