Skip to content

ProductSupplierInfoImport: create product.product instead of product.template ? #2365

Description

@DylannCordel

Hi,

In product_supplierinfo_import.py ProductSupplierInfoImport._create_new_product, you try to create a product.template and if it fails you return an empty product.product. Maybe I misunderstood something but it would be better to return an empty product.template ? Or even better, try to create a product.product instead a product.template ?

try:
product = self.env["product.template"].create(product_data)
product.message_post(
body=self.env._("Created from supplier price list import"),
)
return product
except ValidationError:
_logger.warning(
f"The product {vendor_product_name}"
f" could not be created due to a {search_field} collision."
)
return self.env["product.product"]

Sorry if I miss something to understand why it's currently done as it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions