mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]fixed not manually journals in folio payment
This commit is contained in:
@@ -964,7 +964,9 @@ class PmsFolio(models.Model):
|
|||||||
}
|
}
|
||||||
record.update(vals)
|
record.update(vals)
|
||||||
else:
|
else:
|
||||||
journals = record.pms_property_id._get_payment_methods()
|
journals = record.pms_property_id._get_payment_methods(
|
||||||
|
automatic_included=True
|
||||||
|
)
|
||||||
paid_out = 0
|
paid_out = 0
|
||||||
for journal in journals:
|
for journal in journals:
|
||||||
paid_out += sum(
|
paid_out += sum(
|
||||||
|
|||||||
@@ -428,12 +428,14 @@ class PmsProperty(models.Model):
|
|||||||
dt = dt.replace(tzinfo=None)
|
dt = dt.replace(tzinfo=None)
|
||||||
return dt
|
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()
|
self.ensure_one()
|
||||||
payment_methods = self.env["account.journal"].search(
|
payment_methods = self.env["account.journal"].search(
|
||||||
[
|
[
|
||||||
("allowed_pms_payments", "=", True),
|
|
||||||
"&",
|
|
||||||
("type", "in", ["cash", "bank"]),
|
("type", "in", ["cash", "bank"]),
|
||||||
"|",
|
"|",
|
||||||
("pms_property_ids", "in", self.id),
|
("pms_property_ids", "in", self.id),
|
||||||
@@ -446,6 +448,8 @@ class PmsProperty(models.Model):
|
|||||||
("company_id", "=", False),
|
("company_id", "=", False),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
if not automatic_included:
|
||||||
|
payment_methods = payment_methods.filtered(lambda p: p.allowed_pms_payments)
|
||||||
return payment_methods
|
return payment_methods
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<field name="model">payment.transaction</field>
|
<field name="model">payment.transaction</field>
|
||||||
<field name="inherit_id" ref="payment.transaction_form" />
|
<field name="inherit_id" ref="payment.transaction_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//group[@string='Message']" position="before">
|
<xpath expr="//field[@name='date']" position="before">
|
||||||
<field name="folio_ids" />
|
<field name="folio_ids" />
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user