Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4325 Widoki

In invoice screen when i try to validate an invoice without adding any line items it throws me an error whereas in accounting -> journal entries I'm able to post an entry without adding any line items. How can i change this behavior of journal entries to the same as invoice.

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

For this what you can do is that, inherit the account.move and super the function of the POST) action_post) button and check whether the end user entered the journal items(line_ids), if lines_ids is not entered you can return a warning message.


def action_post(self):

    res = super(classname, self).action_post()

    if not self.line_ids:

        # return warning message

        raise ValidationError(_("No Journal Items"))

    return res


The code is just typed , not tested, so check and make necessary changes


Thanks

Awatar
Odrzuć
Autor

Thanks for the answer Raphy, I'll look into it and update the same.

Autor

It worked like a charm, Thanks bud!

Powiązane posty Odpowiedzi Widoki Czynność
1
sie 22
7232
1
maj 19
6024
12
kwi 19
4818
3
kwi 23
5857
2
lip 25
1574