Merge lp:~julie-w/unifield-server/US-2539 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merge reported by: jftempo
Merged at revision: not available
Proposed branch: lp:~julie-w/unifield-server/US-2539
Merge into: lp:unifield-server
Diff against target: 166 lines (+78/-16)
5 files modified
bin/addons/register_accounting/account_bank_statement.py (+26/-0)
bin/addons/register_accounting/report/report_bank_reconciliation.py (+4/-2)
bin/addons/register_accounting/report/report_cheque_inventory.py (+38/-4)
bin/addons/register_accounting/report/report_liquidity_position.py (+3/-4)
bin/addons/register_accounting/report/report_pending_cheque.py (+7/-6)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-2539
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+326753@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/register_accounting/account_bank_statement.py'
--- bin/addons/register_accounting/account_bank_statement.py 2017-05-26 10:28:09 +0000
+++ bin/addons/register_accounting/account_bank_statement.py 2017-07-04 09:20:48 +0000
@@ -671,6 +671,32 @@
671 'target': 'current',671 'target': 'current',
672 }672 }
673673
674 def get_pending_cheque_ids(self, cr, uid, register_ids, account_ids, min_posting_date, context=None):
675 """
676 Returns a list containing the ids of the JIs matching the following criteria:
677 - booked in the register(s) and in the account(s) in parameters
678 - either not reconciled or reconciled partially or totally with at least one reconciliation leg having a
679 posting date later than the min_posting_date in parameter
680 """
681 if context is None:
682 context = {}
683 aml_obj = self.pool.get('account.move.line')
684 aml_ids = aml_obj.search(cr, uid, [('statement_id', 'in', register_ids),
685 ('account_id', 'in', account_ids), ],
686 order='date DESC', context=context)
687 aml_list = []
688 for aml in aml_obj.browse(cr, uid, aml_ids,
689 fields_to_fetch=['is_reconciled', 'reconcile_id', 'reconcile_partial_id'], context=context):
690 total_rec_ok = aml.reconcile_id and aml_obj.search_exist(cr, uid,
691 [('reconcile_id', '=', aml.reconcile_id.id),
692 ('date', '>', min_posting_date)], context=context)
693 partial_rec_ok = aml.reconcile_partial_id and aml_obj.search_exist(cr, uid,
694 [('reconcile_partial_id', '=', aml.reconcile_partial_id.id),
695 ('date', '>', min_posting_date)], context=context)
696 if not aml.is_reconciled or total_rec_ok or partial_rec_ok:
697 aml_list.append(aml.id)
698 return aml_list
699
674account_bank_statement()700account_bank_statement()
675701
676class account_bank_statement_line(osv.osv):702class account_bank_statement_line(osv.osv):
677703
=== modified file 'bin/addons/register_accounting/report/report_bank_reconciliation.py'
--- bin/addons/register_accounting/report/report_bank_reconciliation.py 2016-06-16 15:14:08 +0000
+++ bin/addons/register_accounting/report/report_bank_reconciliation.py 2017-07-04 09:20:48 +0000
@@ -67,8 +67,10 @@
67 ids = abs_obj.search(self.cr, self.uid, abs_args, context=self.context)67 ids = abs_obj.search(self.cr, self.uid, abs_args, context=self.context)
6868
69 amvl_obj = self.pool.get('account.move.line')69 amvl_obj = self.pool.get('account.move.line')
70 amvl_ids = amvl_obj.search(self.cr, self.uid, [('statement_id', 'in', ids), ('is_reconciled', '=', False),70 # include in the report only the JIs that are either not reconciled,
71 ('account_id', 'in', account_ids)], context=self.context)71 # or reconciled (totally or partially) with at least one entry belonging to a later period
72 amvl_ids = abs_obj.get_pending_cheque_ids(self.cr, self.uid, ids, account_ids, period.date_stop, context=self.context)
73
72 # amount in booking currency74 # amount in booking currency
73 for line in amvl_obj.read(self.cr, self.uid, amvl_ids, ['debit_currency', 'credit_currency'], context=self.context):75 for line in amvl_obj.read(self.cr, self.uid, amvl_ids, ['debit_currency', 'credit_currency'], context=self.context):
74 self.amount_pending_cheque += line['credit_currency']76 self.amount_pending_cheque += line['credit_currency']
7577
=== modified file 'bin/addons/register_accounting/report/report_cheque_inventory.py'
--- bin/addons/register_accounting/report/report_cheque_inventory.py 2014-05-16 09:11:47 +0000
+++ bin/addons/register_accounting/report/report_cheque_inventory.py 2017-07-04 09:20:48 +0000
@@ -30,13 +30,41 @@
30 })30 })
31 return31 return
3232
33 def _keep_register_line(self, cr, uid, acc_bank_statement_line, min_posting_date, context=None):
34 """
35 Checks the move lines linked to the acc_bank_statement_line in parameter, and returns True if one of them is:
36 - either reconciled partially or totally with at least one reconciliation leg having a posting date later than
37 the min_posting_date in parameter
38 - or not reconciled (but reconcilable)
39 """
40 if context is None:
41 context = {}
42 aml_obj = self.pool.get('account.move.line')
43 if acc_bank_statement_line.move_ids and acc_bank_statement_line.state == 'hard':
44 for move in acc_bank_statement_line.move_ids:
45 for move_line in move.line_id:
46 if move_line.account_id.reconcile:
47 total_rec_ok = move_line.reconcile_id and \
48 aml_obj.search_exist(cr, uid,
49 [('reconcile_id', '=', move_line.reconcile_id.id),
50 ('date', '>', min_posting_date)], context=context)
51 partial_rec_ok = move_line.reconcile_partial_id and \
52 aml_obj.search_exist(cr, uid,
53 [('reconcile_partial_id', '=', move_line.reconcile_partial_id.id),
54 ('date', '>', min_posting_date)], context=context)
55 if not move_line.is_reconciled or total_rec_ok or partial_rec_ok:
56 return True
57 return False
58
33 def getLines(self, statement):59 def getLines(self, statement):
34 """60 """
35 Return list of lines from given register and previous ones that are not reconciled61 Return list of lines from given register and previous ones that are either not reconciled, or reconciled partially
62 or totally with at least one reconciliation leg having a posting date belonging to a later period than the register one
36 """63 """
37 # Prepare some values64 # Prepare some values
38 res = []65 res = []
39 absl_obj = self.pool.get('account.bank.statement.line')66 absl_obj = self.pool.get('account.bank.statement.line')
67 period_obj = self.pool.get('account.period')
40 # Fetch all previous registers linked to this one68 # Fetch all previous registers linked to this one
41 prev_reg_ids = [statement.id]69 prev_reg_ids = [statement.id]
42 if statement.prev_reg_id:70 if statement.prev_reg_id:
@@ -46,9 +74,15 @@
46 prev_reg_id = prev_reg_id.prev_reg_id or False74 prev_reg_id = prev_reg_id.prev_reg_id or False
47 if prev_reg_id:75 if prev_reg_id:
48 prev_reg_ids.append(prev_reg_id.id)76 prev_reg_ids.append(prev_reg_id.id)
49 absl_ids = absl_obj.search(self.cr, self.uid, [('statement_id', 'in', prev_reg_ids), ('reconciled', '=', False)])77 absl_ids = absl_obj.search(self.cr, self.uid, [('statement_id', 'in', prev_reg_ids)])
50 if absl_ids:78 period_r = period_obj.read(self.cr, self.uid, statement.period_id.id,
51 res = absl_obj.browse(self.cr, self.uid, absl_ids)79 ['date_stop']) # used not to format the date in the user language
80 absl_ids_to_keep = []
81 for absl in absl_obj.browse(self.cr, self.uid, absl_ids, fields_to_fetch=['move_ids', 'state']):
82 if self._keep_register_line(self.cr, self.uid, absl, period_r['date_stop']):
83 absl_ids_to_keep.append(absl.id)
84 if absl_ids_to_keep:
85 res = absl_obj.browse(self.cr, self.uid, absl_ids_to_keep)
52 return res86 return res
5387
54SpreadsheetReport('report.cheque.inventory.2','account.bank.statement','addons/register_accounting/report/cheque_inventory_xls.mako', parser=report_cheque_inventory)88SpreadsheetReport('report.cheque.inventory.2','account.bank.statement','addons/register_accounting/report/cheque_inventory_xls.mako', parser=report_cheque_inventory)
5589
=== modified file 'bin/addons/register_accounting/report/report_liquidity_position.py'
--- bin/addons/register_accounting/report/report_liquidity_position.py 2016-06-08 09:40:53 +0000
+++ bin/addons/register_accounting/report/report_liquidity_position.py 2017-07-04 09:20:48 +0000
@@ -237,10 +237,9 @@
237 # Search register lines237 # Search register lines
238 journal = reg.journal_id238 journal = reg.journal_id
239 account_ids = [journal.default_debit_account_id.id, journal.default_credit_account_id.id]239 account_ids = [journal.default_debit_account_id.id, journal.default_credit_account_id.id]
240 aml_ids = aml_obj.search(self.cr, self.uid, [('statement_id', '=', reg.id), ('is_reconciled', '=', False),240 # include in the report only the JIs that are either not reconciled,
241 ('account_id', 'in', account_ids),])241 # or reconciled (totally or partially) with at least one entry belonging to a later period
242 if isinstance(aml_ids, (int, long)):242 aml_ids = reg_obj.get_pending_cheque_ids(self.cr, self.uid, [reg.id], account_ids, self.getPeriod().date_stop)
243 aml_ids = [aml_ids]
244 lines = aml_obj.browse(self.cr, self.uid, aml_ids)243 lines = aml_obj.browse(self.cr, self.uid, aml_ids)
245244
246 # Get the amounts in booking and functional currency245 # Get the amounts in booking and functional currency
247246
=== modified file 'bin/addons/register_accounting/report/report_pending_cheque.py'
--- bin/addons/register_accounting/report/report_pending_cheque.py 2016-05-23 14:56:46 +0000
+++ bin/addons/register_accounting/report/report_pending_cheque.py 2017-07-04 09:20:48 +0000
@@ -41,17 +41,18 @@
41 pool = pooler.get_pool(self.cr.dbname)41 pool = pooler.get_pool(self.cr.dbname)
42 aml_obj = pool.get('account.move.line')42 aml_obj = pool.get('account.move.line')
4343
44 period_r = self.pool.get('account.period').read(self.cr, self.uid, register.period_id.id, ['date_start'])44 period_r = self.pool.get('account.period').read(self.cr, self.uid, register.period_id.id,
45 ['date_start', 'date_stop']) # used not to format dates in the user language
45 # Search for all registers with the same Journal, and the same period or a previous period46 # Search for all registers with the same Journal, and the same period or a previous period
46 period_ids = self.pool.get('account.period').\47 period_ids = self.pool.get('account.period').\
47 search(self.cr, self.uid, [('date_start', '<=', period_r['date_start'])])48 search(self.cr, self.uid, [('date_start', '<=', period_r['date_start'])])
48 registers_ids = self.pool.get('account.bank.statement').\49 reg_obj = self.pool.get('account.bank.statement')
49 search(self.cr, self.uid, ['&', ('journal_id', '=', journal.id), ('period_id', 'in', period_ids)])50 registers_ids = reg_obj.search(self.cr, self.uid, ['&', ('journal_id', '=', journal.id), ('period_id', 'in', period_ids)])
5051
51 # Search register lines52 # Search register lines
52 aml_ids = aml_obj.search(self.cr, self.uid, [('statement_id', 'in', registers_ids), ('is_reconciled', '=', False), ('account_id', 'in', account_ids),], order='date DESC')53 # include in the report only the JIs that are either not reconciled,
53 if isinstance(aml_ids, (int, long)):54 # or reconciled (totally or partially) with at least one entry belonging to a later period
54 aml_ids = [aml_ids]55 aml_ids = reg_obj.get_pending_cheque_ids(self.cr, self.uid, registers_ids, account_ids, period_r['date_stop'])
55 return aml_obj.browse(self.cr, self.uid, aml_ids)56 return aml_obj.browse(self.cr, self.uid, aml_ids)
5657
57 def getTotals(self, register):58 def getTotals(self, register):

Subscribers

People subscribed via source and target branches