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