OCA / rma

Odoo for Return Merchandise Authorization (RMA)
GNU Affero General Public License v3.0
78 stars 206 forks source link

[14.0][FIX] rma: fix error in refund button #388

Closed FrankC013 closed 3 months ago

FrankC013 commented 3 months ago

When you have generated an RMA and want to issue a refund, simply pressing the button results in: screenshot

The error is:

AssertionError: date is a required field ({'readonly': ['|', ('move_type', 'in', ['out_invoice', 'out_refund', 'out_receipt']), ('state', '!=', 'draft')], 'required': True})

The error occurs because the 'account.move' is created from the action_refund() with a Form(), and the date field is required, readonly, and not provided. Therefore, the invoice_date must be provided for it to execute:

    @api.onchange('invoice_date', 'highest_name', 'company_id')
    def _onchange_invoice_date(self):
        if self.invoice_date:
            if not self.invoice_payment_term_id and (not self.invoice_date_due or self.invoice_date_due < self.invoice_date):
                self.invoice_date_due = self.invoice_date

            has_tax = bool(self.line_ids.tax_ids or self.line_ids.tax_tag_ids)
            accounting_date = self._get_accounting_date(self.invoice_date, has_tax)
            if accounting_date != self.date:
                self.date = accounting_date
                self._onchange_currency()
            else:
                self._onchange_recompute_dynamic_lines()
OCA-git-bot commented 3 months ago

Hi @ernestotejeda, some modules you are maintaining are being modified, check this out!

FrankC013 commented 3 months ago

@eantones Please review!

OCA-git-bot commented 3 months ago

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 14.0-ocabot-merge-pr-388-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot commented 3 months ago

Congratulations, your PR was merged at 1e567ffcd2bbc0b607ad86ef8cc9b459930b9343. Thanks a lot for contributing to OCA. ❤️