Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

TypeError: 'int' object is not iterable RML

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
rmlopenerp7
18 Antworten
9663 Ansichten
Avatar
Rihene

Hi my friends!!

I am working with RML in OpenER

In fact, i am creating two loop functions.

The first is to know the size of my array and divide it by 6 as bellow:

def get_employee_taille(self, company_id, date_start, date_end, context=None):

res_list=[]

res_list2=[]

i = 0

obj2 = company_id.id

payslip_line = self.pool.get('hr.payslip')

obj_ids = payslip_line.search(self.cr, self.uid, [('date_from', '=', date_start), ('date_to', '=', date_end), ('company_id', '=', obj2)])

for res in payslip_line.read(self.cr, self.uid, obj_ids, ['id', 'employee_id'], context=False):

print res['employee_id'][1]

obj = {}

obj['name'] = res['employee_id'][1]

res_list.append(obj)

taille = len (res_list) / 6

print taille

return taille

And the second is to give the array a position start and the number of columns that it have to contain.

def get_employee_lines(self, company_id, date_start, date_end, start_position, number_of_columns, context=None):
print ('--------------------MOMO----------------------')
i = 0
res_list=[]
print ('--------------------test me----------------------')
print company_id
obj2 = company_id.id
payslip_line = self.pool.get('hr.payslip')
print payslip_line
obj_ids = payslip_line.search(self.cr, self.uid, [('date_from', '=', date_start), ('date_to', '=', date_end), ('company_id', '=', obj2)])
print obj_ids
for res in payslip_line.read(self.cr, self.uid, obj_ids, ['id', 'employee_id','seetek_worked_day','hours_overtime_100','seetek_absence_day','total_brut','retenue_source','net_payer'], context=False):
print res['employee_id'][1]
obj = {}
obj['name'] = res['employee_id'][1]
obj['matricule'] = str (res['employee_id'][0])
obj['presence'] = str (res['seetek_worked_day'])
obj['heures_sup'] = str (res['hours_overtime_100'])
obj['absence'] = str (res['seetek_absence_day'])
obj['total_brut'] = str (res['total_brut'])
obj['retenue_source'] = str ( - res['retenue_source'])
obj['net_payer'] = str (res['net_payer'])
obj['cnss_sal'] = str (res['total_brut'] * 9.18)
obj['cnss_pat'] = str (res['total_brut'] * 16.57)
obj['salaire_imposable'] = str ( -res['total_brut'] * (1-9.18))
res_list.append(obj)
print res_list
print res_list[0:2]
end_position = start_position + number_of_columns
return res_list[start_position:end_position]

Now, in my rml, i want to create a report which will give me the list of employees but with 6 employees per page.

<section>

<blockTable colwidths="150,100,100,100,100,100" style="Table1">

<section>

<para style="P7">[[ repeatIn(get_employee_taille(example.company_id,example.date_start,example.date_end), 'o') ]]</para>

<tr>

<td>

<para style="P8">NOM EMPLOYÉ</para>

</td>

<td>

<para style="P7">[[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end, 0, 6), 'o', 'td') ]]</para>

<para style="P7">[[ o['name'] ]]</para>

</td>

</tr>

</section>

I have tried this but it doesnt work and give me this error:

TypeError: 'int' object is not iterable

Help please help help help help

0
Avatar
Verwerfen
Pawan

Drees,
Are you returning the list well from py file??
if no, please check it by printing list what u r returning before return statement. and please provide that print data if possible

Rihene
Autor

pawan which function are you talking about the first one or the second

Rihene
Autor

i have changed in the first function return taille to return [taille] and when i print it i got [1]

Rihene
Autor

Pawan what i want to do is to print the list of employees but with two nested loop where the first one is to print 6 columns per page :/

Pawan

Why are u calling that function(first one), i can't see its any use in rml/py file...
please print second function result too

Rihene
Autor

