Add document source on move of product quantities by warehouse
issue9728 review318541003
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Add document source on move of product quantities by warehouse
|
||||
* Add relate from assigned shipment to products quantities by warehouse
|
||||
* Show quantities by warehouse for many products
|
||||
* Default to ordering shipments by date
|
||||
|
||||
+21
@@ -737,6 +737,9 @@ class ProductQuantitiesByWarehouseMove(ModelSQL, ModelView):
|
||||
date = fields.Date("Date")
|
||||
move = fields.Many2One('stock.move', "Move")
|
||||
origin = fields.Reference("Origin", selection='get_origin')
|
||||
document = fields.Function(
|
||||
fields.Reference("Document", selection='get_documents'),
|
||||
'get_document')
|
||||
quantity = fields.Float("Quantity")
|
||||
cumulative_quantity_start = fields.Function(
|
||||
fields.Float("Cumulative Quantity Start"), 'get_cumulative_quantity')
|
||||
@@ -836,6 +839,24 @@ class ProductQuantitiesByWarehouseMove(ModelSQL, ModelView):
|
||||
Move = pool.get('stock.move')
|
||||
return Move.get_origin()
|
||||
|
||||
@classmethod
|
||||
def _get_document_models(cls):
|
||||
pool = Pool()
|
||||
Move = pool.get('stock.move')
|
||||
return [m for m, _ in Move.get_shipment() if m]
|
||||
|
||||
@classmethod
|
||||
def get_documents(cls):
|
||||
pool = Pool()
|
||||
Model = pool.get('ir.model')
|
||||
get_name = Model.get_name
|
||||
models = cls._get_document_models()
|
||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||
|
||||
def get_document(self, name):
|
||||
if self.move and self.move.shipment:
|
||||
return str(self.move.shipment)
|
||||
|
||||
@classmethod
|
||||
def get_cumulative_quantity(cls, records, names):
|
||||
pool = Pool()
|
||||
|
||||
@@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="date"/>
|
||||
<field name="move"/>
|
||||
<field name="origin" expand="1"/>
|
||||
<field name="document" expand="1"/>
|
||||
<field name="cumulative_quantity_start" expand="2"/>
|
||||
<field name="quantity" expand="2"/>
|
||||
<field name="cumulative_quantity_end" expand="2"/>
|
||||
|
||||
Reference in New Issue
Block a user