[FIX] unmutable default in stock

bzr revid: ls@numerigraphe.fr-20120305175310-l3jcpsf3u0jtf2id
This commit is contained in:
Numerigraphe - Lionel Sausin 2012-03-05 18:53:10 +01:00
parent f120f5aa5b
commit 559843258e
4 changed files with 16 additions and 8 deletions

View File

@ -42,7 +42,9 @@ class external_pdf(render):
class report_stock(report_int):
def create(self, cr, uid, ids, datas, context={}):
def create(self, cr, uid, ids, datas, context=None):
if context is None:
context = {}
product_ids = ids
if 'location_id' in context:
location_id = context['location_id']

View File

@ -74,7 +74,7 @@ class stock_report_prodlots(osv.osv):
group by location_id, product_id, prodlot_id
)""")
def unlink(self, cr, uid, ids, context={}):
def unlink(self, cr, uid, ids, context=None):
raise osv.except_osv(_('Error !'), _('You cannot delete any record!'))
@ -131,7 +131,7 @@ class stock_report_tracklots(osv.osv):
group by location_id, product_id, tracking_id
)""")
def unlink(self, cr, uid, ids, context={}):
def unlink(self, cr, uid, ids, context=None):
raise osv.except_osv(_('Error !'), _('You cannot delete any record!'))
stock_report_tracklots()

View File

@ -26,7 +26,7 @@ from report.interface import toxml
#FIXME: we should use toxml
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context={}):
def create_xml(self, cr, uid, ids, datas, context=None):
config = """
<config>
<date>09/09/2005</date>

View File

@ -345,22 +345,28 @@ class stock_location(osv.osv):
})
return product_obj.get_product_available(cr, uid, product_ids, context=context)
def _product_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
def _product_get(self, cr, uid, id, product_ids=False, context=None, states=None):
"""
@param product_ids:
@param states:
@return:
"""
if states is None:
states = ['done']
ids = id and [id] or []
return self._product_get_multi_location(cr, uid, ids, product_ids, context=context, states=states)
def _product_all_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
def _product_all_get(self, cr, uid, id, product_ids=False, context=None, states=None):
if states is None:
states = ['done']
# build the list of ids of children of the location given by id
ids = id and [id] or []
location_ids = self.search(cr, uid, [('location_id', 'child_of', ids)])
return self._product_get_multi_location(cr, uid, location_ids, product_ids, context, states)
def _product_virtual_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
def _product_virtual_get(self, cr, uid, id, product_ids=False, context=None, states=None):
if states is None:
states = ['done']
return self._product_all_get(cr, uid, id, product_ids, context, ['confirmed', 'waiting', 'assigned', 'done'])
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None, lock=False):
@ -518,7 +524,7 @@ class stock_tracking(osv.osv):
def unlink(self, cr, uid, ids, context=None):
raise osv.except_osv(_('Error'), _('You can not remove a lot line !'))
def action_traceability(self, cr, uid, ids, context={}):
def action_traceability(self, cr, uid, ids, context=None):
""" It traces the information of a product
@param self: The object pointer.
@param cr: A database cursor