Add visual on product and location quantities

issue8982
review301191009
This commit is contained in:
Sergi Almacellas Abellana
2020-03-30 09:37:30 +02:00
parent 2499c83297
commit 410dcffb29
3 changed files with 25 additions and 0 deletions
+1
View File
@@ -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
View File
@@ -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')],
+9
View File
@@ -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'