Add visual on product and location quantities
issue8982 review301191009
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Add visual on product and location quantities
|
||||
* Define one lost and found location per warehouse
|
||||
* Show warehouse in user status if not unique
|
||||
* Add cost price revision
|
||||
|
||||
+15
@@ -552,6 +552,21 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
res.append(new_location)
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
storage_types = Eval('type').in_(['storage', 'warehouse', 'view'])
|
||||
return super().view_attributes() + [
|
||||
('/tree/field[@name="quantity"]',
|
||||
'visual', If(
|
||||
storage_types & (Eval('quantity', 0) < 0), 'danger', ''),
|
||||
['type']),
|
||||
('/tree/field[@name="forecast_quantity"]',
|
||||
'visual', If(
|
||||
storage_types & (Eval('forecast_quantity', 0) < 0),
|
||||
'warning', ''),
|
||||
['type']),
|
||||
]
|
||||
|
||||
|
||||
supplier_location = fields.Many2One(
|
||||
'stock.location', "Supplier Location", domain=[('type', '=', 'supplier')],
|
||||
|
||||
@@ -384,6 +384,15 @@ class Product(StockMixin, object, metaclass=PoolMeta):
|
||||
cost_price = revision.get_cost_price(cost_price)
|
||||
return cost_price
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return super().view_attributes() + [
|
||||
('/tree/field[@name="quantity"]',
|
||||
'visual', If(Eval('quantity', 0) < 0, 'danger', '')),
|
||||
('/tree/field[@name="forecast_quantity"]',
|
||||
'visual', If(Eval('forecast_quantity', 0) < 0, 'warning', '')),
|
||||
]
|
||||
|
||||
|
||||
class ProductByLocationContext(ModelView):
|
||||
'Product by Location'
|
||||
|
||||
Reference in New Issue
Block a user