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

Method Subtotal

Subscriure's

Get notified when there's activity on this post

This question has been flagged
2 Respostes
4422 Vistes
Avatar
yusuf

hi all,

I have a problem hearts Making subtotal method , the method for Only thing I can last column displays the data in Saja NOT want to add BETWEEN column 1 and column 2 , I 've Tried differences Only the results are still the same and this is the method that I created

 

def _get_total(self,a):
        total =0
        for o in a :
            total +=(o['cost_spare_part'] *o['jumlah'])
            print "ini total=================>>>>>>>>>>",total

        return total

0
Avatar
Descartar
Akhil P Sivan

Hi Akhil P Sivan [1] A variable is the name of the table on parts_lines or a = parts_lines in this parts_lines table I want to take the price of spare parts and the number but when I took the price ( standard_price ) that are on the object , but when I took my product.product standard_price even error a ={'jumlah': 2.0, 'asset_name': u'Kendaraan', 'plat_no': u'A 2338 AB', 'asset_no': u'1.11 Asset', 'tindakan': False, 'pelaksana': False, 'satuan': u'Unit(s)', 'permasalahan': u'as', 'spare_part': u'ban', 'tanggal': '2015-01-28 06:55:11', 'cost_spare_part': 50000.0} of the answer that you gave no error occurs, the error like this : for o in self : TypeError: 'history_maintenance' object is not iterable [1] https://www.odoo.com/forum/help-1/user/336884

Zbik

How and where you call _get_total?

yusuf
Autor

The method to call formatLang (get_total (o)) and this for at RML (report)

Akhil P Sivan

Hi Yusuf, I made a change in the answer. Please try like that. Are you can calling the 'part_lines' field as one2many from any other object? Where you want to get the 'total_cost' value returning from the function?

Avatar
Akhil P Sivan
Best Answer

Hi Yusuf,

 

Try like this:

 

def _get_total(self,a):
        total =0
        total += a.cost_spare_part * a.jumlah
        print "ini total=================>>>>>>>>>>",total

   return total

2
Avatar
Descartar
yusuf
Autor

Hi Akhil P Sivan, I already use the method that you created but in the method you created there is an error and this error mean what ? and this error : total +=a.cost_spare_part * a.jumlah AttributeError: 'dict' object has no attribute 'cost_spare_part'

Avatar
Zbik
Best Answer

If call is formatLang (get_total (o)), then o is main object of report, in this case you try:

for line in a.part_lines :
  total +=line.cost_spare_part * line.jumlah

What is your o? and how you use and define parts_lines in model and report?

UPDATE:

Try this, in RML;

formatLang (get_total (line(data))

and in code:

for line in a:
  total +=line.cost_spare_part * line.jumlah

or....  total +=line['cost_spare_part'] * line['jumlah']

0
Avatar
Descartar
yusuf
Autor

Hi zbik, I already use the method that you created but in the method you created there is an error and this error mean what ? and this error : for line in a.part_lines : AttributeError: 'dict' object has no attribute 'part_lines'

yusuf
Autor

this is rml in subtotal

[[repeatIn(line(data) ,'o')]] [[ no_urut() ]] [[ formatLang(o['tanggal'], date=True) ]] [ [[ o['asset_no'] ]] ] [[ o['asset_name'] ]] [[ o['plat_no'] ]] [[ o['permasalahan'] ]] [[ o['tindakan'] ]] [[ o['spare_part'] ]] [[ formatLang(o['cost_spare_part']) ]] [[ o['jumlah'] ]] [[ o['satuan'] ]] [[ formatLang(get_biaya(o)) ]] [[ o['pelaksana'] ]]
Subtotal [[ formatLang(get_total(o)) ]] .

Zbik

[[repeatIn(line(data) ,'o')]] ..... in this case "o" is only one line. It can not work. A list "o" is needed. What is the structure of the variable "data"?

yusuf
Autor

How to " o " could work because our time line in the loop for o.parts_lines then there is an error for the line in o.parts_lines object has no attribute Parts_lines

Zbik

answer updated

yusuf
Autor

how because I 've had some time messing about with " for " the result is still the same

Zbik

If line(data) return list? and in RML you use formatLang (get_total(line(data)) it should work.

yusuf
Autor

Hi zbik, thank you for helping me and the advice you give it turns out to work and once again I thank you , if I may be asked for your email ?

yusuf
Autor

Hi zbik, I have questions about the report in Excel, this is the case if we take the data period 1 then naturally arises automatically period to 1 but if you want to choose the period to 2 then automatically also the emergence of the period to 2, if for example, want to bring up the data period 1 in period 2?

Zbik

My email: darek@krokus.com.pl. I do not understand the last issue and additionaly what is the structure of your code and data.

yusuf
Autor

data record in period

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
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