Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • Hotel
    Real Estate
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    Consulting
    • Accounting Firm
    • Odoo पार्टनर
    • Marketing Agency
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

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

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

TypeError: 'int' object is not iterable RML

Subscribe

Get notified when there's activity on this post

This question has been flagged
rmlopenerp7
18 Replies
9664 Views
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
Discard
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
Author

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

Rihene
Author

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

Rihene
Author

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
Author

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
Author

i have changed it but nothing happens

Rihene
Author

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
Author

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
Author

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
Author

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
Author

here is my mail pawan : abdelwahed_rihene@yahoo.fr

Rihene
Author

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

Avatar
Rihene
Author Best Answer

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
Discard
Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
Spliting rml intotwo halves
rml openerp7
Avatar
0
अप्रैल 18
3327
How to add condation in rml
rml openerp7
Avatar
0
फ़र॰ 18
4380
How to realise a page break or specify number of columns in rml for openerp Solved
rml openerp7
Avatar
1
सित॰ 15
4433
How to realise Nested RepeatIn in RML Solved
rml openerp7
Avatar
1
सित॰ 15
4061
How to display x number of columns per page in rml
rml openerp7
Avatar
0
सित॰ 15
3700
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة 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, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

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