Commit 3eca5e4e authored by Alexander Olivares's avatar Alexander Olivares
Browse files

[FIX] product_cost_usd: now the cost in usd can be assigned without the need...

[FIX] product_cost_usd: now the cost in usd can be assigned without the need to have at least one supplier with price in USD if the product type is service.
parent 0d310f10
......@@ -17,8 +17,8 @@ class ProductTemplate(models.Model):
""" Validate 'Cost in USD' usability.
Usability conditions:
- Before set a 'Cost in USD' in a product at least one supplier should
have price in USD.
- If product type is not a service, before set a 'Cost in USD' in a
product at least one supplier should have price in USD.
- The Cost in USD cannot be less than supplier price.
"""
usd_currency = self.env.ref('base.USD')
......@@ -27,7 +27,8 @@ class ProductTemplate(models.Model):
lambda x: x.currency_id == usd_currency)
list_price = usd_seller.price if usd_seller else 0.0
standard_price_usd = self.standard_price_usd
if not usd_seller and float_compare(
product_type = self.type
if not 'service' in product_type and not usd_seller and float_compare(
standard_price_usd, 0, precision_digits=prec) > 0:
raise ValidationError(
_('You must have at least one supplier with price in USD'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment