mirror of
https://gitlab.com/flectra-community/bank-payment.git
synced 2024-11-24 22:52:05 +00:00
28 lines
826 B
Python
28 lines
826 B
Python
# Copyright 2016 Akretion (http://www.akretion.com/)
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
from flectra import api, fields, models
|
|
|
|
|
|
class AccountMoveLine(models.Model):
|
|
_inherit = "account.move.line"
|
|
|
|
payment_mode_id = fields.Many2one(
|
|
comodel_name="account.payment.mode",
|
|
compute="_compute_payment_mode",
|
|
store=True,
|
|
ondelete="restrict",
|
|
index=True,
|
|
)
|
|
|
|
@api.depends("move_id.payment_mode_id")
|
|
def _compute_payment_mode(self):
|
|
for line in self:
|
|
if line.move_id.is_invoice() and line.account_internal_type in (
|
|
"receivable",
|
|
"payable",
|
|
):
|
|
line.payment_mode_id = line.move_id.payment_mode_id
|
|
else:
|
|
line.payment_mode_id = False
|