|
4 | 4 | <t t-call="account.report_payment_receipt_document" position="attributes"> |
5 | 5 | <attribute name="t-call">#{ o._get_name_receipt_report('account.report_payment_receipt_document') }</attribute> |
6 | 6 | </t> |
| 7 | + <t t-set="lang" position="after"> |
| 8 | + <t t-set="payment_bundle" t-value="o"/> |
| 9 | + </t> |
| 10 | + </template> |
| 11 | + |
| 12 | + <template id="report_payment_receipt_bundle"> |
| 13 | + <t t-call="web.html_container"> |
| 14 | + <t t-foreach="docs._get_payment_bundles().values()" t-as="payment_bundle"> |
| 15 | + <t t-set="o" t-value="payment_bundle[0]"/> |
| 16 | + <t t-set="lang" t-value="o.partner_id.lang or o.company_id.partner_id.lang"/> |
| 17 | + <t t-call="#{o._get_name_receipt_report('account.report_payment_receipt_document')}" t-lang="lang"/> |
| 18 | + </t> |
| 19 | + </t> |
7 | 20 | </template> |
8 | 21 |
|
9 | 22 | <!-- we force priority greater than 16 so that it dont break inheritance of report_saleorder_document_inherit_sale_stock. with this we are loosing the incoterm field added but that sale_stock view --> |
|
72 | 85 | </tr> |
73 | 86 | </thead> |
74 | 87 | <tbody> |
75 | | - <t t-foreach="o._get_latam_checks()" t-as="check"> |
76 | | - <tr> |
77 | | - <td> |
78 | | - <span t-out="'Cheque nro %s' % (check.name)">Check nro 123456</span> |
79 | | - <span t-if="check.bank_id" t-out="' - %s' % (check.bank_id.name)"> - Santander Rio</span> |
80 | | - <span t-if="o.payment_method_code == 'own_checks'" t-out="' (%s)' % (check.payment_method_line_id.name)"> (Chequera electrónica)</span> |
81 | | - <span t-if="check.payment_date"> - Venc. <span t-field="check.payment_date"/></span> |
82 | | - </td> |
83 | | - <td class="text-right" t-if="secondary_currency"> |
84 | | - <span class="text-nowrap" t-out="check.amount if o.other_currency else secondary_currency.round(check.amount / secondary_currency_rate)" t-options='{"widget": "monetary", "display_currency": secondary_currency}'/> |
85 | | - </td> |
86 | | - <td class="text-right o_price_total"> |
87 | | - <span class="text-nowrap" t-out="o.company_currency_id.round(check.amount * secondary_currency_rate) if o.other_currency else check.amount" t-options='{"widget": "monetary", "display_currency": o.company_currency_id}'/> |
88 | | - </td> |
89 | | - </tr> |
| 88 | + <t t-foreach="payment_bundle" t-as="doc"> |
| 89 | + <t t-foreach="doc._get_latam_checks()" t-as="check"> |
| 90 | + <tr> |
| 91 | + <td> |
| 92 | + <span t-out="'Cheque nro %s' % (check.name)">Check nro 123456</span> |
| 93 | + <span t-if="check.bank_id" t-out="' - %s' % (check.bank_id.name)"> - Santander Rio</span> |
| 94 | + <span t-if="doc.payment_method_code == 'own_checks'" t-out="' (%s)' % (check.payment_method_line_id.name)"> (Chequera electrónica)</span> |
| 95 | + <span t-if="check.payment_date"> - Venc. <span t-field="check.payment_date"/></span> |
| 96 | + </td> |
| 97 | + <td class="text-right" t-if="secondary_currency"> |
| 98 | + <span class="text-nowrap" t-out="check.amount if o.other_currency else secondary_currency.round(check.amount / secondary_currency_rate)" t-options='{"widget": "monetary", "display_currency": secondary_currency}'/> |
| 99 | + </td> |
| 100 | + <td class="text-right o_price_total"> |
| 101 | + <span class="text-nowrap" t-out="doc.company_currency_id.round(check.amount * secondary_currency_rate) if doc.other_currency else check.amount" t-options='{"widget": "monetary", "display_currency": o.company_currency_id}'/> |
| 102 | + </td> |
| 103 | + </tr> |
| 104 | + </t> |
90 | 105 | </t> |
91 | | - <t t-foreach="o.l10n_ar_withholding_line_ids" t-as="line"> |
| 106 | + <t t-foreach="payment_bundle.l10n_ar_withholding_line_ids" t-as="line"> |
92 | 107 | <tr> |
93 | 108 | <td> |
94 | 109 | <span t-if="line.tax_id.l10n_ar_tax_type in ['earnings', 'earnings_scale']" t-out="line.tax_id.invoice_label or 'Retención Ganancias'"/> |
95 | 110 | <span t-else="" t-out="line.tax_id.invoice_label or line.tax_id.name"/> |
96 | 111 | </td> |
97 | 112 | <td class="text-right" t-if="secondary_currency"> |
| 113 | + <!-- TODO t t-set="line_secondary_currency_rate" t-value="o.exchange_rate if o.other_currency else o.counterpart_exchange_rate"/--> |
| 114 | + |
98 | 115 | <span class="text-nowrap" t-out="secondary_currency.round(line.amount / secondary_currency_rate)" t-options='{"widget": "monetary", "display_currency": secondary_currency}'/> </td> |
99 | 116 | <td class="text-right o_price_total"> |
100 | 117 | <span class="text-nowrap" t-field="line.amount"/> |
|
116 | 133 | </td> |
117 | 134 | </tr> |
118 | 135 | </t> --> |
119 | | - <tr t-if="o.write_off_amount"> |
120 | | - <td> |
121 | | - <span t-out="o.write_off_type_id.label or o.write_off_type_id.name"/> |
122 | | - </td> |
123 | | - <td class="text-right" t-if="secondary_currency"> |
124 | | - <span class="text-nowrap" t-out="secondary_currency.round(o.write_off_amount / secondary_currency_rate)" t-options='{"widget": "monetary", "display_currency": secondary_currency}'/> </td> |
125 | | - <td class="text-right o_price_total"> |
126 | | - <span class="text-nowrap" t-field="o.write_off_amount"/> |
127 | | - </td> |
128 | | - </tr> |
129 | | - <tr t-if="not o._is_latam_check_payment()"> |
130 | | - <td> |
131 | | - <span t-field="o.journal_id.name"/> |
132 | | - </td> |
133 | | - <td class="text-right" t-if="secondary_currency"> |
134 | | - <span class="text-nowrap" t-out="o.amount_signed if o.other_currency else secondary_currency.round(o.amount / secondary_currency_rate)" t-options='{"widget": "monetary", "display_currency": secondary_currency}'/> </td> |
135 | | - <td class="text-right o_price_total"> |
136 | | - <span class="text-nowrap" t-out="o.company_currency_id.round(o.amount * secondary_currency_rate) if o.other_currency else o.amount" t-options='{"widget": "monetary", "display_currency": o.company_currency_id}'/> |
137 | | - </td> |
138 | | - </tr> |
| 136 | + <t t-foreach="payment_bundle.filtered('write_off_amount')" t-as="doc"> |
| 137 | + <tr > |
| 138 | + <td> |
| 139 | + <span t-out="doc.write_off_type_id.label or doc.write_off_type_id.name"/> |
| 140 | + </td> |
| 141 | + <td class="text-right" t-if="secondary_currency"> |
| 142 | + <!-- TODO t t-set="line_secondary_currency_rate" t-value="o.exchange_rate if o.other_currency else o.counterpart_exchange_rate"/--> |
| 143 | + <span class="text-nowrap" t-out="secondary_currency.round(doc.write_off_amount / secondary_currency_rate)" t-options='{"widget": "monetary", "display_currency": secondary_currency}'/> </td> |
| 144 | + <td class="text-right o_price_total"> |
| 145 | + <span class="text-nowrap" t-field="doc.write_off_amount"/> |
| 146 | + </td> |
| 147 | + </tr> |
| 148 | + </t> |
| 149 | + <t t-foreach="payment_bundle.filtered(lambda x: not x._is_latam_check_payment())" t-as="doc"> |
| 150 | + <tr> |
| 151 | + <td> |
| 152 | + <span t-field="doc.journal_id.name"/> |
| 153 | + </td> |
| 154 | + <td class="text-right" t-if="secondary_currency"> |
| 155 | + <span class="text-nowrap" t-out="doc.amount_signed if doc.other_currency else secondary_currency.round(doc.amount / secondary_currency_rate)" t-options='{"widget": "monetary", "display_currency": secondary_currency}'/> </td> |
| 156 | + <td class="text-right o_price_total"> |
| 157 | + <span class="text-nowrap" t-out="doc.company_currency_id.round(doc.amount * secondary_currency_rate) if doc.other_currency else doc.amount" t-options='{"widget": "monetary", "display_currency": doc.company_currency_id}'/> |
| 158 | + </td> |
| 159 | + </tr> |
| 160 | + </t> |
139 | 161 | </tbody> |
140 | 162 | <tfoot> |
141 | 163 | <tr> |
142 | 164 | <td><strong><span>Total Pagado</span></strong></td> |
143 | 165 | <td class="text-right" t-if="secondary_currency"> |
144 | | - <strong><span class="text-nowrap" t-out="secondary_currency.round(o.payment_total / secondary_currency_rate)" t-options="{'widget': 'monetary', 'display_currency': secondary_currency}"/></strong> |
| 166 | + <strong><span class="text-nowrap" t-out="secondary_currency.round(sum(payment_bundle.mapped('payment_total')) / secondary_currency_rate)" t-options="{'widget': 'monetary', 'display_currency': secondary_currency}"/></strong> |
145 | 167 | </td> |
146 | 168 | <td class="text-right"> |
147 | | - <strong><span class="text-nowrap" t-field="o.payment_total"/></strong> |
| 169 | + <strong><span class="text-nowrap" t-out="sum(payment_bundle.mapped('payment_total'))" t-options="{'widget': 'monetary', 'display_currency': o.company_currency_id}"/></strong> |
148 | 170 | </td> |
149 | 171 | </tr> |
150 | 172 | </tfoot> |
|
160 | 182 | </tr> |
161 | 183 | </thead> |
162 | 184 | <tbody> |
163 | | - <t t-foreach="o.with_context(matched_payment_ids=o.ids).matched_move_line_ids" t-as="line"> |
| 185 | + <t t-foreach="payment_bundle.with_context(matched_payment_ids=payment_bundle.ids).mapped('matched_move_line_ids')" t-as="line"> |
164 | 186 | <tr> |
165 | 187 | <td><span t-field='line.move_id.display_name'/></td> |
166 | 188 | <td class="text-center"> |
|
174 | 196 | </td> |
175 | 197 | </tr> |
176 | 198 | </t> |
177 | | - <tr t-if="o.unmatched_amount"> |
| 199 | + <tr t-if="sum(payment_bundle.mapped('unmatched_amount'))"> |
178 | 200 | <td>A cuenta</td> |
179 | 201 | <td class="text-center"/> |
180 | 202 | <td class="text-right o_price_total"/> |
181 | 203 | <td class="text-right o_price_total"> |
182 | | - <span class="text-nowrap" t-field="o.unmatched_amount"/> |
| 204 | + <span class="text-nowrap" t-out="sum(payment_bundle.mapped('unmatched_amount'))" t-options="{'widget': 'monetary', 'display_currency': o.company_currency_id}" /> |
183 | 205 | </td> |
184 | 206 | </tr> |
185 | 207 | </tbody> |
186 | 208 | <tfoot> |
187 | 209 | <tr> |
188 | 210 | <td colspan="3"><strong><span>Total Imputado</span></strong></td> |
189 | 211 | <td class="text-right"> |
190 | | - <strong><span class="text-nowrap" t-out="o.unmatched_amount + o.matched_amount" t-options='{"widget": "monetary", "display_currency": o.company_currency_id}'/></strong> |
| 212 | + <strong><span class="text-nowrap" t-out="sum(payment_bundle.mapped('matched_amount')) + sum(payment_bundle.mapped('unmatched_amount'))" t-options='{"widget": "monetary", "display_currency": o.company_currency_id}'/></strong> |
191 | 213 | <!-- <strong><span class="text-nowrap" t-out="o.matched_amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/></strong> --> |
192 | 214 | </td> |
193 | 215 | </tr> |
|
242 | 264 | </div> |
243 | 265 | </template> |
244 | 266 |
|
| 267 | + <record id="action_report_receipt_bundle" model="ir.actions.report"> |
| 268 | + <field name="name">Payment Receipt bundled</field> |
| 269 | + <field name="model">account.payment</field> |
| 270 | + <field name="report_type">qweb-pdf</field> |
| 271 | + <field name="report_name">l10n_ar_tax.report_payment_receipt_bundle</field> |
| 272 | + <field name="report_file">l10n_ar_tax.report_payment_receipt_bundle</field> |
| 273 | + <field name="binding_model_id" ref="model_account_payment"/> |
| 274 | + <field name="binding_type">report</field> |
| 275 | + <field name="binding_view_types">list</field> |
| 276 | + </record> |
| 277 | + |
245 | 278 | </odoo> |
0 commit comments