Skip to content

Commit

Permalink
fix faulty fields, minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao committed Apr 29, 2024
1 parent a8b82f3 commit 222767d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 34 deletions.
Empty file.
2 changes: 1 addition & 1 deletion export_invoice_edi_auchan/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "16.0.0.0.0",
"author": "Akretion",
"category": "EDI",
"website": "https://akretion.com",
"website": "https://github.com/akretion/ak-odoo-incubator",
"license": "AGPL-3",
"depends": [
"account",
Expand Down
66 changes: 38 additions & 28 deletions export_invoice_edi_auchan/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,49 @@ def _prepare_export_data(self, idx):
res = []
source_orders = self.line_ids.sale_line_ids.order_id
# Segment Entete facture
args = {
"invoice": self,
"source_orders": source_orders,
}
ent_segment = ENTSegment(**args).render()
res.append(ent_segment)
res.append(
ENTSegment(
**{
"invoice": self,
"source_orders": source_orders,
}
).render()
)
# segment partner
args = {
"invoice": self,
}
par_segment = PARSegment(**args).render()
res.append(par_segment)
res.append(
PARSegment(
**{
"invoice": self,
}
).render()
)
# segment ligne de fatcure
line_num = 0
for line in self.invoice_line_ids:
line_num += 1
args = {
"line": line,
"line_num": line_num,
}
res.append(LIGSegment(**args).render())
for idx, line in enumerate(self.invoice_line_ids, start=0):
res.append(
LIGSegment(
**{
"line": line,
"line_num": idx,
}
).render()
)
# Segment pied facture
args = {
"invoice": self,
}
pie_segment = PIESegment(**args).render()
res.append(pie_segment)
res.append(
PIESegment(
**{
"invoice": self,
}
).render()
)
# segment ligne de TVA (détail des TVA)
for tax_line in self.line_ids.filtered(lambda x: x.tax_line_id):
args = {
"tax_line": tax_line,
}
res.append(TVASegment(**args).render())
res.append(
TVASegment(
**{
"tax_line": tax_line,
}
).render()
)
# Segment END
res.append("END")
return res
Expand Down
1 change: 1 addition & 0 deletions export_invoice_edi_auchan/schema/invoice_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_values(self):
16,
self.invoice.invoice_date,
), # Date/heure facture ou avoir (document) JJ/MM/AAAA HH:MN
(10, self.invoice.echeance), # Date d'échéance JJ/MM/AAAA
(
7,
self.invoice.move_type == "out_invoice"
Expand Down
4 changes: 2 additions & 2 deletions export_invoice_edi_auchan/schema/invoice_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def get_values(self):
(
15,
self.line.quantity
and (self.line.price_total / self.line.quantity)
and (self.line.price_subtotal / self.line.quantity)
or 0.0,
), # Prix unitaire brut
(1,),
(1,),
(70, self.line.name, {"truncate_silent": True}),
(17, self.line.price_subtotal), # Montant Net Ht de la ligne
(17, self.line.price_total), # Montant Net Ht de la ligne
]
6 changes: 3 additions & 3 deletions export_invoice_edi_auchan/schema/invoice_taxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_values(self):

return [
(3, "TVA"), # Étiquette de segment "TVA"
(5, self.tax_line.tax_line_id.amount), # Heure de commande HH:MN opt
(10, self.tax_line.tax_base_amount), # Heure de commande HH:MN opt
(10, self.tax_line.price_subtotal), # Heure de commande HH:MN opt
(5, self.tax_line.tax_line_id.amount or 0.0),
(10, self.tax_line.tax_base_amount or 0.0),
(10, self.tax_line.price_subtotal or 0.0),
]

0 comments on commit 222767d

Please sign in to comment.