[FIX] l10n_ke_edi_tremol: fix unused hsn_name field

Currently the hsn_name should be submitted every time the hsn_code
is (i.e. when the line is not 16% standard rate taxed). However when
serialising the data, a mistake means that this field is always empty in
the message that gets sent to the device.
This is because of the
     re.sub('[^0-9.]+', '', ...)
regular expression, which replaces all the characters of the
description (excepting digits and periods).

This commit adjusts the way that this field is serialised to utilise the
same formatter (_l10n_ke_fmt) as the other text fields used to construct
the message.

closes odoo/odoo#111529

X-original-commit: c087979c853bfcba28094d784d665033c42a1ccc
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
This commit is contained in:
Daniel Kosky (dako)
2023-02-01 13:30:46 +01:00
parent 1946f87def
commit e177ce3d21
@@ -183,7 +183,7 @@ class AccountMove(models.Model):
uom = line.product_uom_id and line.product_uom_id.name or ''
hscode = re.sub('[^0-9.]+', '', line.product_id.l10n_ke_hsn_code)[:10].ljust(10).encode('cp1251') if letter not in ('A', 'B') else b''.ljust(10)
hsname = re.sub('[^0-9.]+', '', line.product_id.l10n_ke_hsn_name)[:20].ljust(20).encode('cp1251') if letter not in ('A', 'B') else b''.ljust(20)
hsname = self._l10n_ke_fmt(line.product_id.l10n_ke_hsn_name, 20) if letter not in ('A', 'B') else b''.ljust(20)
line_data = b';'.join([
self._l10n_ke_fmt(line.name, 36), # 36 symbols for the article's name
self._l10n_ke_fmt(letter, 1), # 1 symbol for article's vat class ('A', 'B', 'C', 'D', or 'E')