Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Bricoleur
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenir partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

precision decimal

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
decimalprintnumberodooV8
3627 Vues
Avatar
kiyuubi
Hello
I use odoo V8 on windows 7
I would like to add a decimal precision on the print state, for example 20000.0 to 20,000.00.
I tried everything but I did not succeed
attached my code:

## -*- coding: utf-8 -*-

import time
from openerp.report import report_sxw
from openerp.osv import osv
from openerp import pooler
import locale

class etat104(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(etat104, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'_get_etat': self._get_etat,
'_get_year': self._get_year,
'_cpt': self._cpt
})

def _cpt(self, ss):
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
if ss < 0.0 :
cpt = (locale.format('%.2f', ss, True))
cpt = '(' + cpt + ')'
else:
cpt = (locale.format('%.2f', ss, True))
return cpt

def _get_year(self,form):
return self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form).name

def _get_etat(self,form):
nbr = 0
fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear_id'])
period_ids=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear_id'])])

if period_ids:
self.cr.execute("SELECT MIN(date_start) AS date_start, MAX(date_stop) AS date_stop FROM account_period WHERE id = ANY(%s)", (period_ids,))
dates = self.cr.dictfetchall()
else:
dates = False
if dates:
if form['tri']==False :
query = "SELECT ai.partner_id as partner, SUM(aml.credit-aml.debit) as ht FROM account_invoice ai, account_move am,account_move_line aml, account_account aa where ai.state IN ('open','paid') "\
"AND ai.date_invoice >= '%s' AND ai.date_invoice <= '%s' AND ai.move_id=aml.move_id "\
"AND ai.move_id=am.id AND aml.account_id=aa.id AND aa.code like '%s' AND aa.code not like '%s' "\
"AND ai.type like '%s' GROUP BY partner" % (dates[0]['date_start'], dates[0]['date_stop'],'70%','706%','out_%')
else:
query = "SELECT ai.partner_id as partner,p.name as nom, SUM(aml.credit-aml.debit) as ht FROM account_invoice ai, account_move am,account_move_line aml, account_account aa, res_partner p where ai.state IN ('open','paid') "\
"AND ai.date_invoice >= '%s' AND ai.date_invoice <= '%s' AND ai.move_id=aml.move_id AND p.id=ai.partner_id "\
"AND ai.move_id=am.id AND aml.account_id=aa.id AND aa.code like '%s' AND aa.code not like '%s' "\
"AND ai.type like '%s' GROUP BY partner,nom ORDER BY nom" % (dates[0]['date_start'], dates[0]['date_stop'],'70%','706%','out_%')
# raise Warning(query)
# query = "SELECT ai.partner_id as partner, SUM(ai.amount_untaxed) as ht, SUM(ai.amount_tax) as tax ," \
# "CASE " \
# "WHEN type = 'out_refund' THEN SUM(ai.amount_untaxed) * -1 " \
# "WHEN type = 'out_invoice' THEN SUM(ai.amount_untaxed) " \
# "END ht," \
# "CASE " \
# "WHEN type = 'out_refund' THEN SUM(ai.amount_tax) * -1 " \
# "WHEN type = 'out_invoice' THEN SUM(ai.amount_tax) " \
# "END tax" \
# " FROM account_invoice ai WHERE ai.state IN ('open','paid') AND ai.date_invoice >= '%s' AND ai.date_invoice <= '%s'" \
# " AND ai.type like '%s' GROUP BY partner,ai.type ORDER BY partner" % (dates[0]['date_start'], dates[0]['date_stop'],'out_%')
# query3="SELECT ai.partner_id as partner, SUM(aml.debit) as ht FROM account_invoice ai,"\
# "account_move am,account_move_line aml, account_account aa where ai.state IN ('open','paid') "\
# "AND ai.date_invoice >= '2017-01-01' AND ai.move_id=aml.move_id "\
# "AND ai.move_id=am.id AND aml.account_id=aa.id GROUP BY partner"
res=[]
self.cr.execute(query)
datas = self.cr.dictfetchall()
obj_partner=self.pool.get('res.partner')
ref = ''
tht = ttax = 0.0
for dd in datas:
if dd['ht']==0.0:
continue
query="SELECT ai.partner_id as partner, SUM(aml.credit-aml.debit) as tax FROM account_invoice ai, account_move am,account_move_line aml, account_account aa where ai.state IN ('open','paid') "\
"AND ai.date_invoice >= '%s' AND ai.date_invoice <= '%s' and ai.move_id=aml.move_id "\
"and ai.move_id=am.id and aml.account_id=aa.id and aa.code = '445700' "\
"AND ai.type like '%s' AND ai.partner_id= '%s' GROUP BY partner" % (dates[0]['date_start'], dates[0]['date_stop'],'out_%',dd['partner'])
# raise Warning(query)
self.cr.execute(query)
datas2=self.cr.dictfetchall()
tax=0.0
# raise Warning(query)
for i in datas2:
tax=i['tax']
# raise Warning(query)
ttax+=tax
partner = obj_partner.read(self.cr, self.uid, dd['partner'], [])
ref = partner['name']
if form['reference'] == True:
if partner['ref'] :
ref= '[' + partner['ref'] + '] ' + partner['name']
else:
ref = partner['name']
p1=partner['street'] and partner['street'] or ''
p2=partner['city'] and partner['city'] or ''
rue = p1 +' '+ p2
tht += dd['ht']
nbr += 1
dicts={
'nbr': nbr,
'art' : partner['ai'],
'rc' : partner['rc'],
'nif' : partner['nif'],
'name': ref[0:20],
'rue' : rue[0:27],
'ht' : dd['ht'],
'tax' : tax,
'tht': tht,
'ttax': ttax
}
res.append(dicts)





