~unifield-team/unifield-wm/us-738

« back to all changes in this revision

Viewing changes to vertical_integration/report/hq_report_ocba.py

  • Committer: jf
  • Date: 2015-12-04 08:57:45 UTC
  • mfrom: (2692.2.1 unifield-wm)
  • Revision ID: jfb@tempo-consulting.fr-20151204085745-fymv6zyh2cx943tp
US-781 [FIX] OCBA VI: shrink entries credit/debit inverted
lp:~unifield-team/unifield-wm/us-781

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
                    'ids': [],  # shrinked ids
73
73
                }
74
74
 
75
 
            # sum/append shrink amount/ids
 
75
            # sum shrink entries balance (per above key)
76
76
            build_data['shrink'][key]['booking'] += \
77
77
                r.debit_currency - r.credit_currency
78
78
            build_data['shrink'][key]['func'] += r.debit - r.credit
114
114
        if entry_data['booking'] == 0. and entry_data['func'] == 0.:
115
115
            # skip null entry
116
116
            return
117
 
        booking = entry_data['booking']
118
 
        func = entry_data['func']
 
117
        # as we work in balance (debit - credit), <0 balance means credit
 
118
        is_debit = False if entry_data['booking'] < 0. else True
 
119
        booking = abs(entry_data['booking'])
 
120
        func = abs(entry_data['func'])
119
121
 
120
122
        # auto seq number for shrink entry
121
123
        period = build_data['period']
151
153
            'Partner DB ID': '',
152
154
            'Destination': '',
153
155
            'Cost Centre': '',
154
 
            'Booking Debit': self._enc_amount(booking, debit=True),
155
 
            'Booking Credit': self._enc_amount(booking, debit=False),
 
156
            'Booking Debit': self._enc_amount(is_debit and booking or 0.),
 
157
            'Booking Credit': self._enc_amount(not is_debit and booking or 0.),
156
158
            'Booking Currency': self._enc(ccy_name or ''),
157
 
            'Functional Debit': self._enc_amount(func, debit=True),
158
 
            'Functional Credit': self._enc_amount(func, debit=False),
 
159
            'Functional Debit': self._enc_amount(is_debit and func or 0.),
 
160
            'Functional Credit': self._enc_amount(not is_debit and func or 0.),
159
161
            'Functional Currency': self._enc(build_data['functional_ccy_name']),
160
162
            'Exchange rate': self._enc_amount(rate,
161
163
                digits=self._EXCHANGE_RATE_DIGITS),