Add support for product code (searchKey) to submitted via the Banqup API instead of leaving the field blank
This commit is contained in:
parent
5e31d0bd8d
commit
c52952998f
|
@ -6,6 +6,7 @@ to the Banqup API of Unifiedpost.
|
||||||
**Requirements**
|
**Requirements**
|
||||||
* Python installed on the machine running this application
|
* Python installed on the machine running this application
|
||||||
* Credentials for accessing an Openbravo 3+ instance running with the REST API enabled
|
* Credentials for accessing an Openbravo 3+ instance running with the REST API enabled
|
||||||
|
* The role in Openbravo used for the extraction/integration must have read access to 'Sales Invoices' and 'Product' via web services.
|
||||||
* Credentials for accessing the Banqup API by Unifiedpost
|
* Credentials for accessing the Banqup API by Unifiedpost
|
||||||
* Add the businessPartner id to the 'Customer code' of the customer on the 'Customers & Suppliers' section of the Banqup portal - This is critical, this programs requires this field to extract some parameters that only exist in the Banqup platform
|
* Add the businessPartner id to the 'Customer code' of the customer on the 'Customers & Suppliers' section of the Banqup portal - This is critical, this programs requires this field to extract some parameters that only exist in the Banqup platform
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,10 @@ def extract_invoice(document):
|
||||||
if not first_line:
|
if not first_line:
|
||||||
lines_output = lines_output+','
|
lines_output = lines_output+','
|
||||||
first_line = False
|
first_line = False
|
||||||
lines_output = lines_output + '{"service_name": "","service_description": "'+linetemp['product$_identifier']+'","service_quantity": '+str(linetemp['invoicedQuantity'])+',"service_price": '+str(linetemp['unitPrice'])+',"service_vat": '+gst_rate+'}'
|
url = ob_api_url+"Product?_where=id='"+linetemp['product']+"'&_noActiveFilter=false"
|
||||||
|
response = requests.request("GET", url, headers=headers, data=payload) #extracts product from master
|
||||||
|
product = json.loads(response.text)['response']['data'][0]['searchKey']
|
||||||
|
lines_output = lines_output + '{"service_name": "'+product+'","service_description": "'+linetemp['product$_identifier']+'","service_quantity": '+str(linetemp['invoicedQuantity'])+',"service_price": '+str(linetemp['unitPrice'])+',"service_vat": '+gst_rate+'}'
|
||||||
lines_output = lines_output+']'
|
lines_output = lines_output+']'
|
||||||
#print(lines_output)
|
#print(lines_output)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue