changes
This commit is contained in:
27
test_transfer_match.py
Normal file
27
test_transfer_match.py
Normal file
@@ -0,0 +1,27 @@
|
||||
line = env['account.bank.statement.line'].browse(20261) # $5000 on 2026-03-30
|
||||
print(f'Line: {line.id}, amt={line.amount}, date={line.move_id.date}, recon={line.is_reconciled}')
|
||||
|
||||
# Set partner
|
||||
line.partner_id = 1
|
||||
|
||||
# Find matching outstanding entry on account 493 (Outstanding Receipts - All Banks)
|
||||
outstanding = env['account.move.line'].search([
|
||||
('account_id', '=', 493),
|
||||
('partner_id', '=', 1),
|
||||
('reconciled', '=', False),
|
||||
('amount_residual', '=', line.amount),
|
||||
], limit=5)
|
||||
print(f'Outstanding matches: {[(o.id, o.amount_residual, o.date) for o in outstanding]}')
|
||||
|
||||
if outstanding:
|
||||
aml = outstanding[0]
|
||||
try:
|
||||
line.set_line_bank_statement_line(aml.ids)
|
||||
env.cr.commit()
|
||||
line.invalidate_recordset()
|
||||
print(f'RECONCILED: {line.is_reconciled}')
|
||||
except Exception as e:
|
||||
print(f'Error: {e}')
|
||||
env.cr.rollback()
|
||||
else:
|
||||
print('No matching outstanding entry found')
|
||||
Reference in New Issue
Block a user