[FIX]fixed not manually journals in folio payment

This commit is contained in:
braisab
2021-11-08 13:11:16 +01:00
parent 2ffd6cc179
commit e9fed94977
3 changed files with 11 additions and 5 deletions

View File

@@ -964,7 +964,9 @@ class PmsFolio(models.Model):
}
record.update(vals)
else:
journals = record.pms_property_id._get_payment_methods()
journals = record.pms_property_id._get_payment_methods(
automatic_included=True
)
paid_out = 0
for journal in journals:
paid_out += sum(

View File

@@ -428,12 +428,14 @@ class PmsProperty(models.Model):
dt = dt.replace(tzinfo=None)
return dt
def _get_payment_methods(self):
def _get_payment_methods(self, automatic_included=False):
# We use automatic_included to True to see absolutely
# all the journals with associated payments, if it is
# false, we will only see those journals that can be used
# to pay manually
self.ensure_one()
payment_methods = self.env["account.journal"].search(
[
("allowed_pms_payments", "=", True),
"&",
("type", "in", ["cash", "bank"]),
"|",
("pms_property_ids", "in", self.id),
@@ -446,6 +448,8 @@ class PmsProperty(models.Model):
("company_id", "=", False),
]
)
if not automatic_included:
payment_methods = payment_methods.filtered(lambda p: p.allowed_pms_payments)
return payment_methods
@api.model

View File

@@ -4,7 +4,7 @@
<field name="model">payment.transaction</field>
<field name="inherit_id" ref="payment.transaction_form" />
<field name="arch" type="xml">
<xpath expr="//group[@string='Message']" position="before">
<xpath expr="//field[@name='date']" position="before">
<field name="folio_ids" />
</xpath>
</field>