Skip to content

Commit

Permalink
FIX acc_factor_eurofactor: remove / in move_name
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Jan 28, 2025
1 parent 568e48c commit a14cb7b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def size(size, data, info=None):
"ref_cli": size(7, ref_cli or "", partner),
"ref_int": pad(partner.ref, 15, position="left"),
"blanc1": pad(" ", 23),
"ref_move": pad(cut(move.name, 14), 14, position="left"),
"ref_move": get_piece_factor(move.name),
"total": pad(total, 15, 0),
"date": eurof_date(move.invoice_date if p_type == "F" else move.date),
"date_due": eurof_date(move.invoice_date_due),
Expand Down Expand Up @@ -285,10 +285,9 @@ def _eurof_labels_rpt(self):
return line._eurof_fields_rpt().keys()


def get_piece_factor(name, p_type):
if not p_type:
return "{}{}".format(name[:15], pad(" ", 15))
return name[:30]
def get_piece_factor(name):
name = name.replace('/', '')
return pad(name, 14, position="left")


def get_type_piece(move):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from odoo.tests.common import TransactionCase
from ..models.subrogation_receipt import get_piece_factor
import logging
logger = logging.getLogger(__name__)


class Test(TransactionCase):

def test_get_piece_factor(self):
def check_move_name(piece):
move_name = get_piece_factor(piece)
logger.debug(f" >>>> {move_name}")
print(f" >>>> '{move_name}'")
assert len(move_name) == 14, f"Move name {move_name}"

for piece in ("FAC/2025/00001", "RFAC/2025/00001", "FAC/2024/02704", "RFAC/2025/00016"):
check_move_name(piece)

0 comments on commit a14cb7b

Please sign in to comment.