Skip to content

Commit

Permalink
FIX OCA review
Browse files Browse the repository at this point in the history
  • Loading branch information
mourad-ehm committed Oct 7, 2024
1 parent ff6f0c1 commit 64a159a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ def _get_communication(self):
"""Retrieve the communication string for the payment order."""
communication_type = "normal"
if self.partner_ref:
communication = self.partner_ref or "" + "_" + self.name or ""
communication = (self.partner_ref or "") + (

Check warning on line 18 in purchase_order_downpayment_payment_order/models/purchase_order.py

View check run for this annotation

Codecov / codecov/patch

purchase_order_downpayment_payment_order/models/purchase_order.py#L18

Added line #L18 was not covered by tests
(self.name and "_" + self.name) or ""
)
else:
communication = self.name or ""
return communication_type, communication

def _get_partner_bank(self):
partner_bank_id = first(self.partner_id.bank_ids)
return partner_bank_id

def _prepare_payment_line_vals(self, payment_order, amount_advance):
self.ensure_one()
communication_type, communication = self._get_communication()
if self.currency_id:
currency_id = self.currency_id.id
else:
currency_id = self.company_id.currency_id.id

Check warning on line 35 in purchase_order_downpayment_payment_order/models/purchase_order.py

View check run for this annotation

Codecov / codecov/patch

purchase_order_downpayment_payment_order/models/purchase_order.py#L35

Added line #L35 was not covered by tests
partner_bank_id = first(self.partner_id.bank_ids).id
partner_bank_id = self._get_partner_bank().id
vals = {
"order_id": payment_order.id,
"partner_bank_id": partner_bank_id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from odoo import _, api, fields, models
from odoo import _, fields, models
from odoo.exceptions import UserError


Expand All @@ -15,15 +15,6 @@ class PurchaseOrderDownPaymentWizard(models.TransientModel):
store=True,
)

@api.depends("bank_partner_id")
def _compute_partner_bank_id(self):
for move in self:
# This will get the bank account from the partner in an order with the trusted first
bank_ids = move.bank_partner_id.bank_ids.filtered(
lambda bank: not bank.company_id or bank.company_id == move.company_id
).sorted(lambda bank: not bank.allow_out_payment)
move.partner_bank_id = bank_ids[:1]

def get_account_payment_domain(self, payment_mode, currency):
return [
("payment_mode_id", "=", payment_mode.id),
Expand Down

0 comments on commit 64a159a

Please sign in to comment.