[UPD] custom_account_payment: remove receiving method

This commit is contained in:
Samir Ladoui 2025-02-06 18:05:51 +01:00
parent 60d6c51195
commit c927814198
2 changed files with 16 additions and 16 deletions

View File

@ -5,27 +5,27 @@ class AccountPayment(models.Model):
_inherit = 'account.payment'
destination_journal_id = fields.Many2one(comodel_name='account.journal')
available_account_receiving_method_ids = fields.Many2many('account.payment.method.line', compute="_compute_available_account_receiving_method_ids")
account_receiving_method_id = fields.Many2one(
'account.payment.method.line',
string="Receiving Method",
default=False
)
# available_account_receiving_method_ids = fields.Many2many('account.payment.method.line', compute="_compute_available_account_receiving_method_ids")
# account_receiving_method_id = fields.Many2one(
# 'account.payment.method.line',
# string="Receiving Method",
# default=False
# )
paired_internal_transfer_payment_id = fields.Many2one('account.payment',
help="When an internal transfer is posted, a paired payment is created. "
"They are cross referenced trough this field",
copy=False)
@api.depends('destination_journal_id')
def _compute_available_account_receiving_method_ids(self):
AccountPaymentMethodLine = self.env['account.payment.method.line'].sudo()
for rec in self:
rec.available_account_receiving_method_ids = AccountPaymentMethodLine.search([('id', 'in', self.destination_journal_id.outbound_payment_method_line_ids.ids)])
# @api.depends('destination_journal_id')
# def _compute_available_account_receiving_method_ids(self):
# AccountPaymentMethodLine = self.env['account.payment.method.line'].sudo()
# for rec in self:
# rec.available_account_receiving_method_ids = AccountPaymentMethodLine.search([('id', 'in', self.destination_journal_id.outbound_payment_method_line_ids.ids)])
@api.onchange('destination_journal_id')
def _onchange_destination_journal_id(self):
self.account_receiving_method_id = False
# @api.onchange('destination_journal_id')
# def _onchange_destination_journal_id(self):
# self.account_receiving_method_id = False
def action_post(self):
res = super(AccountPayment, self).action_post()

View File

@ -10,7 +10,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_bank_id']" position="after">
<field name="destination_journal_id" domain="[('type','in',('bank','cash'))]" context="{'default_partner_id': partner_id}" attrs="{'invisible': [('is_internal_transfer', '=', False)],'readonly': [('state', '!=', 'draft')], 'required': [('is_internal_transfer', '=', True),('state', '=', 'draft')]}"/>
<field name="available_account_receiving_method_ids" invisible="1"/>
<!-- <field name="available_account_receiving_method_ids" invisible="1"/>
<field
name="account_receiving_method_id"
domain="[('id', 'in', available_account_receiving_method_ids)]"
@ -18,7 +18,7 @@
'invisible': [('is_internal_transfer', '=', False)],
'readonly': [('state', '!=', 'draft')],
'required': [('is_internal_transfer', '=', True), ('state', '=', 'draft')]
}" />
}" /> -->
<field name="paired_internal_transfer_payment_id" invisible="1"/>
</xpath>