From f02f754ae7385b0613001a16bae421aab5e9ec5a Mon Sep 17 00:00:00 2001 From: Mono Mono Date: Fri, 5 Sep 2025 20:24:13 -0500 Subject: [PATCH] feat(tryton): add payment method to tryton sale description. --- tienda_ilusion/don_confiao/api_views.py | 5 ++++- .../don_confiao/tests/test_exportar_ventas_para_tryton.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tienda_ilusion/don_confiao/api_views.py b/tienda_ilusion/don_confiao/api_views.py index a41f15a..4f7737e 100644 --- a/tienda_ilusion/don_confiao/api_views.py +++ b/tienda_ilusion/don_confiao/api_views.py @@ -233,7 +233,10 @@ class TrytonSale: "shipment_address": self.sale.customer.address_external_id, "invoice_address": self.sale.customer.address_external_id, "currency": TRYTON_COP_CURRENCY, - "description": self.sale.description or '', + "comment": self.sale.description or '', + "description": "Metodo pago: " + str( + self.sale.payment_method or '' + ), "party": self.sale.customer.external_id, "reference": "don_confiao " + str(self.sale.id), "sale_date": self._format_date(self.sale.date), diff --git a/tienda_ilusion/don_confiao/tests/test_exportar_ventas_para_tryton.py b/tienda_ilusion/don_confiao/tests/test_exportar_ventas_para_tryton.py index b782340..94c3a76 100644 --- a/tienda_ilusion/don_confiao/tests/test_exportar_ventas_para_tryton.py +++ b/tienda_ilusion/don_confiao/tests/test_exportar_ventas_para_tryton.py @@ -100,4 +100,4 @@ class TestExportarVentasParaTryton(TestCase): self.assertEqual(updated_sale.external_id, external_id) mock_connect.assert_called_once() mock_call.assert_called_once() - mock_call.assert_called_with('model.sale.sale.create', [[{'company': 1, 'shipment_address': '307', 'invoice_address': '307', 'currency': 31, 'description': '', 'party': '1', 'reference': 'don_confiao 1', 'sale_date': {'__class__': 'date', 'year': 2024, 'month': 9, 'day': 2}, 'lines': [['create', [{'product': '1', 'quantity': {'__class__': 'Decimal', 'decimal': '2.00'}, 'type': 'line', 'unit': '1', 'unit_price': {'__class__': 'Decimal', 'decimal': '3000.00'}}, {'product': '1', 'quantity': {'__class__': 'Decimal', 'decimal': '3.00'}, 'type': 'line', 'unit': '1', 'unit_price': {'__class__': 'Decimal', 'decimal': '5000.00'}}]]], 'self_pick_up': True}], {'company': 1, 'shops': [1]}]) + mock_call.assert_called_with('model.sale.sale.create', [[{'company': 1, 'shipment_address': '307', 'invoice_address': '307', 'currency': 31, 'comment': '', 'description': 'Metodo pago: CASH', 'party': '1', 'reference': 'don_confiao 1', 'sale_date': {'__class__': 'date', 'year': 2024, 'month': 9, 'day': 2}, 'lines': [['create', [{'product': '1', 'quantity': {'__class__': 'Decimal', 'decimal': '2.00'}, 'type': 'line', 'unit': '1', 'unit_price': {'__class__': 'Decimal', 'decimal': '3000.00'}}, {'product': '1', 'quantity': {'__class__': 'Decimal', 'decimal': '3.00'}, 'type': 'line', 'unit': '1', 'unit_price': {'__class__': 'Decimal', 'decimal': '5000.00'}}]]], 'self_pick_up': True}], {'company': 1, 'shops': [1]}])