fix(Tryton Shop): add shops.
This commit is contained in:
		| @@ -18,6 +18,9 @@ TRYTON_HOST = os.environ.get('TRYTON_HOST', 'localhost') | ||||
| TRYTON_DATABASE = os.environ.get('TRYTON_DATABASE', 'tryton') | ||||
| TRYTON_USERNAME = os.environ.get('TRYTON_USERNAME', 'admin') | ||||
| TRYTON_PASSWORD = os.environ.get('TRYTON_PASSWORD', 'admin') | ||||
| TRYTON_COP_CURRENCY = 31 | ||||
| TRYTON_COMPANY_ID = 1 | ||||
| TRYTON_SHOPS = [1] | ||||
|  | ||||
|  | ||||
| class Pagination(PageNumberPagination): | ||||
| @@ -183,7 +186,8 @@ class SalesToTrytonView(APIView): | ||||
|         ) | ||||
|         tryton_client.connect() | ||||
|         method = 'model.sale.sale.create' | ||||
|         tryton_context = {} | ||||
|         tryton_context = {'company': TRYTON_COMPANY_ID, | ||||
|                           'shops': TRYTON_SHOPS} | ||||
|  | ||||
|         successful = [] | ||||
|         failed = [] | ||||
| @@ -219,10 +223,10 @@ class TrytonSale: | ||||
|  | ||||
|     def to_tryton(self): | ||||
|         return { | ||||
|             "company": 1, | ||||
|             "company": TRYTON_COMPANY_ID, | ||||
|             "shipment_address": self.sale.customer.address_external_id, | ||||
|             "invoice_address": self.sale.customer.address_external_id, | ||||
|             "currency": 1, | ||||
|             "currency": TRYTON_COP_CURRENCY, | ||||
|             "description": self.sale.description or '', | ||||
|             "party": self.sale.customer.external_id, | ||||
|             "reference": "don_confiao " + str(self.sale.id), | ||||
|   | ||||
| @@ -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': '1', 'invoice_address': '1', 'currency': 1, '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'}}]]]}], {}]) | ||||
|         mock_call.assert_called_with('model.sale.sale.create', [[{'company': 1, 'shipment_address': '1', 'invoice_address': '1', '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'}}]]]}], {'company': 1, 'shops': [1]}]) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user