refactor: update _compute_destination_account_id dependencies to use payment_type and adjust direct payment lines view from tree to list.

This commit is contained in:
Suherdy Yacob 2026-01-21 10:41:47 +07:00
parent 0483fae2ec
commit 6e126bd5f9
3 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ class AccountPayment(models.Model):
help="Account used for expense instead of the default payable/receivable account" help="Account used for expense instead of the default payable/receivable account"
) )
@api.depends('journal_id', 'partner_id', 'partner_type', 'is_internal_transfer', 'destination_journal_id', 'expense_account_id') @api.depends('journal_id', 'partner_id', 'partner_type', 'payment_type', 'expense_account_id')
def _compute_destination_account_id(self): def _compute_destination_account_id(self):
''' Override to use expense account if defined ''' ''' Override to use expense account if defined '''
super()._compute_destination_account_id() super()._compute_destination_account_id()

View File

@ -13,7 +13,7 @@ class AccountPaymentRegister(models.TransientModel):
help="Account used for expense instead of the default payable/receivable account" help="Account used for expense instead of the default payable/receivable account"
) )
@api.depends('journal_id', 'partner_type', 'is_internal_transfer', 'destination_journal_id', 'expense_account_id') @api.depends('journal_id', 'partner_type', 'payment_type', 'expense_account_id')
def _compute_destination_account_id(self): def _compute_destination_account_id(self):
''' Override to use expense account if defined ''' ''' Override to use expense account if defined '''
super()._compute_destination_account_id() super()._compute_destination_account_id()

View File

@ -8,14 +8,14 @@
<xpath expr="//page[@name='batch_content']" position="after"> <xpath expr="//page[@name='batch_content']" position="after">
<page string="Direct Payment Lines" name="direct_payment_lines"> <page string="Direct Payment Lines" name="direct_payment_lines">
<field name="direct_payment_line_ids"> <field name="direct_payment_line_ids">
<tree editable="bottom"> <list editable="bottom">
<field name="partner_id" domain="parent.batch_type == 'outbound' and [('supplier_rank', '>', 0)] or [('customer_rank', '>', 0)]" options="{'no_create': True}"/> <field name="partner_id" domain="parent.batch_type == 'outbound' and [('supplier_rank', '>', 0)] or [('customer_rank', '>', 0)]" options="{'no_create': True}"/>
<field name="amount" sum="Total"/> <field name="amount" sum="Total"/>
<field name="expense_account_id"/> <field name="expense_account_id"/>
<field name="memo"/> <field name="memo"/>
<field name="date"/> <field name="date"/>
<field name="payment_id" readonly="1"/> <field name="payment_id" readonly="1"/>
</tree> </list>
</field> </field>
</page> </page>
</xpath> </xpath>