[MERGE] merge trunk-claimcount-fix-ged
Add the claim_count_out field to its correct place (in addon claim_from_delivery). The field was removed because it was incorrectly added to stock.py instead of the addon claim_from_delivery. (note: it was renamed from claim_count to claim_count_out) bzr revid: ged@openerp.com-20140508083512-jx4mke0r5f8p0lxf
This commit is contained in:
commit
319ed3dede
|
@ -18,6 +18,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import stock_picking
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<div class="oe_right oe_button_box">
|
||||
<button class="oe_inline oe_stat_button" type="action"
|
||||
name="%(action_claim_from_delivery)d" icon="fa-comments" >
|
||||
<field string="Claims" name="claim_count" widget="statinfo"/>
|
||||
<field string="Claims" name="claim_count_out" widget="statinfo"/>
|
||||
</button>
|
||||
</div>
|
||||
</xpath>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
from openerp.osv import fields, osv
|
||||
|
||||
|
||||
class stock_picking(osv.osv):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def _claim_count_out(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_out': fields.function(_claim_count_out, string='Claims', type='integer'),
|
||||
}
|
||||
|
||||
# Because of the way inheritance works in the ORM (bug), and the way stock.picking.out
|
||||
# is defined (inherit from stock.picking, dispatch read to stock.picking), it is necessary
|
||||
# to add the field claim_count_out to this class, even though the _claim_count_out method
|
||||
# in stock_picking_out will not be called (but its existence will be checked).
|
||||
class stock_picking_out(osv.osv):
|
||||
_inherit = 'stock.picking.out'
|
||||
|
||||
def _claim_count_out(self, cr, uid, ids, field_name, arg, context=None):
|
||||
return super(stock_picking_out, self)._claim_count_out(cr, uid, ids, field_name, arg, context=context)
|
||||
|
||||
_columns = {
|
||||
'claim_count_out': fields.function(_claim_count_out, string='Claims', type='integer'),
|
||||
}
|
Loading…
Reference in New Issue