Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 14, 2024

Conversation

FrankC013
Copy link

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
Copy link
Contributor

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

@FrankC013
Copy link
Author

@eantones Please review!

Copy link

@eantones eantones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pedrobaeza pedrobaeza added this to the 14.0 milestone May 14, 2024
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

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 OCA-git-bot merged commit af3c6be into OCA:14.0 May 14, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants