Projet

Général

Profil

0001-caluire-axel-add-a-created-field-to-history-invoices.patch

Voir les différences:

Subject: [PATCH] caluire-axel: add a "created" field to history invoices
 (#54713)

 passerelle/contrib/caluire_axel/utils.py | 2 +-
 tests/test_caluire_axel.py               | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
passerelle/contrib/caluire_axel/utils.py
29 29
    invoice_id = '%s-%s' % (family_id, invoice['IDFACTURE'])
30 30
    if historical:
31 31
        invoice_id = 'historical-%s' % invoice_id
32 32
    data = {
33 33
        'id': invoice_id,
34 34
        'display_id': str(invoice['IDFACTURE']),
35 35
        'label': invoice['FACTURATION'],
36 36
        'paid': False,
37
        'created': invoice['EMISSION'],
37 38
        'total_amount': invoice['MONTANT'],
38 39
        'has_pdf': invoice['EXISTEPDF'],
39 40
        'vendor': {'caluire-axel': vendor},
40 41
    }
41 42
    if historical:
42 43
        data.update(
43 44
            {
44 45
                'amount': 0,
......
46 47
                'online_payment': False,
47 48
            }
48 49
        )
49 50
    else:
50 51
        data.update(
51 52
            {
52 53
                'amount': max(0, invoice['MONTANT'] - invoice['ENCAISSE']),
53 54
                'amount_paid': invoice['ENCAISSE'],
54
                'created': invoice['EMISSION'],
55 55
                'pay_limit_date': invoice['ECHEANCE'],
56 56
                'online_payment': bool(invoice['MONTANT'] - invoice['ENCAISSE'] > 0),
57 57
            }
58 58
        )
59 59
    return data
tests/test_caluire_axel.py
1547 1547
        resp = app.get('/caluire-axel/test/regie/MAREGIE/invoices/history?NameID=yyy')
1548 1548
    assert resp.json['err'] == 0
1549 1549
    assert resp.json['data'] == [
1550 1550
        {
1551 1551
            'id': 'historical-XXX-42',
1552 1552
            'display_id': '42',
1553 1553
            'label': 'PRESTATIONS PERISCOLAIRES SEPTEMBRE-OCTOBRE 2019',
1554 1554
            'amount': 0,
1555
            'created': '2019-11-12',
1555 1556
            'total_amount': '44.94',
1556 1557
            'online_payment': False,
1557 1558
            'pay_limit_date': '',
1558 1559
            'has_pdf': True,
1559 1560
            'paid': False,
1560 1561
            'vendor': {
1561 1562
                'caluire-axel': {
1562 1563
                    'IDFACTURE': 42,
......
1569 1570
                }
1570 1571
            },
1571 1572
        },
1572 1573
        {
1573 1574
            'id': 'historical-XXX-43',
1574 1575
            'display_id': '43',
1575 1576
            'label': 'PRESTATIONS PERISCOLAIRES NOVEMBRE 2019',
1576 1577
            'amount': 0,
1578
            'created': '2019-12-12',
1577 1579
            'total_amount': '44.94',
1578 1580
            'online_payment': False,
1579 1581
            'pay_limit_date': '',
1580 1582
            'has_pdf': False,
1581 1583
            'paid': False,
1582 1584
            'vendor': {
1583 1585
                'caluire-axel': {
1584 1586
                    'IDFACTURE': 43,
......
1723 1725
    assert resp.json['err'] == 0
1724 1726
    assert resp.json['data'] == {
1725 1727
        'id': 'historical-XXX-42',
1726 1728
        'display_id': '42',
1727 1729
        'label': 'PRESTATIONS PERISCOLAIRES SEPTEMBRE-OCTOBRE 2019',
1728 1730
        'amount': 0,
1729 1731
        'total_amount': '44.94',
1730 1732
        'online_payment': False,
1733
        'created': '2019-11-12',
1731 1734
        'pay_limit_date': '',
1732 1735
        'has_pdf': True,
1733 1736
        'paid': False,
1734 1737
        'vendor': {
1735 1738
            'caluire-axel': {
1736 1739
                'IDFACTURE': 42,
1737 1740
                'MONTANT': '44.94',
1738 1741
                'ENCAISSE': '40.00',
1739
-