mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms_api_rest: set journal id by partner in reverse moves
This commit is contained in:
@@ -232,7 +232,9 @@ class PmsFolioService(Component):
|
||||
if pms_account_payment_info.reservationIds
|
||||
else False
|
||||
)
|
||||
self.env["pms.folio"].do_payment(
|
||||
# TODO: no_cash_register context to maintain compatibility
|
||||
# with older versions, delete it in the future
|
||||
self.env["pms.folio"].with_context(no_cash_register=True).do_payment(
|
||||
journal_id,
|
||||
journal_id.suspense_account_id,
|
||||
self.env.user,
|
||||
@@ -262,7 +264,9 @@ class PmsFolioService(Component):
|
||||
journal_id = self.env["account.journal"].browse(
|
||||
pms_account_payment_info.journalId
|
||||
)
|
||||
self.env["pms.folio"].do_refund(
|
||||
# TODO: no_cash_register context to maintain compatibility
|
||||
# with older versions, delete it in the future
|
||||
self.env["pms.folio"].with_context(no_cash_register=True).do_refund(
|
||||
journal_id,
|
||||
journal_id.suspense_account_id,
|
||||
self.env.user,
|
||||
|
||||
@@ -76,6 +76,11 @@ class PmsInvoiceService(Component):
|
||||
)
|
||||
move_reversal.reverse_moves()
|
||||
reverse_invoice = move_reversal.new_move_ids
|
||||
invoice = reverse_invoice
|
||||
invoice.journal_id = invoice.pms_property_id._get_folio_default_journal(
|
||||
partner_invoice_id=new_vals.get("partner_id", invoice.partner_id.id)
|
||||
)
|
||||
invoice.sudo().action_post()
|
||||
# If change invoice by reversal, and new_vals has invoice_line_ids
|
||||
# we need to mapp the new invoice lines with the new invoice
|
||||
reverse_lines = []
|
||||
|
||||
@@ -387,6 +387,7 @@ class PmsTransactionService(Component):
|
||||
vals["counterpart_payment_id"] = counterpart_transaction.id
|
||||
counterpart_vals["counterpart_payment_id"] = transaction.id
|
||||
if vals:
|
||||
transaction.sudo().action_draft()
|
||||
transaction.sudo().write(vals)
|
||||
transaction.sudo().action_post()
|
||||
if counterpart_transaction:
|
||||
|
||||
Reference in New Issue
Block a user