Skip to content

Commit

Permalink
Always add tax and product dict
Browse files Browse the repository at this point in the history
  • Loading branch information
bosd committed Sep 16, 2022
1 parent 9f28712 commit feaafe1
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,30 @@ def invoice2data_to_parsed_inv(self, invoice2data_res):
for line in lines:
# Manipulate line data to match with account_invoice_import
line["price_unit"] = float(line.get("price_unit", 0))
# qty 0 should be allowed to import notes, but nut supported by document_import
taxes = self.parse_invoice2data_taxes(line)
line["taxes"] = taxes # or global_taxes,
product_dict = {
"barcode": line.get("barcode"),
"code": line.get("code"),
}
line["product"] = product_dict
if line.get("date_start"):
line["date_start"] = line.get("date_start")
line["date_end"] = line.get("date_end")
if line.get("line_note"):
line["line_note"] = line.get("line_note")
line["sectionheader"] = line.get("sectionheader")
# qty 0 should be allowed to import notes, but not supported by document_import
line["qty"] = float(line.get("qty", 1))
if line["qty"] > 0:
taxes = self.parse_invoice2data_taxes(line)
line["taxes"] = taxes # or global_taxes,
product_dict = {
"barcode": line.get("barcode"),
"code": line.get("code"),
}
line["product"] = product_dict
uom_dict = {
"unece_code": line.get("unece_code"),
"name": line.get("uom"),
}
line["uom"] = uom_dict
if line.get("date_start"):
line["date_start"] = line.get("date_start")
line["date_end"] = line.get("date_end")
line["discount"] = float(line.get("discount", 0.0))
if line.get("price_subtotal"):
line["price_subtotal"] = line.get("price_subtotal")
if line.get("line_note"):
line["line_note"] = line.get("line_note")
line["sectionheader"] = line.get("sectionheader")

parsed_inv = {
"partner": {
Expand Down

0 comments on commit feaafe1

Please sign in to comment.