mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[MIG]stock_picklist: to 16
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
'name': 'Stock Picklist',
|
||||
'version': '14.0.1.0.0',
|
||||
'version': '16.0.1.0.0',
|
||||
'category': 'Tools',
|
||||
'depends': [
|
||||
'stock_picking_batch',
|
||||
|
||||
@@ -7,14 +7,14 @@ ProductGroup = namedtuple('ProductGroup', ('product_id', 'qty'))
|
||||
|
||||
class StockPicklist(models.AbstractModel):
|
||||
_name = 'report.stock_picklist.report_picklist'
|
||||
_template = 'stock_picklist.report_picklist'
|
||||
# _template = 'stock_picklist.report_picklist'
|
||||
|
||||
@api.model
|
||||
def _get_report_values(self, docids, data=None):
|
||||
report_name = 'stock_picklist.report_picklist'
|
||||
report = self.env['ir.actions.report']._get_report_from_name(report_name)
|
||||
stock_pickings = self.env['stock.picking'].browse(docids)
|
||||
stock_pack_operations = stock_pickings.mapped(lambda o: o.move_lines).mapped(lambda l: l.move_line_ids)
|
||||
stock_pack_operations = stock_pickings.mapped(lambda o: o.move_ids).mapped(lambda l: l.move_line_ids)
|
||||
|
||||
locations = stock_pack_operations.mapped(lambda o: o.location_id)
|
||||
_l = []
|
||||
@@ -23,7 +23,7 @@ class StockPicklist(models.AbstractModel):
|
||||
products = operations.mapped(lambda o: o.product_id)
|
||||
_p = []
|
||||
for product in products:
|
||||
qty = sum(operations.filtered(lambda o: o.product_id.id == product.id).mapped(lambda o: o.product_qty))
|
||||
qty = sum(operations.filtered(lambda o: o.product_id.id == product.id).mapped(lambda o: o.reserved_qty))
|
||||
_p.append(ProductGroup(product_id=product, qty=int(qty)))
|
||||
_p = sorted(_p, key=lambda p: -p.qty)
|
||||
_l.append(LocationGroup(location_id=location, lines=_p))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<report
|
||||
id="picklist"
|
||||
model="stock.picking"
|
||||
@@ -47,5 +46,4 @@
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user