Skip to content

Commit

Permalink
[IMP] product_import: archive/unarchive product template
Browse files Browse the repository at this point in the history
  • Loading branch information
florentx committed Jan 28, 2025
1 parent a0bfaf2 commit d6704db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions product_import/wizard/product_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def _prepare_supplierinfo(self, seller_info, product):
and s_info.delay == seller_info["delay"]
):
seller_id = s_info.id
elif s_info.date_start == today:
# Overwrite if created the same day
seller_id = s_info.id
result.append((1, s_info.id, seller_info))
else:
result.append((1, s_info.id, {"date_end": yesterday}))
if not seller_id:
Expand Down Expand Up @@ -212,6 +216,9 @@ def _save_product(self, product_vals, chatter_msg):
product.action_archive()
logger.debug("Product %s created", product.default_code)

# Archive product template, if product is archived
if product.active != product.product_tmpl_id.active:
product.product_tmpl_id.toggle_active()
return product

@api.model
Expand Down
6 changes: 4 additions & 2 deletions product_import_ubl/wizard/product_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ def parse_ubl_catalogue_line(self, line, ns):
"price": float(ele_price.text or 0),
"currency": {"iso": currency} if currency else False,
"min_qty": min_qty,
"sale_delay": xline.text(
"cac:RequiredItemLocationQuantity/cbc:LeadTimeMeasure"
"sale_delay": int(
xline.text(
"cac:RequiredItemLocationQuantity/cbc:LeadTimeMeasure", 0
)
),
}
)
Expand Down

0 comments on commit d6704db

Please sign in to comment.