It imports a product, create a supplier order, generate a supplier invoice, validate the invoice and add a payment in under a minute with minimum hassle.
I have also made another script for batch importing a cart csv from a supplier with 44 lines in a few minutes with almost no manual input.
The library behind the scene is at the time of writing a big class on 2500+ lines and currently support:
- inserting and reading from many Dolibarr objects (falling back on direct database editing when no REST API exist yet)
- calculating prices based on purchase prices
- fetching weight from a csv from the supplier
- fetching image-links from a supplier website
- handling of extrafields
- handling of multiprices
- handling of multicurrency
- reading supplier VAT rate from thirdparties extrafield
- …
I’m a freelancing developer. Feel free to contact me if you have any needs for automation that you want help with.
The full list of functions is:
def init
###################################
##### PYPI SUPPLIER SPECIFIC API ######
###################################
## GET ##
def get_correct_supplier_id_or_fail
def get_delivery_delay_or_exit
def get_supplier_tax_or_exit
def get_supplier_id
def get_product_by_id
## POST ##
def insert_payment_line_on_supplier_invoice
def validate_supplier_invoice
def create_supplier_invoice
def create_product
## PUT ##
def update_description
def update_weight
def retire_product
def unretire_product
##############################
####### SQL FUNCTIONS ########
##############################
def db_connect
def db_disconnect
## SELECT ##
def get_fk_multicurrency_or_exit
def find_codename
def get_stock_movements_by_fk_origin
def get_product_categories_with_ref_ext
def get_category_id_by_ref_ext
def list_tradera_categories
def has_tradera_category
def check_if_product_was_imported
def find_product_id_from_extrafield
def find_id_from_supplier_product_id
def get_purchase_data
## INSERT ##
def insert_link
def insert_dispatch_shipment
def insert_revert_stock_movement
def insert_purchase_prices_on_existing_products
def insert_category
def insert_purchase_price
def insert_product_extrafields
def insert_codename
def insert_multiprice
def insert_product_category
def yes_no_question
def insert_supplier_order
def insert_supplier_order_line
def already_scraped
## UPDATE ##
def update_supplier_order_to_approved_and_made
def update_invoice_prices
def update_order_totals
## REMOVE ##
def remove_purchase_prices
##############################
######### UTILITIES ##########
##############################
def response_to_int_or_fail
def ask_and_insert_categories
def get_supplier_order_details_or_exit
def ask_date
def prepare_and_create_new_product
def search_and_insert_tradera_category
def print_result
def extract_from_list_api_or_fail
def check_and_scrape_if_not_already_scraped
def scrape_picture
def clean_number_to_float
def clean_number_to_int
def empty_or_false
def extrafield
def empty_or_false_extrafield
def multiprices_ttc
def extract_and_convert_doli_weight
def producturl
def ask_int
def get_weight_from_supplier_data
def fallback_weight
def ask_mandatory
#####################################
##### SUPPLIER SPECIFIC ######
#####################################
def scrape_from_ms
## CSV ##
def get_weight_from_ms_file
def get_supplier_price_from_ms_file
def fetch_and_calculate_supplier_price
############################
##### SUPPLIER SPECIFIC ######
############################
def scrape_from_jo