Skip to content

Commit

Permalink
FIX acc_facto_receiv_bal_eurof: use partner_shipping_id instead of co…
Browse files Browse the repository at this point in the history
…mmercial one
  • Loading branch information
bealdav committed Sep 24, 2024
1 parent c4a5cb8 commit a5485de
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def size(size, data, info=None):
sequence = 1
rows = []
balance = 0
partners = self.line_ids.mapped("move_id.partner_id.commercial_partner_id")
partners = self.line_ids.mapped("move_id.partner_shipping_id")
res = partners._check_eurof_data()
if res:
errors.append(res)
Expand All @@ -97,7 +97,7 @@ def size(size, data, info=None):
size(5, settings["emetteurE"], "emetteurE")
for line in self.line_ids:
move = line.move_id
partner = line.move_id.partner_id.commercial_partner_id
partner = line.move_id.partner_shipping_id
if not partner:
raise ValidationError(
f"Pas de partenaire sur la pièce {line.move_id.name}"
Expand All @@ -123,10 +123,7 @@ def size(size, data, info=None):
"afc": "711" if activity == "D" else "999",
"p_type": p_type,
"devise": move.currency_id.name,
}
if ref_cli:
info["ref_cli"] = size(7, ref_cli, partner)
info2 = {
"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"),
Expand All @@ -142,7 +139,6 @@ def size(size, data, info=None):
"blanc2": pad(" ", 51), # ref facture de l'avoir
"blanc3": pad(" ", 3), # ref facture de l'avoir
}
info.update(info2)
responses = check_required(info, line.name)
if responses:
errors.extend(responses)
Expand Down Expand Up @@ -184,13 +180,11 @@ def _amount_eurof_rpt(self, france=True):
def _eurof_lines_rpt(self, france=True):
if france:
return self.line_ids.filtered(
lambda s: s.partner_id.commercial_partner_id.country_id
== s.env.ref("base.fr")
lambda s: s.partner_shipping_id.country_id == s.env.ref("base.fr")
)
else:
return self.line_ids.filtered(
lambda s: not s.partner_id.commercial_partner_id.country_id
== s.env.ref("base.fr")
lambda s: not s.partner_shipping_id.country_id == s.env.ref("base.fr")
)

def _eurof_labels_rpt(self):
Expand Down Expand Up @@ -272,7 +266,9 @@ def check_required(infos, name):
]
messages = []
for key in required:
datum = infos[key].replace(" ", "")
datum = infos[key]
if datum:
datum = datum.replace(" ", "")
if not datum:
messages.append(f"La donnée '{key}' pour '{name}' est manquante.")
return messages
Expand Down

0 comments on commit a5485de

Please sign in to comment.