Following our discuss about Supplier Price Request, we allow users to create products “on the fly” to ask price to suppliers and sending an offer to the prospect/customer. To prevent using incomplete (missing accounting data that the user doesn’t know) or erroneous products in the main functionalities such as sales or purchases, we define a rule to allow a specific group to update “salable” and “purchasable” fields on the product form, other people don’t have access to those fields.
We thought also to add another checkbox field like “unverified product” but in this case we had do update a lot of modules to take care of this field in the domain… If you have another proposal about this, feel free to suggest!
So, in the module sale_opportunity, products on the lines have a domain “salable = true” which is incompatible following our previous proposal (user create a product on the fly but can’t check salable or purchase because not allowed), so new products are not displayed in the lines (not valid following the domain).
I would remove the domain clause “salable = true” (i know it could be dangerous,…) but it’s for a customisation and only on the sale_opportunity module (anyway this domain is verified later when we try to create the sale). Is this code correct ?
@classmethod def __setup__(cls): super(SaleOpportunityLine, cls).__setup__() clause = ('salable', '=', True) if clause in cls.product.domain: cls.product.domain.remove(clause)