From a47d8d9640bf6e8e2878e938bae312373119f541 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 7 May 2014 20:08:51 +0200 Subject: [PATCH 1/6] [REV] partial revert of revision 9408 ged@openerp.com-20140502144544-c5j7bzlm9i4clv4l where we wrongly beleive than stock depends on crm_claim... :( That code will probably be back _in the right module_ bzr revid: qdp-launchpad@openerp.com-20140507180851-lgkb8n4pscizbwvw --- addons/stock/stock.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 5f7aeb0ef1e..5e527a77fb9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -636,11 +636,7 @@ class stock_picking(osv.osv): vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) new_id = super(stock_picking, self).create(cr, user, vals, context) return new_id - def _claim_count(self, cr, uid, ids, field_name, arg, context=None): - res = {} - claim = self.pool.get('crm.claim').search(cr, uid, [('ref', '=',('stock.picking.out,' + str(ids[0])))], context=context) - res[ids[0]] = len(claim) - return res + _columns = { 'name': fields.char('Reference', size=64, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}), 'origin': fields.char('Source Document', size=64, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Reference of the document", select=True), @@ -684,7 +680,6 @@ class stock_picking(osv.osv): ("none", "Not Applicable")], "Invoice Control", select=True, required=True, readonly=True, track_visibility='onchange', states={'draft': [('readonly', False)]}), 'company_id': fields.many2one('res.company', 'Company', required=True, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}), - 'claim_count': fields.function(_claim_count, string='Claims', type='integer'), } _defaults = { 'name': lambda self, cr, uid, context: '/', @@ -3138,8 +3133,6 @@ class stock_picking_out(osv.osv): out_defaults = super(stock_picking_out, self).default_get(cr, uid, fields_list, context=context) defaults.update(out_defaults) return defaults - 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 = { 'backorder_id': fields.many2one('stock.picking.out', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True), @@ -3157,7 +3150,6 @@ class stock_picking_out(osv.osv): * Ready to Deliver: products reserved, simply waiting for confirmation.\n * Delivered: has been processed, can't be modified or cancelled anymore\n * Cancelled: has been cancelled, can't be confirmed anymore"""), - 'claim_count': fields.function(_claim_count, string='Claims', type='integer'), } _defaults = { 'type': 'out', From 80aa26963ecab647963506c918b5286f3c8e877e Mon Sep 17 00:00:00 2001 From: Launchpad Translations on behalf of openerp <> Date: Thu, 8 May 2014 05:38:46 +0000 Subject: [PATCH 2/6] Launchpad automatic translations update. bzr revid: launchpad_translations_on_behalf_of_openerp-20140508053846-issswyvoac14767d --- addons/calendar/i18n/zh_CN.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/calendar/i18n/zh_CN.po b/addons/calendar/i18n/zh_CN.po index 6c5eaf61576..1193e76da1a 100644 --- a/addons/calendar/i18n/zh_CN.po +++ b/addons/calendar/i18n/zh_CN.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-05-07 06:27+0000\n" +"X-Launchpad-Export-Date: 2014-05-08 05:38+0000\n" "X-Generator: Launchpad (build 16996)\n" "Language: zh_CN\n" From b73e2e95ec04c772f0c304950f40f4f8ccd903c8 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 8 May 2014 09:27:41 +0200 Subject: [PATCH 3/6] [FIX] add missing claim_count field to stock.picking.out The claim_count field was incorrectly added into addon stock instead of addon claim_from_delivery. The commit adding the claim_count field in stock.py was reverted, but claim_count is still needed in claim_delivery_view.xml. bzr revid: ged@openerp.com-20140508072741-sr3a9ishpqtkczlq --- addons/claim_from_delivery/__init__.py | 1 + addons/claim_from_delivery/stock_picking.py | 26 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 addons/claim_from_delivery/stock_picking.py 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'), + } From cf87afbe0ac4a85ce71693bb5939dfc04a0dd2a8 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 8 May 2014 09:50:25 +0200 Subject: [PATCH 4/6] [FIX] configuration file dbfilter's option has no effect lp bug: https://launchpad.net/bugs/940439 fixed bzr revid: fme@openerp.com-20140508075025-yszqmzie1z4n7l4j --- openerp/tools/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/config.py b/openerp/tools/config.py index 6b21bda8b4f..588c2dedf9f 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -153,7 +153,7 @@ class configmanager(object): # WEB group = optparse.OptionGroup(parser, "Web interface Configuration") - group.add_option("--db-filter", dest="dbfilter", default='.*', + group.add_option("--db-filter", dest="dbfilter", my_default='.*', help="Filter listed database", metavar="REGEXP") parser.add_option_group(group) From 131f91db15ea658df19003a4e37fe22a8655e927 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 8 May 2014 09:59:57 +0200 Subject: [PATCH 5/6] [IMP] change claim_count in claim_count_out (addon claim_from_delivery) also, simplify the implementation. The empty method _claim_count in stock_picking_out is due to the weird way inheritance works in openerp, and the fact that stock.picking.out only call the method in its parent bzr revid: ged@openerp.com-20140508075957-lyqvng5i155b28cy --- addons/claim_from_delivery/claim_delivery_view.xml | 2 +- addons/claim_from_delivery/stock_picking.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/claim_from_delivery/claim_delivery_view.xml b/addons/claim_from_delivery/claim_delivery_view.xml index 852d602c269..6f9ca5e4a66 100644 --- a/addons/claim_from_delivery/claim_delivery_view.xml +++ b/addons/claim_from_delivery/claim_delivery_view.xml @@ -18,7 +18,7 @@
diff --git a/addons/claim_from_delivery/stock_picking.py b/addons/claim_from_delivery/stock_picking.py index 9c3121d067c..3a3404bfa93 100644 --- a/addons/claim_from_delivery/stock_picking.py +++ b/addons/claim_from_delivery/stock_picking.py @@ -12,15 +12,15 @@ class stock_picking(osv.osv): } _columns = { - 'claim_count': fields.function(_claim_count, string='Claims', type='integer'), + 'claim_count_out': 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) + pass _columns = { - 'claim_count': fields.function(_claim_count, string='Claims', type='integer'), + 'claim_count_out': fields.function(_claim_count, string='Claims', type='integer'), } From 8e16385aec5954dcb181f85da36b0fd88d6d9438 Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Thu, 8 May 2014 10:31:49 +0200 Subject: [PATCH 6/6] [IMP] change the method name _claim_count into _claim_count_out also, add a comment to explain why it is necessary to add a _claim_count_out method in stock_picking_out even though it will not be called. bzr revid: ged@openerp.com-20140508083149-rdophw2iihzntfpr --- addons/claim_from_delivery/stock_picking.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/claim_from_delivery/stock_picking.py b/addons/claim_from_delivery/stock_picking.py index 3a3404bfa93..6929809bfe2 100644 --- a/addons/claim_from_delivery/stock_picking.py +++ b/addons/claim_from_delivery/stock_picking.py @@ -4,7 +4,7 @@ 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): + 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) @@ -12,15 +12,19 @@ class stock_picking(osv.osv): } _columns = { - 'claim_count_out': fields.function(_claim_count, string='Claims', type='integer'), + '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(self, cr, uid, ids, field_name, arg, context=None): - pass + 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, string='Claims', type='integer'), + 'claim_count_out': fields.function(_claim_count_out, string='Claims', type='integer'), }