Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

precision decimal

Subscriure's

Get notified when there's activity on this post

This question has been flagged
decimalprintnumberodooV8
3409 Vistes
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
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Invoice Report Multiple Journal Line Print Error Solved
print report odooV8
Avatar
Avatar
Avatar
3
de febr. 19
4449
report attribute explanation (in print a report context)
print attributes odooV8
Avatar
0
de maig 17
7950
Multiple report on one button click
qweb print report odooV8
Avatar
Avatar
Avatar
Avatar
6
de gen. 20
8790
Decimal view for Float odoo v8
decimal precision float odooV8
Avatar
0
d’ag. 17
4492
Is it possible to make a text-only report?
print reporting report odooV8
Avatar
0
de nov. 15
3701
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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