# if len(data) > 0 :
# for dd in data:
# partner = obj_partner.read(self.cr, self.uid, dd['partner'], [])
# ref = partner['name']
# if form['reference'] == True:
# if partner['ref'] :
# ref= '[' + partner['ref'] + '] ' + partner['name']
# else:
# ref = partner['name']
# p1=partner['street'] and partner['street'] or ''
# p2=partner['city'] and partner['city'] or ''
# rue = p1 +' '+ p2
# tht += dd['ht']
# ttax += dd['tax']
# nbr += 1
# dicts={
# 'nbr': nbr,
# 'art' : partner['ai'],
# 'rc' : partner['rc'],
# 'nif' : partner['nif'],
# 'name': ref[0:20],
# 'rue' : rue[0:27],
# 'ht' : dd['ht'],
# 'tax' : dd['tax'],
# 'tht': tht,
# 'ttax': ttax
# }
# res.append(dicts)
# else:
# dicts={
# 'nbr' : 0,
# 'art' : '',
# 'rc' : '',
# 'nif' : '',
# 'name': '',
# 'rue' : '',
# 'ht' : 0.0,
# 'tax' : 0.0,
# 'tht' : 0.0,
# 'ttax': 0.0

# }
# res.append(dicts)

return res
###############################################################



report_sxw.report_sxw('report.l10n.dz.Etat-104', 'account.move.line', 'addons/l10n_dz_report/report/rmls/etat104.rml', parser=etat104, header=False)


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:



0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Invoice Report Multiple Journal Line Print Error Résolu
print report odooV8
Avatar
Avatar
Avatar
3
févr. 19
4771
report attribute explanation (in print a report context)
print attributes odooV8
Avatar
0
mai 17
8300
Multiple report on one button click
qweb print report odooV8
Avatar
Avatar
Avatar
Avatar
6
janv. 20
9127
Decimal view for Float odoo v8
decimal precision float odooV8
Avatar
0
août 17
4853
Is it possible to make a text-only report?
print reporting report odooV8
Avatar
0
nov. 15
4204
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenir partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now