I have print or you this print res_list[0:6] so i have got this [{'total_brut': '1000.0', 'name': u'ABDELWAHED RIHENE', 'presence': '0', 'salaire_imposable': '8180.0', 'net_payer': '442.558', 'absence': '0', 'retenue_source': '465.642', 'cnss_sal': '9180.0', 'cnss_pat': '16570.0', 'matricule': '2', 'heures_sup': '0'}, {'total_brut': '1000.0', 'name': u'ADNANE BEN YOUSSEF', 'presence': '0', 'salaire_imposable': '8180.0', 'net_payer': '442.558', 'absence': '0', 'retenue_source': '465.642', 'cnss_sal': '9180.0', 'cnss_pat': '16570.0', 'matricule': '4', 'heures_sup': '0'}, {'total_brut': '1000.0', 'name': u'AMINE MSAKNI ', 'presence': '0', 'salaire_imposable': '8180.0', 'net_payer': '442.558', 'absence': '0', 'retenue_source': '465.642', 'cnss_sal': '9180.0', 'cnss_pat': '16570.0', 'matricule': '5', 'heures_sup': '0'}, {'total_brut': '1000.0', 'name': u'AYMEN HAMROUNI', 'presence': '0', 'salaire_imposable': '8180.0', 'net_payer': '442.558', 'absence': '0', 'retenue_source': '465.642', 'cnss_sal': '9180.0', 'cnss_pat': '16570.0', 'matricule': '6', 'heures_sup': '0'}, {'total_brut': '1000.0', 'name': u'JINENE HEDFI', 'presence': '0', 'salaire_imposable': '8180.0', 'net_payer': '442.558', 'absence': '0', 'retenue_source': '465.642', 'cnss_sal': '9180.0', 'cnss_pat': '16570.0', 'matricule': '7', 'heures_sup': '0'}, {'total_brut': '1000.0', 'name': u'MOHAMED JRIBI', 'presence': '0', 'salaire_imposable': '8180.0', 'net_payer': '442.558', 'absence': '0', 'retenue_source': '465.642', 'cnss_sal': '9180.0', 'cnss_pat': '16570.0', 'matricule': '3', 'heures_sup': '0'}]

Pawan

Drees, please change the variable, 'o' with 'p' or something else in :
[[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end, 0, 6), 'o', 'td') ]]
and,
[[ o['name'] ]]
in rml file....

Rihene
Autor

i have changed it but nothing happens

Rihene
Autor

pawan in my list i have 7 employees and i want to display 3 employees per page :/

Pawan

Drees, Are you using the 'o' from first function ([[ repeatIn(get_employee_taille(example.company_id,example.date_start,example.date_end), 'o') ]]), anywhere in your code??
since i can't see its use anywhere..... and everything else is seeming fine only for the error u said is raising(TypeError: 'int' object is not iterable)

Rihene
Autor

Here is my RML:

[[ repeatIn(get_employee_taille(example.company_id,example.date_start,example.date_end), 'p') ]] NOM EMPLOYÉ [[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end, 0, 6), 'p', 'td') ]] [[ p['name'] ]]
Now i have got this:2015-09-08 11:53:42,969 6510 ERROR openerp openerp.service.web_services: Exception: <LongTable@0x7FDDE6488F38 0 rows x unknown cols>... must have at least a row and column

Rihene
Autor

The problem here is that in repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end, 0, 6), 'p', 'td') ]] i dont want to pass the start_position and number of columns. its static i want him give me in each page 6 employees :/

Pawan

In , you have given widths for 5 cols(colwidths="150,100,100,100,100,100"), but inside that

you are having 2 only.
Second , for your error, after second "" tag([[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end, 0, 6), 'o', 'td') ]]) you are not having any which is expected by rml parser.
These are reasons... i think...
Rihene
Autor

So what shall i do please :/ help me pawan

Pawan

Drees, it would be very nice if i can help you, but we have to go through your code, if u want then you can drop ur skype id at my email, i will contact u there asap. :)

Rihene
Autor

here is my mail pawan : abdelwahed_rihene@yahoo.fr

Rihene
Autor

i want to display x columns per page but i dont know how please try to help me my friend

Avatar
Rihene
Autor Beste Antwort

Hello!!!!

Finally i have got the answer :)

Here is the RML code:

<blockTable colwidths="150,100,100,100,100,100" style="Table1">

<tr>

<td>

<para style="P8">NOM EMPLOYÉ</para>

</td>

<td>

<para style="P8">MATRICULE</para>

</td>

<td>

<para style="P7">[[ repeatIn(repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'p', 'td'),'o') ]]</para>

<para style="P7">[[ repeatIn(o['p'], 'line', 'td') ]]</para>

<para style="P7">[[ line['name'] ]]</para>

<para style="P7">[[ line['matricule'] ]]</para>

</td>

</tr>

</blockTable>

Best Regards.

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Spliting rml intotwo halves
rml openerp7
Avatar
0
Apr. 18
3327
How to add condation in rml
rml openerp7
Avatar
0
Feb. 18
4380
How to realise a page break or specify number of columns in rml for openerp Gelöst
rml openerp7
Avatar
1
Sept. 15
4433
How to realise Nested RepeatIn in RML Gelöst
rml openerp7
Avatar
1
Sept. 15
4061
How to display x number of columns per page in rml
rml openerp7
Avatar
0
Sept. 15
3700
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Ausbildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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