From b65b3ea80efb2297aaa192e4cff98d2f71281c39 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 18 Mar 2010 12:01:17 +0530 Subject: [PATCH] [IMP] auction,stock,delivery: Used default_get method instead of _default bzr revid: sbh@tinyerp.com-20100318063117-hkddpaydbbc09zic --- .../wizard/auction_lots_make_invoice.py | 1 + .../wizard/auction_lots_make_invoice_buyer.py | 1 + addons/auction/wizard/auction_pay_buy.py | 1 + addons/delivery/wizard/delivery_sale_order.py | 2 ++ .../wizard/stock_inventory_line_split.py | 29 ++++++++++++++----- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/addons/auction/wizard/auction_lots_make_invoice.py b/addons/auction/wizard/auction_lots_make_invoice.py index 595bd067f4a..231802bcba4 100644 --- a/addons/auction/wizard/auction_lots_make_invoice.py +++ b/addons/auction/wizard/auction_lots_make_invoice.py @@ -43,6 +43,7 @@ class auction_lots_make_invoice(osv.osv_memory): """ res = {} + res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id',False) if not record_id: return res diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer.py b/addons/auction/wizard/auction_lots_make_invoice_buyer.py index e87a1df9865..71a4563812b 100644 --- a/addons/auction/wizard/auction_lots_make_invoice_buyer.py +++ b/addons/auction/wizard/auction_lots_make_invoice_buyer.py @@ -43,6 +43,7 @@ class auction_lots_make_invoice_buyer(osv.osv_memory): """ res = {} record_id = context and context.get('active_id',False) + res = super(auction_lots_make_invoice_buyer, self).default_get(cr, uid, fields, context=context) if not record_id: return res diff --git a/addons/auction/wizard/auction_pay_buy.py b/addons/auction/wizard/auction_pay_buy.py index 3c36bb24f94..919d62cce66 100644 --- a/addons/auction/wizard/auction_pay_buy.py +++ b/addons/auction/wizard/auction_pay_buy.py @@ -43,6 +43,7 @@ class auction_pay_buy(osv.osv_memory): """ res = {} + res = super(auction_pay_buy, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id',False) if not record_id: return res diff --git a/addons/delivery/wizard/delivery_sale_order.py b/addons/delivery/wizard/delivery_sale_order.py index c1896e6d851..8bf09e70974 100644 --- a/addons/delivery/wizard/delivery_sale_order.py +++ b/addons/delivery/wizard/delivery_sale_order.py @@ -49,6 +49,8 @@ class make_delivery(osv.osv_memory): """ rec_id = context and context.get('active_id',False) res = {} + + res = super(make_delivery, self).default_get(cr, uid, fields, context=context) order_obj = self.pool.get('sale.order') order = order_obj.browse(cr, uid, rec_id) diff --git a/addons/stock/wizard/stock_inventory_line_split.py b/addons/stock/wizard/stock_inventory_line_split.py index 1634e32731b..bc28c2866f1 100644 --- a/addons/stock/wizard/stock_inventory_line_split.py +++ b/addons/stock/wizard/stock_inventory_line_split.py @@ -34,14 +34,29 @@ class stock_inventory_line_split(osv.osv_memory): _description = "Split inventory lines" + def default_get(self, cr, uid, fields, context): + """ + @summary: To get default values for the object. + + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for which we want default values + @param context: A standard dictionary + + @return: A dictionary which of fields with values. + + """ + res = {} + record_id = context and context.get('active_id',False) + res = super(stock_inventory_line_split, self).default_get(cr, uid, fields, context=context) + if not record_id: + return res - def _get_product_id(self, cr, uid, context): - line = self.pool.get('stock.inventory.line').browse(cr, uid, context['active_id'], context=context) - return line.product_id.id - - _defaults = { - 'product_id': _get_product_id, - } + lot= self.pool.get('stock.inventory.line').browse(cr, uid, record_id) + res['product_id']=line.product_id.id + return res + def split(self, cr, uid, ids, line_ids, context=None):