Skip to Content
Menu
This question has been flagged
1966 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

Avatar
Discard

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

Author

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>