This question has been flagged
1119 Views
In XML file ...

t-foreach="lines(data, o)" t-as="line">

t-esc="line['date']"/>


t-esc="line['name']"/>



File #: 
t-esc="line['name']"/>
   
Container #: 
t-esc="line['container']"/>
   
B/L No.: 
t-esc="line['blno']"/>
   
Consignee: 
t-esc="line['consignee']"/>
   

Bank Reference: 
t-esc="line['bank_ref']"/>
   
Cheque Reference: 
t-esc="line['cheque_ref']"/>
   
Memo: 
t-esc="line['communi']"/>
   
Check Number: 
t-esc="line['check_num']"/>



class="text-right">
t-esc="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>

class="text-right">
t-esc="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>

class="text-right">
t-esc="line['progress']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>

class="text-right" t-if="data['form']['amount_currency']">
t-if="line['currency_id']">
t-esc="line['amount_currency']"
t-options="{'widget': 'monetary', 'display_currency': line['currency_id']}"/>





In Python file...

class AccountMoveLineInherit(models.Model):
_inherit = "account.move.line"

bank_ref = fields.Char(related='payment_id.bank_reference',
store
=False, index=True, copy=False)

cheque_ref = fields.Char(related='payment_id.cheque_reference',
store
=False, index=True, copy=False)

communi = fields.Char(related='payment_id.communication',
store
=False, index=True, copy=False)

check_num = fields.Char(related='payment_id.check_numbers',
store
=False, index=True, copy=False)


class PartnerLedgerReport(models.AbstractModel):
_inherit = "report.base_accounting_kit.report_partnerledger"

def _lines
(self, data, partner):
full_account = []
currency = self.env['res.currency']
query_get_data = self.env['account.move.line'].with_context(data['form'].get('used_context', {}))._query_get()
reconcile_clause = "" if data['form']['reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL '
params = [partner.id, tuple(data['computed']['move_state']), tuple(data['computed']['account_ids'])] + \
query_get_data[2]
query = """
SELECT "account_move_line".id, "account_move_line".date, j.code, acc.code as a_code, m.add_container as container, m.bl_no as blno, m.add_consignee as consignee, acc.name as a_name, "account_move_line".ref, m.name as move_name, "account_move_line".name, "account_move_line".debit, "account_move_line".credit, "account_move_line".amount_currency,"account_move_line".currency_id, "account_move_line".bank_ref, "account_move_line".cheque_ref, "account_move_line".communi, "account_move_line".check_num, c.symbol AS currency_code
FROM """
+ query_get_data[0] + """
LEFT JOIN account_journal j ON ("account_move_line".journal_id = j.id)
LEFT JOIN account_account acc ON ("account_move_line".account_id = acc.id)
LEFT JOIN res_currency c ON ("account_move_line".currency_id=c.id)
LEFT JOIN account_move m ON (m.id="account_move_line".move_id)
WHERE "account_move_line".partner_id = %s
AND m.state IN %s
AND "account_move_line".account_id IN %s AND """
+ query_get_data[1] + reconcile_clause + """
ORDER BY "account_move_line".date"""
self
.env.cr.execute(query, tuple(params))
res = self.env.cr.dictfetchall()
sum = 0.0
lang_code = self.env.context.get('lang') or 'en_US'
lang = self.env['res.lang']
lang_id = lang._lang_get(lang_code)
date_format = lang_id.date_format
for r in res:
r['date'] = r['date']
r['container'] = r['container']
r['consignee'] = r['consignee']
r['blno'] = r['blno']
r['bank_ref'] = r['bank_ref']
r['cheque_ref'] = r['cheque_ref']
r['communi'] = r['communi']
r['check_num'] = r['check_num']
r['displayed_name'] = '-'.join(
r[field_name] for field_name in ('move_name', 'ref', 'name')
if r[field_name] not in (None, '', '/')
)
sum += r['debit'] - r['credit']
r['progress'] = sum
r['currency_id'] = currency.browse(r.get('currency_id'))
full_account.append(r)
return full_account


Avatar
Discard