Skip to content

Commit

Permalink
FIX acc_facto_receiv_bal_eurof: move name on file, check required
Browse files Browse the repository at this point in the history
  • Loading branch information
bealdav committed Sep 20, 2024
1 parent 5badca4 commit c4a5cb8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def _display_eurofactor_bank(self):
"Used in report"
self.ensure_one()
self = self.with_company(self.company_id.id)
if self._use_factor():
if self.use_factor:
return self.commercial_partner_id.factor_bank_id.display_name
return ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ def size(size, data, info=None):
info2 = {
"ref_int": pad(partner.ref, 15, position="left"),
"blanc1": pad(" ", 23),
"ref_move": pad(cut(move.invoice_origin, 14), 14, position="left"),
"ref_move": pad(cut(move.name, 14), 14, position="left"),
"total": pad(str(round(total, 2)).replace(".", ""), 15, 0),
"date": eurof_date(move.invoice_date if p_type == "F" else move.date),
"date_due": eurof_date(move.invoice_date_due) or pad(" ", 8),
"date_due": eurof_date(move.invoice_date_due),
"paym": "A" if p_type == "F" else "T", # TODO check si traite
"sale": pad(cut(move.invoice_origin, 10), 10, position="left"),
"ref_f": pad(" ", 25), # autre ref facture
Expand All @@ -143,6 +143,9 @@ def size(size, data, info=None):
"blanc3": pad(" ", 3), # ref facture de l'avoir
}
info.update(info2)
responses = check_required(info, line.name)
if responses:
errors.extend(responses)
infos = [val for k, val in info.items()]
if infos:
string = ";".join([x or "" for x in infos]) + ";"
Expand Down Expand Up @@ -228,7 +231,7 @@ def pad(string, pad, end=" ", position="right"):


def cut(string, size):
res = ""
res = string
if not string:
res = " " * size
elif len(string) > size:
Expand All @@ -255,6 +258,26 @@ def check_string(string, info=None, field=None):
return False


def check_required(infos, name):
required = [
"emetteur",
"client",
"p_type",
"devise",
"ref_cli",
"ref_int",
"ref_move",
"total",
"date_due",
]
messages = []
for key in required:
datum = infos[key].replace(" ", "")
if not datum:
messages.append(f"La donnée '{key}' pour '{name}' est manquante.")
return messages


def inspect_code(stack, string, info=None, field=None):
data = ""
if info and isinstance(info, models.Model):
Expand Down

0 comments on commit c4a5cb8

Please sign in to comment.