Closed openboxmobile closed 2 months ago
The code should not be sending the API Payment call for payments on "Invoice and Receipt" then. Can you propose the fix?
Hello @dreispt I'm not a developer. I don't know where should be edited.
Should be here?
def _track_subtype(self, init_values): res = super()._track_subtype(init_values) if "payment_state" in init_values and self.payment_state == "paid": for invoice in self: if invoice.invoicexpress_id: invoice._mark_invoice_paid() return res
def _mark_invoice_paid(self):
InvoiceXpress = self.env["account.invoicexpress"]
for invoice in self.filtered("can_invoicexpress"):
doctype = invoice.invoicexpress_doc_type
if not doctype:
raise exceptions.UserError(
_("Invoice is missing the InvoiceXpress document type!")
)
response = InvoiceXpress.call(
invoice.company_id,
"{}s/{}/change-state.json".format(doctype, invoice.invoicexpress_id),
"PUT",
payload={"invoice": {"state": "settled"}},
raise_errors=True,
).json()
values = response.get(doctype)
seqnum = values and values.get("inverted_sequence_number")
if not seqnum:
raise exceptions.UserError(
_(
"Something went wrong: the InvoiceXpress response"
" is missing a sequence number."
)
)
msg = _("InvoiceXpress record has been modified to Paid.")
self.message_post(body=msg)
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.
When I create an invoice in Odoo with Invoicexpress Doc Type = "Invoice and Receipt", I cannot add payment in Odoo because in invoicexpress payment has already been registered.
Error when I tried to add payment : Error running API request (422 Unprocessable Entity): {'errors': [{'error': 'Change event error'}]}
Any workarround ?