[FIX] l10n_in_edi_ewaybill: don't send ewaybill if all lines are service

In this commit
=============================================
Before if all the lines were of service the error was displayed in a banner
after error in response was received, but now before sending request the lines
are checked if at least one line is of product and error is raised.

Issue in this: https://github.com/odoo/odoo/pull/153522/commits/c81595db6a7a135a3289751a9b881b2f947bc6d2

closes odoo/odoo#154290

X-original-commit: 831d318a2993e8c4ac92739bf3604ad04dec924f
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Surabhi Varma (suva) <suva@odoo.com>
This commit is contained in:
Surabhi Varma
2024-02-16 02:01:35 +00:00
parent 787bebf302
commit 0c7989942e
@@ -98,7 +98,7 @@ class AccountEdiFormat(models.Model):
error_message.append(_("- Transport document number and date is required when Transportation Mode is Rail,Air or Ship"))
if error_message:
error_message.insert(0, _("The following information are missing on the invoice (see eWayBill tab):"))
goods_lines = move.invoice_line_ids.filtered(lambda line: not (line.display_type or line.is_rounding_line or line.product_id.type == "service"))
goods_lines = move.invoice_line_ids.filtered(lambda line: not (line.display_type in ('line_section', 'line_note', 'rounding') or line.product_id.type == "service"))
if not goods_lines:
error_message.append(_('You need at least one product having "Product Type" as stockable or consumable.'))
if base == "irn":