imposible de creer une balance desequilibrer
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
792
Views
code :
def api(self):
for rec in self:
#9e3c90b3e3a71c64c768e11beb1873cc4f3122e4
#---------client
print('------API connect nafa--------')
# ----Connexion a NAFA -------
url = "https://finepgi.finetech.solutions"
db = "Nafa"
username = 'fine-pgi@finetechgroupe.com'
password = '9e3c90b3e3a71c64c768e11beb1873cc4f3122e4'
#------------Proxy authentificate
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
version = common.version()
print('details....',version)
uid = common.authenticate(db, username, password, {})
print('user id.....',uid)
print('----------------authentification status----------------')
if uid :
print("connexion Succes")
# --------------- Get Table data
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
#---------envoyer des donnees create record
move_vals = {
'name':rec.move_id.name,
'date':rec.move_id.date,
'journal_id':rec.move_id.journal_id.id,
'precomtetva':rec.move_id.precomtetva,
'ref':rec.move_id.ref,
'currency_id':rec.move_id.currency_id.id,
}
move_id = models.execute_kw(db, uid, password, 'account.move', 'create', [move_vals])
vals_1 = {
'date':rec.date,
'company_id':rec.company_id.id,
'journal_id':rec.journal_id.id,
'move_id':move_id or False,
'account_id':rec.account_id.id,
'partner_id':rec.partner_id.id,
'ref':rec.ref,
'name':rec.name,
'analytic_account_id':rec.analytic_account_id.id,
'tax_ids':rec.tax_ids.ids,
'debit':rec.debit,
'matching_number':rec.matching_number,
}
send_data_1 = models.execute_kw(db, uid, password, 'account.move.line', 'create', [vals_1])
vals_2 = {
'date':rec.date,
'company_id':rec.company_id.id,
'journal_id':rec.journal_id.id,
'move_id':move_id or False,
'account_id':rec.account_id.id,
'partner_id':rec.partner_id.id,
'ref':rec.ref,
'name':rec.name,
'analytic_account_id':rec.analytic_account_id.id,
'tax_ids':rec.tax_ids.ids,
'credit':rec.credit,
'matching_number':rec.matching_number,
}
send_data_2 = models.execute_kw(db, uid, password, 'account.move.line', 'create', [vals_2])
print('--Envoyés--:',send_data)
# update record
# write_id = 44458
# write_mobile = '707756267'
# models.execute_kw(db, uid, password, 'res.partner', 'write', [[write_id], {'vendor_type': "investissement",'mobile':write_mobile}])
# models.execute_kw(db, uid, password, 'res.partner', 'unlink', [[44460,44461]])
else:
print('connexion Echouer')
def synchroniser(self):
for rec in self:
rec.api()