Add support for product code (searchKey) to submitted via the Banqup API instead of leaving the field blank

This commit is contained in:
Enrique Barcelli 2023-06-29 15:59:16 +08:00
parent 5e31d0bd8d
commit c52952998f
Signed by: kikobar
GPG key ID: 006C13A68E25D3B7
2 changed files with 5 additions and 1 deletions

View file

@ -6,6 +6,7 @@ to the Banqup API of Unifiedpost.
**Requirements**
* Python installed on the machine running this application
* 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
* 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

View file

@ -64,7 +64,10 @@ def extract_invoice(document):
if not first_line:
lines_output = lines_output+','
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+']'
#print(lines_output)