Skip to content
Extraits de code Groupes Projets
Valider 318f7641 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[update] payment state pdf report

parent 179f843d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# © 2021 Le Filament (<http://www.le-filament.com>) # © 2021 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import itertools
from odoo import _, api, fields, models from odoo import _, api, fields, models
from odoo.exceptions import UserError from odoo.exceptions import UserError
...@@ -1350,10 +1352,23 @@ class Bordereau(models.Model): ...@@ -1350,10 +1352,23 @@ class Bordereau(models.Model):
""" """
Move = self.env["account.move"] Move = self.env["account.move"]
for bordereau in self: for bordereau in self:
payments = bordereau.invoice_ids.move_line_payment_ids.filtered( payment_ids = bordereau.invoice_ids.move_line_payment_ids.filtered(
lambda r: r.move_id.move_type == "entry" lambda r: r.move_id.move_type == "entry"
).sorted(lambda p: p.date) ).sorted(lambda p: p.date)
payments = []
for key, group in itertools.groupby(payment_ids, lambda p: p.date):
pay_ids = list(group)
credit = sum(list(map(lambda p: p.credit, pay_ids)))
debit = sum(list(map(lambda p: p.debit, pay_ids)))
payments.append(
{
"date": key,
"credit": credit,
"debit": debit,
}
)
schedule_plan = Move.read_group( schedule_plan = Move.read_group(
[ [
("bordereau_id", "=", bordereau.id), ("bordereau_id", "=", bordereau.id),
......
...@@ -261,33 +261,26 @@ ...@@ -261,33 +261,26 @@
> >
<td <td
style="border: none; background: inherit; color: inherit;" style="border: none; background: inherit; color: inherit;"
><t >
t-esc="payment.date" <t
t-esc="payment.get('date')"
t-options="{'widget': 'date', 'format': 'dd/MM/YYYY'}" t-options="{'widget': 'date', 'format': 'dd/MM/YYYY'}"
/></td> />
</td>
<td <td
class="text-right" class="text-right"
style="border: none; background: inherit; color: inherit;" style="border: none; background: inherit; color: inherit;"
> >
<t t-if="payment.credit > 0">
<t <t
t-esc="payment.credit" t-esc="payment.get('credit') - payment.get('debit')"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}" t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"
/> />
</t>
<t t-else="">
<t
t-esc="-payment.debit"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"
/>
</t>
</td> </td>
</tr> </tr>
</table> </table>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</t> </t>
</template> </template>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter