~unifield-team/unifield-wm/uf-2388

« back to all changes in this revision

Viewing changes to register_accounting/account_bank_statement.py

  • Committer: jf
  • Date: 2014-04-30 12:29:49 UTC
  • mfrom: (2120.4.10 ref-wm)
  • Revision ID: jfb@tempo-consulting.fr-20140430122949-wwn9sxg037665b5i
UFTP-201 [FIX] Register line linked to direct invoice gets wrong sequence number
UFTP-204 [FIX] You can see and import the Supplier Direct invoice via a pending payment in a register
UTP-692 [FIX] Removed edit button for Selector

lp:~unifield-team/unifield-wm/uftp-166-189

Show diffs side-by-side

added added

removed removed

Lines of Context:
919
919
            res[line.id] = ''
920
920
            if len(line.move_ids) > 0:
921
921
                res[line.id] = line.move_ids[0].name
 
922
            else:
 
923
                # UFTP-201: If there is no move linked to this reg line, get the current value of ref
 
924
                res[line.id] = line.sequence_for_reference
 
925
 
922
926
        return res
923
927
 
924
928
    def _get_bank_statement_line_ids(self, cr, uid, ids, context=None):
1112
1116
 
1113
1117
        for absl in self.browse(cr, uid, ids):
1114
1118
            if absl.state == 'temp' and absl.direct_invoice == True:
1115
 
 
1116
1119
                # Find all moves lines linked to this register line
1117
1120
                # first, via the statement
1118
1121
                move_ids = [x.id for x in absl.move_ids]
1119
1122
                if move_ids:
1120
1123
                    am1 = account_move.browse(cr, uid, move_ids)[0]
1121
1124
                    seqnums[am1.journal_id.id] = am1.name
 
1125
                else:
 
1126
                    # UFTP-201: If there is no move linked to this reg line, get the current value of ref
 
1127
                    seqnums[absl.statement_id.journal_id.id] = absl.sequence_for_reference
1122
1128
 
1123
1129
                # then via the direct invoice
1124
1130
                ai = account_invoice.browse(cr, uid, [absl.invoice_id.id])[0]
1125
 
                move_id = ai.move_id.id
1126
 
 
1127
 
                if move_id:
1128
 
                    move_ids.append(move_id)
 
1131
                if ai.move_id.id:
 
1132
                    move_ids.append(ai.move_id.id)
1129
1133
                    seqnums[ai.move_id.journal_id.id] = ai.move_id.name
1130
1134
                    account_invoice.write(cr, uid, [ai.id],{'move_id': False}, context=context)
1131
 
 
 
1135
                else:
 
1136
                    # UFTP-201: If there is no move linked to this invoice, retrieve the current value
 
1137
                    if absl.invoice_id.journal_id and absl.invoice_id.journal_id.id: # not needed but just to be sure 
 
1138
                        seqnums[absl.invoice_id.journal_id.id] = absl.invoice_id.internal_number
1132
1139
 
1133
1140
                # TODO: Needs to be fixed during refactoring. The field move_id on account.analytic.line
1134
1141
                # is actually account_move_line.id, not account_move.id