diff --git a/addons/claim_from_delivery/__init__.py b/addons/claim_from_delivery/__init__.py index 5e947ee409d..c21aa0d3c3a 100644 --- a/addons/claim_from_delivery/__init__.py +++ b/addons/claim_from_delivery/__init__.py @@ -18,6 +18,7 @@ # ############################################################################## +import stock_picking # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/claim_from_delivery/stock_picking.py b/addons/claim_from_delivery/stock_picking.py new file mode 100644 index 00000000000..9c3121d067c --- /dev/null +++ b/addons/claim_from_delivery/stock_picking.py @@ -0,0 +1,26 @@ +from openerp.osv import fields, osv + + +class stock_picking(osv.osv): + _inherit = 'stock.picking' + + def _claim_count(self, cr, uid, ids, field_name, arg, context=None): + Claim = self.pool['crm.claim'] + return { + id: Claim.search_count(cr, uid, [('ref', '=',('stock.picking.out,' + str(ids[0])))], context=context) + for id in ids + } + + _columns = { + 'claim_count': fields.function(_claim_count, string='Claims', type='integer'), + } + +class stock_picking_out(osv.osv): + _inherit = 'stock.picking.out' + + def _claim_count(self, cr, uid, ids, field_name, arg, context=None): + return super(stock_picking_out, self)._claim_count(cr, uid, ids, field_name, arg, context=context) + + _columns = { + 'claim_count': fields.function(_claim_count, string='Claims', type='integer'), + }