Simplify tests by using movable property of line instead of product type

This commit is contained in:
Cédric Krier
2025-07-10 17:52:16 +02:00
parent 6cda4cf48d
commit ea26652f45
2 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -1480,7 +1480,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
Uom = pool.get('product.uom')
if self.type != 'line' or not self.product:
return
if self.product.type == 'service':
if not self.movable:
return
skips = set(self.moves_ignored)
quantity = abs(self.quantity)
+3 -6
View File
@@ -910,8 +910,7 @@ class Sale(
gettext('sale.msg_sale_invoice_address_required_for_quotation',
sale=self.rec_name))
for line in self.line_lines:
if (line.product
and line.product.type != 'service'
if (line.movable
and line.quantity >= 0
and not self.shipment_address):
raise SaleQuotationError(
@@ -922,9 +921,7 @@ class Sale(
location = line.from_location
else:
location = line.to_location
if ((not location or not line.warehouse)
and line.product
and line.movable):
if (not location or not line.warehouse) and line.movable:
raise SaleQuotationError(
gettext('sale.msg_sale_warehouse_required_for_quotation',
sale=self.rec_name))
@@ -1641,7 +1638,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
Uom = pool.get('product.uom')
if self.type != 'line' or not self.product:
return
if self.product.type == 'service':
if not self.movable:
return
skips = set(self.moves_ignored)
quantity = abs(self.quantity)