feat(tryton): add comment to tryton sale. #26
@@ -38,10 +38,12 @@ class SaleView(viewsets.ModelViewSet):
|
|||||||
date = data['date']
|
date = data['date']
|
||||||
lines = data['saleline_set']
|
lines = data['saleline_set']
|
||||||
payment_method = data['payment_method']
|
payment_method = data['payment_method']
|
||||||
|
description = data.get('notes', '')
|
||||||
sale = Sale.objects.create(
|
sale = Sale.objects.create(
|
||||||
customer=customer,
|
customer=customer,
|
||||||
date=date,
|
date=date,
|
||||||
payment_method=payment_method
|
payment_method=payment_method,
|
||||||
|
description=description
|
||||||
)
|
)
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class TestExportarVentasParaTryton(TestCase):
|
|||||||
customer=self.customer,
|
customer=self.customer,
|
||||||
date='2024-09-02',
|
date='2024-09-02',
|
||||||
payment_method='CASH',
|
payment_method='CASH',
|
||||||
|
description='un comentario'
|
||||||
)
|
)
|
||||||
self.sale_line1 = SaleLine.objects.create(
|
self.sale_line1 = SaleLine.objects.create(
|
||||||
product=self.product,
|
product=self.product,
|
||||||
@@ -71,7 +72,7 @@ class TestExportarVentasParaTryton(TestCase):
|
|||||||
self.assertEqual(next(csv_reader), expected_header)
|
self.assertEqual(next(csv_reader), expected_header)
|
||||||
|
|
||||||
expected_rows = [
|
expected_rows = [
|
||||||
["Camilo", "Camilo", "Camilo", "", "", "2024-09-02", "Contado", "Almacén", "Peso colombiano", "Panela", "2.00", "3000.00", "Unidad", "TIENDA LA ILUSIÓN", "Tienda La Ilusion", "La Ilusion", "True", ""],
|
["Camilo", "Camilo", "Camilo", "un comentario", "un comentario", "2024-09-02", "Contado", "Almacén", "Peso colombiano", "Panela", "2.00", "3000.00", "Unidad", "TIENDA LA ILUSIÓN", "Tienda La Ilusion", "La Ilusion", "True", "un comentario"],
|
||||||
["", "", "", "", "", "", "", "", "", "Panela", "3.00", "5000.00", "Unidad", "", "", "", "", ""],
|
["", "", "", "", "", "", "", "", "", "Panela", "3.00", "5000.00", "Unidad", "", "", "", "", ""],
|
||||||
]
|
]
|
||||||
csv_rows = list(csv_reader)
|
csv_rows = list(csv_reader)
|
||||||
@@ -100,4 +101,4 @@ class TestExportarVentasParaTryton(TestCase):
|
|||||||
self.assertEqual(updated_sale.external_id, external_id)
|
self.assertEqual(updated_sale.external_id, external_id)
|
||||||
mock_connect.assert_called_once()
|
mock_connect.assert_called_once()
|
||||||
mock_call.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, '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]}])
|
mock_call.assert_called_with('model.sale.sale.create', [[{'company': 1, 'shipment_address': '307', 'invoice_address': '307', 'currency': 31, 'comment': 'un comentario', '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]}])
|
||||||
|
|||||||
Reference in New Issue
Block a user