From 7df8f8010410291d55acb2ef8e68851a73e8e543 Mon Sep 17 00:00:00 2001 From: Leonardo Pistone Date: Mon, 13 Jun 2016 15:38:11 +0200 Subject: [PATCH] add missing method get_operations code is authored by @hparfr --- .../stock_quant_package.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/delivery_carrier_label_roulier_laposte/stock_quant_package.py b/delivery_carrier_label_roulier_laposte/stock_quant_package.py index cefc56eaf2..99f47262da 100644 --- a/delivery_carrier_label_roulier_laposte/stock_quant_package.py +++ b/delivery_carrier_label_roulier_laposte/stock_quant_package.py @@ -9,7 +9,7 @@ # Sébastien BEAU ############################################################################## -from openerp import models, fields +from openerp import models, fields, api class StockQuantPackage(models.Model): @@ -21,3 +21,15 @@ class StockQuantPackage(models.Model): help="True if size of package is not standard (according to carrier)", default=False, ) + + @api.multi + def get_operations(self): + """Get operations of the package. + + Usefull for having products and quantities + """ + self.ensure_one() + return self.env['stock.pack.operation'].search([ + ('result_package_id', '=', self.id), + ('product_id', '!=', False), + ])