#17 feat(API): add external id to sales on api.

This commit is contained in:
Mono Mono 2025-08-30 15:28:50 -05:00
parent e17b8f6973
commit 604bbd3ab9
2 changed files with 14 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class SaleSerializer(serializers.ModelSerializer):
class Meta:
model = Sale
fields = ['id', 'customer', 'date', 'saleline_set',
'total', 'payment_method']
'total', 'payment_method', 'external_id']
class ProductSerializer(serializers.ModelSerializer):

View File

@ -73,6 +73,19 @@ class TestAPI(APITestCase):
json_response[0]['external_id']
)
def test_get_sales(self):
url = '/don_confiao/api/sales/'
self._create_sale()
response = self.client.get(url)
json_response = json.loads(response.content.decode('utf-8'))
self.assertEqual(response.status_code, 200)
self.assertEqual(self.customer.id, json_response[0]['customer'])
self.assertEqual(
None,
json_response[0]['external_id']
)
def test_get_sales_for_tryton(self):
url = '/don_confiao/api/sales/for_tryton'
self._create_sale()