Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Edit duplicate id

By
Jihen BEN ALI
on 5/31/16, 5:48 AM 122 views

Hi everyone,

In a custom report I have a problem with a duplicate move_id it is generated more then one but in the databse it is only generated one

So I need to delete this duplication from my repport by xml or by python.

Please any help

Hi, to answer , we need the xml code and python code if you have?

ayman mohammed adam
on 6/1/16, 8:54 AM

Hi,

I had inherited the snc_partnerledger to add this function:

def get_payment_details(self,move_id):

self.cr.execute("SELECT move_id FROM account_move_line where move_id="+str(move_id) +" and reconcile_id IS NULL" )

nn = self.cr.dictfetchone()

id_move=nn['move_id']

print 'id_move', id_move

self.cr.execute("SELECT id FROM account_voucher where move_id="+str(id_move) +" and state='posted'" )

id_voucher=self.cr.dictfetchone()

print 'id_voucher',id_voucher

payment = []

if id_voucher != None:

id_v=id_voucher['id']

self.cr.execute("SELECT id,journal_id,payment_amount,create_date,date FROM account_payment_genext where voucher_id=" + str(id_v)+"ORDER BY date", )

rows=self.cr.dictfetchall()

for row in rows:

record=[]

self.cr.execute("SELECT code FROM account_journal WHERE id = "+str(row['journal_id']))

date=row['date']

record.append(row['payment_amount'])

record.append(self.cr.dictfetchone()['code'])

record.append(date.split(" ")[0])

payment.append(record)

return payment

and this the xml:

<t t-foreach="lines(partner)" t-as="line">

<tr t-if="line['num_fac']">

<td style="border: 1px solid #000000">

<span t-esc="formatLang(line['date'], date=True)" />

</td>

<td style="border: 1px solid #000000">

<span t-esc="line['ref']" />

-

<span t-esc="line['num_fac']" />

</td>

<td style="border: 1px solid #000000" class="text-right">

<span t-esc="formatLang((line['debit']), digits=3)" />

</td>

<td style="border: 1px solid #000000" class="text-right">

<span t-esc="formatLang((line['credit']), digits=3)" />

</td>

<td style="border: 1px solid #000000" class="text-right">

<span

t-esc="formatLang(line['progress'], currency_obj=res_company.currency_id, digits=3)" />

</td>

</tr>

<t t-foreach="get_payment_details(line['move_id'])" t-as="rr">

<tr>

<td style="border: 1px solid #000000">

<span t-esc="formatLang(rr[2], date=True)" />

</td>

<p t-if="partner.customer" >

<td style="border: 1px solid #000000">

Payé par:

<span t-esc="rr[1]" />

</td>

<td style="border: 1px solid #000000"></td>

<td style="border: 1px solid #000000" class="text-right">

<span t-esc="formatLang(rr[0], digits=3)" />

</td>

</p>

<p t-if="partner.supplier">

<td style="border: 1px solid #000000">

Payé par:

<span t-esc="rr[1]" />

</td>

<td style="border: 1px solid #000000" class="text-right">

<span t-esc="formatLang(rr[0], digits=3)" /></td>

<td style="border: 1px solid #000000"></td>

</p>

<td style="border: 1px solid #000000" class="text-right"></td>

</tr>

</t>

</t>

Jihen BEN ALI
on 6/7/16, 8:46 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/31/16, 5:48 AM
Seen: 122 times
Last updated: 5/31/16, 6:41 AM