~therp-nl/banking-addons/7.0-ing_mt940_update

« back to all changes in this revision

Viewing changes to account_banking_tests/tests/test_payment_roundtrip.py

[ADD] Introduce _prepare method in the wizard "Select Invoices to Pay", for easier inheritence
[IMP] Don't disable the field 'communication' when using free communication
      - Structured => 'communication'
      - Free => 'communication' + 'communication2

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
                        'price_unit': 100.0,
164
164
                        'quantity': 1,
165
165
                        'account_id': expense_id,})],
 
166
            'reference_type': 'none',
 
167
            'supplier_invoice_number': 'INV1',
166
168
            }
167
169
        self.invoice_ids = [
168
170
            invoice_model.create(
171
173
                    })]
172
174
        values.update({
173
175
                'partner_id': supplier2,
174
 
                'name': 'Purchase 2'})
 
176
                'name': 'Purchase 2',
 
177
                'reference_type': 'structured',
 
178
                'supplier_invoice_number': 'INV2',
 
179
                'reference': 'STR2',
 
180
                })
175
181
        self.invoice_ids.append(
176
182
            invoice_model.create(
177
183
                cr, uid, values, context={
247
253
                }, context=context)
248
254
        reg('payment.order.create').create_payment(
249
255
            cr, uid, [self.payment_order_create_id], context=context)
 
256
 
 
257
        # Check if payment lines are created with the correct reference
 
258
        self.assertTrue(
 
259
            reg('payment.line').search(
 
260
                cr, uid, [
 
261
                    ('move_line_id.invoice', '=', self.invoice_ids[0]),
 
262
                    ('communication', '=', 'INV1'),
 
263
                    ('state', '=', 'normal'),
 
264
                    ], context=context),
 
265
            'No payment line created from invoice 1 or with the wrong '
 
266
            'communication')
 
267
        self.assertTrue(
 
268
            reg('payment.line').search(
 
269
                cr, uid, [
 
270
                    ('move_line_id.invoice', '=', self.invoice_ids[1]),
 
271
                    ('communication', '=', 'STR2'),
 
272
                    ('state', '=', 'structured'),
 
273
                    ], context=context),
 
274
            'No payment line created from invoice 2 or with the wrong '
 
275
            'communication')
 
276
 
250
277
        wf_service = netsvc.LocalService('workflow')
251
278
        wf_service.trg_validate(
252
279
            uid, 'payment.order', self.payment_order_id, 'open', cr)