← Back to team overview

openerp-dev-web team mailing list archive

[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
  #588776 Error when closing fiscal year
  https://bugs.launchpad.net/bugs/588776
  #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
  #691218 add an employee to a department
  https://bugs.launchpad.net/bugs/691218
  #692139 Account Journal onchange_type method context undefined error
  https://bugs.launchpad.net/bugs/692139
  #692962 In hr contract, shouldn't be able to enter an end date lower than a start date
  https://bugs.launchpad.net/bugs/692962
  #693476 [6.0] sale manager dashboard - "Sales by Customer" - incomplete
  https://bugs.launchpad.net/bugs/693476
  #693810 [RC1]Pay button when you pay directly in Sales receipt form
  https://bugs.launchpad.net/bugs/693810
  #694937 [6.0] account entry analysis - unreconciled does not filter 
  https://bugs.launchpad.net/bugs/694937
  #695439 membership: can't open members via GTK client
  https://bugs.launchpad.net/bugs/695439
  #697207 Bug when sending followups without specifying any email address
  https://bugs.launchpad.net/bugs/697207
  #697714 Unclear warning on cancel opening entries
  https://bugs.launchpad.net/bugs/697714

For more details, see:
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2/+merge/45667

Hello sir,

account_voucher: Define access rule for sale.receipt.report object

Thanks 
PSI
-- 
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2/+merge/45667
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/wizard/account_fiscalyear_close.py'
--- account/wizard/account_fiscalyear_close.py	2011-01-04 13:28:53 +0000
+++ account/wizard/account_fiscalyear_close.py	2011-01-10 09:22:11 +0000
@@ -95,6 +95,7 @@
                 obj='account_move_line', context={'fiscalyear': fy_ids})
         cr.execute('select id from account_account WHERE active AND company_id = %s', (old_fyear.company_id.id,))
         ids = map(lambda x: x[0], cr.fetchall())
+        account_balanced = []
         for account in obj_acc_account.browse(cr, uid, ids,
             context={'fiscalyear': fy_id}):
             accnt_type_data = account.user_type
@@ -103,16 +104,7 @@
             if accnt_type_data.close_method=='none' or account.type == 'view':
                 continue
             if accnt_type_data.close_method=='balance':
-                if abs(account.balance)>0.0001:
-                    obj_acc_move_line.create(cr, uid, {
-                        'debit': account.balance>0 and account.balance,
-                        'credit': account.balance<0 and -account.balance,
-                        'name': data[0]['report_name'],
-                        'date': period.date_start,
-                        'journal_id': new_journal.id,
-                        'period_id': period.id,
-                        'account_id': account.id
-                    }, {'journal_id': new_journal.id, 'period_id':period.id})
+                account_balanced.append(account.id)
             if accnt_type_data.close_method == 'unreconciled':
                 offset = 0
                 limit = 100
@@ -198,6 +190,27 @@
                         })
                         obj_acc_move_line.create(cr, uid, move)
                     offset += limit
+
+        acc_set = ",".join(map(str, account_balanced))
+        cr.execute(("SELECT l.account_id as id, " \
+                        "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance " \
+                        "FROM " \
+                            "account_move_line l " \
+                        "WHERE " \
+                            "l.account_id IN (%s) " \
+                        " GROUP BY l.account_id") % (acc_set, ))
+        for res in cr.dictfetchall():
+            if abs(res['balance']) > 0.0001:
+                    obj_acc_move_line.create(cr, uid, {
+                        'debit': res['balance'] > 0 and res['balance'],
+                        'credit': res['balance'] < 0 and -res['balance'],
+                        'name': data[0]['report_name'],
+                        'date': period.date_start,
+                        'journal_id': new_journal.id,
+                        'period_id': period.id,
+                        'account_id': res['id'],
+                        'fy_opening': True
+                    }, {'journal_id': new_journal.id, 'period_id': period.id})
         ids = obj_acc_move_line.search(cr, uid, [('journal_id','=',new_journal.id),
             ('period_id.fiscalyear_id','=',new_fyear.id)])
         context['fy_closing'] = True

=== modified file 'account_voucher/security/ir.model.access.csv'
--- account_voucher/security/ir.model.access.csv	2010-12-30 09:58:09 +0000
+++ account_voucher/security/ir.model.access.csv	2011-01-10 09:22:11 +0000
@@ -5,3 +5,5 @@
 "access_account_voucher_line_manager","account.voucher.line","model_account_voucher_line","account.group_account_manager",1,0,0,0
 "access_account_voucher_invoice","account.voucher invoice","model_account_voucher","account.group_account_invoice",1,1,1,1
 "access_account_voucher_line_invoice","account.voucher.line invoice","model_account_voucher_line","account.group_account_invoice",1,1,1,1
+"access_sale_receipt_report_manager","account.sale.receipt.report","model_sale_receipt_report","account.group_account_manager",1,1,1,1
+"access_sale_receipt_report_user","account.sale.receipt.report","model_sale_receipt_report","account.group_account_user",1,0,0,0