Initial commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
from proteus import config, Model
|
||||
from decimal import getcontext, Decimal, ROUND_HALF_UP
|
||||
|
||||
# XML-RPC Configuration
|
||||
HTTPS = 'https://'
|
||||
SERVER_URL = 'itsa.open-squared.tech'
|
||||
DATABASE_NAME = 'tradon'
|
||||
USERNAME = 'admin'
|
||||
PASSWORD = 'dsproject'
|
||||
|
||||
|
||||
config = config.set_xmlrpc(f'{HTTPS}{USERNAME}:{PASSWORD}@{SERVER_URL}/{DATABASE_NAME}/')
|
||||
|
||||
Company = Model.get('company.company')
|
||||
Party = Model.get('party.party')
|
||||
Currency = Model.get('currency.currency')
|
||||
sale = Model.get('sale.sale')
|
||||
Product = Model.get('product.product')
|
||||
Wb = Model.get('purchase.weight.basis')
|
||||
Location = Model.get('stock.location')
|
||||
|
||||
# Récupération des records
|
||||
company = Company(6)
|
||||
party = Party(2789)
|
||||
fromLocation = Location(1247)
|
||||
|
||||
# Création de la commande de vente
|
||||
sale = sale()
|
||||
sale.company = company
|
||||
sale.party = party
|
||||
sale.currency = company.currency
|
||||
sale.tol_min = Decimal(1)
|
||||
sale.wb = Wb(1)
|
||||
sale.from_location = fromLocation
|
||||
# Ligne d'achat
|
||||
#product = Product(12) # id du produit
|
||||
# line = sale.lines.new()
|
||||
# line.product = product
|
||||
# line.quantity = 10
|
||||
# line.unit_price = product.cost_price
|
||||
|
||||
# Sauvegarde
|
||||
sale.save()
|
||||
|
||||
print(f"sale créée : {sale.id}")
|
||||
Reference in New Issue
Block a user