[14.0][IMP] account_payment_order: Add a hook method to retrieve communication type and communication

This commit is contained in:
Denis Roussel
2022-04-14 09:26:00 +02:00
parent df3e8e79f4
commit da8e2da5bb

View File

@@ -48,9 +48,10 @@ class AccountMoveLine(models.Model):
else:
ml.partner_bank_id = ml.partner_bank_id
def _prepare_payment_line_vals(self, payment_order):
self.ensure_one()
assert payment_order, "Missing payment order"
def _get_communication(self):
"""
Retrieve the communication string for the payment order
"""
aplo = self.env["account.payment.line"]
# default values for communication_type and communication
communication_type = "normal"
@@ -70,6 +71,12 @@ class AccountMoveLine(models.Model):
elif "out" in self.move_id.move_type:
# Force to only put invoice number here
communication = self.move_id.name
return communication_type, communication
def _prepare_payment_line_vals(self, payment_order):
self.ensure_one()
assert payment_order, "Missing payment order"
communication_type, communication = self._get_communication()
if self.currency_id:
currency_id = self.currency_id.id
amount_currency = self.amount_residual_currency