[IMP] stock: Task ID-813: Added Doc strings to stock and related modules with wizards.

bzr revid: uco@tinyerp.com-20100526125930-i6dgh9vj9t82tqap
This commit is contained in:
uco (OpenERP) 2010-05-26 18:29:30 +05:30
parent 89aa554e79
commit 2b33245391
16 changed files with 519 additions and 362 deletions

View File

@ -27,13 +27,10 @@ class product_product(osv.osv):
_inherit = "product.product"
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
"""
Changes the Standard Price of Product and creates an account move accordingly.
@param datas : dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
@param context: A standard dictionary
@return:
""" Changes the Standard Price of Product and creates an account move accordingly.
@param datas : dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
@param context: A standard dictionary
@return:
"""
location_obj = self.pool.get('stock.location')
@ -147,7 +144,10 @@ class product_product(osv.osv):
return _('Products: ')+self.pool.get('stock.location').browse(cr, user, context['location'], context).name
return res
def get_product_available(self,cr,uid,ids,context=None):
def get_product_available(self, cr, uid, ids, context=None):
""" Finds whether product is available or not in particular warehouse.
@return: Dictionary of values
"""
if context is None:
context = {}
states = context.get('states',[])
@ -252,22 +252,25 @@ class product_product(osv.osv):
return res
def _product_available(self, cr, uid, ids, field_names=None, arg=False, context={}):
""" Finds the incoming and outgoing quantity of product.
@return: Dictionary of values
"""
if not field_names:
field_names=[]
field_names = []
res = {}
for id in ids:
res[id] = {}.fromkeys(field_names, 0.0)
for f in field_names:
c = context.copy()
if f=='qty_available':
c.update({ 'states':('done',), 'what':('in', 'out') })
if f=='virtual_available':
c.update({ 'states':('confirmed','waiting','assigned','done'), 'what':('in', 'out') })
if f=='incoming_qty':
c.update({ 'states':('confirmed','waiting','assigned'), 'what':('in',) })
if f=='outgoing_qty':
c.update({ 'states':('confirmed','waiting','assigned'), 'what':('out',) })
stock=self.get_product_available(cr,uid,ids,context=c)
if f == 'qty_available':
c.update({ 'states': ('done',), 'what': ('in', 'out') })
if f == 'virtual_available':
c.update({ 'states': ('confirmed','waiting','assigned','done'), 'what': ('in', 'out') })
if f == 'incoming_qty':
c.update({ 'states': ('confirmed','waiting','assigned'), 'what': ('in',) })
if f == 'outgoing_qty':
c.update({ 'states': ('confirmed','waiting','assigned'), 'what': ('out',) })
stock = self.get_product_available(cr, uid, ids, context=c)
for id in ids:
res[id][f] = stock.get(id, 0.0)
return res

View File

@ -78,6 +78,9 @@ class stock_location(osv.osv):
return res
def _complete_name(self, cr, uid, ids, name, args, context):
""" Forms complete name of location from parent location to child location.
@return: Dictionary of values
"""
def _get_one_full_name(location, level=4):
if location.location_id:
parent_path = _get_one_full_name(location.location_id, level-1) + "/"
@ -90,6 +93,9 @@ class stock_location(osv.osv):
return res
def _product_qty_available(self, cr, uid, ids, field_names, arg, context={}):
""" Finds real and virtual quantity for product available at particular location.
@return: Dictionary of values
"""
res = {}
for id in ids:
res[id] = {}.fromkeys(field_names, 0.0)
@ -106,6 +112,10 @@ class stock_location(osv.osv):
return res
def product_detail(self, cr, uid, id, field, context={}):
""" Finds detail of product like price type, currency and then calculates its price.
@param field: Field name
@return: Calculated price
"""
res = {}
res[id] = {}
final_value = 0.0
@ -117,21 +127,25 @@ class stock_location(osv.osv):
if result:
# Choose the right filed standard_price to read
# Take the user company
price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id
pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id)
price_type_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id
pricetype = self.pool.get('product.price.type').browse(cr, uid, price_type_id)
for r in result:
c = (context or {}).copy()
c['location'] = id
product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c)
# Compute the amount_unit in right currency
context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id
amount_unit=self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']]
context['currency_id'] = self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id
amount_unit = self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']]
final_value += (product[field_to_read] * amount_unit)
return final_value
def _product_value(self, cr, uid, ids, field_names, arg, context={}):
""" Calculates real and virtual stock value of a product.
@param field_names: Name of field
@return: Dictionary of values
"""
result = {}
for id in ids:
result[id] = {}.fromkeys(field_names, 0.0)
@ -199,6 +213,12 @@ class stock_location(osv.osv):
}
def chained_location_get(self, cr, uid, location, partner=None, product=None, context={}):
""" Finds chained location
@param location: Location id
@param partner: Partner id
@param product: Product id
@return: List of values
"""
result = None
if location.chained_location_type == 'customer':
if partner:
@ -210,6 +230,11 @@ class stock_location(osv.osv):
return result
def picking_type_get(self, cr, uid, from_location, to_location, context={}):
""" Gets type of picking.
@param from_location: Source location
@param to_location: Destination location
@return: Location type
"""
result = 'internal'
if (from_location.usage=='internal') and (to_location and to_location.usage in ('customer', 'supplier')):
result = 'delivery'
@ -224,13 +249,18 @@ class stock_location(osv.osv):
def _product_get_report(self, cr, uid, ids, product_ids=False,
context=None, recursive=False):
""" Finds the product quantity and price for particular location.
@param product_ids: Ids of product
@param recursive: True or False
@return: Dictionary of values
"""
if context is None:
context = {}
product_obj = self.pool.get('product.product')
# Take the user company and pricetype
price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id
pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id)
context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id
price_type_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.property_valuation_price_type.id
pricetype = self.pool.get('product.price.type').browse(cr, uid, price_type_id)
context['currency_id'] = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
if not product_ids:
product_ids = product_obj.search(cr, uid, [])
@ -265,7 +295,7 @@ class stock_location(osv.osv):
# Compute based on pricetype
# Choose the right filed standard_price to read
amount_unit=product.price_get(pricetype.field, context)[product.id]
amount_unit = product.price_get(pricetype.field, context)[product.id]
price = qty[product_id] * amount_unit
# price = qty[product_id] * product.standard_price
@ -283,7 +313,14 @@ class stock_location(osv.osv):
result['total_price'] = total_price
return result
def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={}, states=['done'], what=('in', 'out')):
def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={},
states=['done'], what=('in', 'out')):
"""
@param product_ids: Ids of product
@param states: List of states
@param what: Tuple of
@return:
"""
product_obj = self.pool.get('product.product')
context.update({
'states': states,
@ -293,6 +330,11 @@ 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={}, states=['done']):
"""
@param product_ids:
@param states:
@return:
"""
ids = id and [id] or []
return self._product_get_multi_location(cr, uid, ids, product_ids, context, states)
@ -313,6 +355,11 @@ class stock_location(osv.osv):
# [ (tracking_id, product_qty, location_id) ]
#
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context={}):
"""
@param product_id: Id of product
@param product_qty: Quantity of product
@return: List of Values or False
"""
result = []
amount = 0.0
for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):
@ -352,6 +399,10 @@ class stock_tracking(osv.osv):
_description = "Stock Tracking Lots"
def get_create_tracking_lot(self, cr, uid, ids, tracking_lot):
"""
@param tracking_lot: Name of tracking lot
@return:
"""
tracking_lot_list = self.search(cr, uid, [('name', '=', tracking_lot)],
limit=1)
if tracking_lot_list:
@ -382,6 +433,7 @@ class stock_tracking(osv.osv):
'move_ids': fields.one2many('stock.move', 'tracking_id', 'Moves Tracked'),
'date': fields.datetime('Created Date', required=True),
}
_defaults = {
'active': lambda *a: 1,
'name': make_sscc,
@ -417,6 +469,12 @@ class stock_picking(osv.osv):
_description = "Picking List"
def _set_maximum_date(self, cr, uid, ids, name, value, arg, context):
""" Calculates planned date if it is greater than 'value'.
@param name: Name of field
@param value: Value of field
@param arg: User defined argument
@return: True or False
"""
if not value:
return False
if isinstance(ids, (int, long)):
@ -433,6 +491,12 @@ class stock_picking(osv.osv):
return True
def _set_minimum_date(self, cr, uid, ids, name, value, arg, context):
""" Calculates planned date if it is less than 'value'.
@param name: Name of field
@param value: Value of field
@param arg: User defined argument
@return: True or False
"""
if not value:
return False
if isinstance(ids, (int, long)):
@ -448,6 +512,9 @@ class stock_picking(osv.osv):
return True
def get_min_max_date(self, cr, uid, ids, field_name, arg, context={}):
""" Finds minimum and maximum dates for picking.
@return: Dictionary of values
"""
res = {}
for id in ids:
res[id] = {'min_date': False, 'max_date': False}
@ -551,6 +618,9 @@ class stock_picking(osv.osv):
return moves
def action_confirm(self, cr, uid, ids, context={}):
""" Confirms picking.
@return: True
"""
self.write(cr, uid, ids, {'state': 'confirmed'})
todo = []
for picking in self.browse(cr, uid, ids, context=context):
@ -574,6 +644,9 @@ class stock_picking(osv.osv):
# return True
def action_assign(self, cr, uid, ids, *args):
""" Changes state of picking to available if all moves are confirmed.
@return: True
"""
for pick in self.browse(cr, uid, ids):
move_ids = [x.id for x in pick.move_lines if x.state == 'confirmed']
if not move_ids:
@ -582,6 +655,9 @@ class stock_picking(osv.osv):
return True
def force_assign(self, cr, uid, ids, *args):
""" Changes state of picking to available if moves are confirmed or waiting.
@return: True
"""
wf_service = netsvc.LocalService("workflow")
for pick in self.browse(cr, uid, ids):
move_ids = [x.id for x in pick.move_lines if x.state in ['confirmed','waiting']]
@ -591,6 +667,9 @@ class stock_picking(osv.osv):
return True
def draft_force_assign(self, cr, uid, ids, *args):
""" Confirms picking directly from draft state.
@return: True
"""
wf_service = netsvc.LocalService("workflow")
for pick in self.browse(cr, uid, ids):
wf_service.trg_validate(uid, 'stock.picking', pick.id,
@ -601,6 +680,9 @@ class stock_picking(osv.osv):
return True
def draft_validate(self, cr, uid, ids, *args):
""" Validates picking directly from draft state.
@return: True
"""
wf_service = netsvc.LocalService("workflow")
self.draft_force_assign(cr, uid, ids)
for pick in self.browse(cr, uid, ids):
@ -613,6 +695,9 @@ class stock_picking(osv.osv):
return True
def cancel_assign(self, cr, uid, ids, *args):
""" Cancels picking and moves.
@return: True
"""
wf_service = netsvc.LocalService("workflow")
for pick in self.browse(cr, uid, ids):
move_ids = [x.id for x in pick.move_lines]
@ -621,6 +706,9 @@ class stock_picking(osv.osv):
return True
def action_assign_wkf(self, cr, uid, ids, context=None):
""" Changes picking state to assigned.
@return: True
"""
for pick in self.browse(cr, uid, ids, context=context):
type_list = {
'out':'Packing List',
@ -634,6 +722,9 @@ class stock_picking(osv.osv):
return True
def test_finnished(self, cr, uid, ids):
""" Tests whether the move is in done or cancel state or not.
@return: True or False
"""
move_ids = self.pool.get('stock.move').search(cr, uid, [('picking_id', 'in', ids)])
for move in self.pool.get('stock.move').browse(cr, uid, move_ids):
if move.state not in ('done', 'cancel'):
@ -644,18 +735,24 @@ class stock_picking(osv.osv):
return True
def test_assigned(self, cr, uid, ids):
""" Tests whether the move is in assigned state or not.
@return: True or False
"""
ok = True
for pick in self.browse(cr, uid, ids):
mt = pick.move_type
for move in pick.move_lines:
if (move.state in ('confirmed', 'draft')) and (mt=='one'):
if (move.state in ('confirmed', 'draft')) and (mt == 'one'):
return False
if (mt=='direct') and (move.state=='assigned') and (move.product_qty):
if (mt == 'direct') and (move.state == 'assigned') and (move.product_qty):
return True
ok = ok and (move.state in ('cancel', 'done', 'assigned'))
return ok
def action_cancel(self, cr, uid, ids, context={}):
""" Changes picking state to cancel.
@return: True
"""
for pick in self.browse(cr, uid, ids):
ids2 = [move.id for move in pick.move_lines]
self.pool.get('stock.move').action_cancel(cr, uid, ids2, context)
@ -666,10 +763,16 @@ class stock_picking(osv.osv):
# TODO: change and create a move if not parents
#
def action_done(self, cr, uid, ids, context=None):
""" Changes picking state to done.
@return: True
"""
self.write(cr, uid, ids, {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
def action_move(self, cr, uid, ids, context={}):
""" Changes move state to assigned.
@return: True
"""
for pick in self.browse(cr, uid, ids):
todo = []
for move in pick.move_lines:
@ -685,13 +788,17 @@ class stock_picking(osv.osv):
return False
def _get_payment_term(self, cr, uid, picking):
'''Return {'contact': address, 'invoice': address} for invoice'''
""" Gets payment term from partner.
@return: Payment term
"""
partner_obj = self.pool.get('res.partner')
partner = picking.address_id.partner_id
return partner.property_payment_term and partner.property_payment_term.id or False
def _get_address_invoice(self, cr, uid, picking):
'''Return {'contact': address, 'invoice': address} for invoice'''
""" Gets invoice address of a partner
@return {'contact': address, 'invoice': address} for invoice
"""
partner_obj = self.pool.get('res.partner')
partner = picking.address_id.partner_id
@ -699,11 +806,17 @@ class stock_picking(osv.osv):
['contact', 'invoice'])
def _get_comment_invoice(self, cr, uid, picking):
'''Return comment string for invoice'''
"""
@return: comment string for invoice
"""
return picking.note or ''
def _get_price_unit_invoice(self, cr, uid, move_line, type, context=None):
'''Return the price unit for the move line'''
""" Gets price unit for invoice
@param move_line: Stock move lines
@param type: Type of invoice
@return: The price unit for the move line
"""
if context is None:
context = {}
@ -723,7 +836,11 @@ class stock_picking(osv.osv):
return 0.0
def _get_taxes_invoice(self, cr, uid, move_line, type):
'''Return taxes ids for the move line'''
""" Gets taxes on invoice
@param move_line: Stock move lines
@param type: Type of invoice
@return: Taxes Ids for the move line
"""
if type in ('in_invoice', 'in_refund'):
taxes = move_line.product_id.supplier_taxes_id
else:
@ -752,7 +869,12 @@ class stock_picking(osv.osv):
def action_invoice_create(self, cr, uid, ids, journal_id=False,
group=False, type='out_invoice', context=None):
'''Return ids of created invoices for the pickings'''
""" Creates invoice based on the invoice state selected for picking.
@param journal_id: Id of journal
@param group: Whether to create a group invoice or not
@param type: Type invoice to be created
@return: Ids of created invoices for the pickings
"""
if context is None:
context = {}
@ -882,6 +1004,9 @@ class stock_picking(osv.osv):
return res
def test_cancel(self, cr, uid, ids, context={}):
""" Test whether the move lines are canceled or not.
@return: True or False
"""
for pick in self.browse(cr, uid, ids, context=context):
if not pick.move_lines:
return False
@ -911,9 +1036,11 @@ class stock_picking(osv.osv):
return super(stock_picking, self).unlink(cr, uid, ids, context=context)
def do_partial(self, cr, uid, ids, partial_datas, context={}):
"""
@ partial_datas : dict. contain details of partial picking
like partner_id, address_id, delivery_date, delivery moves with product_id, product_qty, uom
""" Makes partial picking and moves done.
@param partial_datas : Dictionary containing details of partial picking
like partner_id, address_id, delivery_date,
delivery moves with product_id, product_qty, uom
@return: Dictionary of values
"""
res = {}
move_obj = self.pool.get('stock.move')
@ -1077,6 +1204,9 @@ class stock_production_lot(osv.osv):
_description = 'Production lot'
def _get_stock(self, cr, uid, ids, field_name, arg, context={}):
""" Gets stock of products for locations
@return: Dictionary of values
"""
if 'location_id' not in context:
locations = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')], context=context)
else:
@ -1098,6 +1228,9 @@ class stock_production_lot(osv.osv):
return res
def _stock_search(self, cr, uid, obj, name, args, context):
""" Searches Ids of products
@return: Ids of locations
"""
locations = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')])
cr.execute('''select
prodlot_id,
@ -1121,6 +1254,7 @@ class stock_production_lot(osv.osv):
'revisions': fields.one2many('stock.production.lot.revision', 'lot_id', 'Revisions'),
'company_id': fields.many2one('res.company','Company',select=1),
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.lot.serial'),
@ -1135,6 +1269,7 @@ stock_production_lot()
class stock_production_lot_revision(osv.osv):
_name = 'stock.production.lot.revision'
_description = 'Production lot revisions'
_columns = {
'name': fields.char('Revision Name', size=64, required=True),
'description': fields.text('Description'),
@ -1154,10 +1289,11 @@ stock_production_lot_revision()
class stock_delivery(osv.osv):
""" Tracability of partialdeliveries """
""" Traceability of partial deliveries """
_name = "stock.delivery"
_description = "Delivery"
_columns = {
'name': fields.char('Name', size=60, required=True),
'date': fields.datetime('Date', required=True),
@ -1192,6 +1328,9 @@ class stock_move(osv.osv):
return res
def _check_tracking(self, cr, uid, ids):
""" Checks if production lot is assigned to stock move or not.
@return: True or False
"""
for move in self.browse(cr, uid, ids):
if not move.prodlot_id and \
(move.state == 'done' and \
@ -1205,6 +1344,9 @@ class stock_move(osv.osv):
return True
def _check_product_lot(self, cr, uid, ids):
""" Checks whether move is done or not and production lot is assigned to that move.
@return: True or False
"""
for move in self.browse(cr, uid, ids):
if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id):
return False
@ -1264,6 +1406,9 @@ class stock_move(osv.osv):
['prodlot_id'])]
def _default_location_destination(self, cr, uid, context={}):
""" Gets default address of partner for destination location
@return: Address id or False
"""
if context.get('move_line', []):
if context['move_line'][0]:
if isinstance(context['move_line'][0], (tuple, list)):
@ -1276,6 +1421,9 @@ class stock_move(osv.osv):
return False
def _default_location_source(self, cr, uid, context={}):
""" Gets default address of partner for source location
@return: Address id or False
"""
if context.get('move_line', []):
try:
return context['move_line'][0][2]['location_id']
@ -1326,7 +1474,15 @@ class stock_move(osv.osv):
cursor.commit()
return res
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False, loc_id=False, product_id=False, context=None):
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,
loc_id=False, product_id=False, context=None):
""" On change of production lot gives a warning message.
@param prodlot_id: Changed production lot id
@param product_qty: Quantity of product
@param loc_id: Location id
@param product_id: Product id
@return: Warning message
"""
if not prodlot_id or not loc_id:
return {}
ctx = context and context.copy() or {}
@ -1341,7 +1497,15 @@ class stock_move(osv.osv):
}
return {'warning': warning}
def onchange_quantity(self, cr, uid, ids, product_id, product_qty, product_uom, product_uos):
def onchange_quantity(self, cr, uid, ids, product_id, product_qty,
product_uom, product_uos):
""" On change of product quantity finds UoM and UoS quantities
@param product_id: Product id
@param product_qty: Changed Quantity of product
@param product_uom: Unit of measure of product
@param product_uos: Unit of sale of product
@return: Dictionary of values
"""
result = {
'product_uos_qty': 0.00
}
@ -1359,7 +1523,15 @@ class stock_move(osv.osv):
return {'value': result}
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False, loc_dest_id=False, address_id=False):
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
loc_dest_id=False, address_id=False):
""" On change of product id, if finds UoM, UoS, quantity and UoS quantity.
@param prod_id: Changed Product id
@param loc_id: Source location id
@param loc_id: Destination location id
@param address_id: Address id of partner
@return: Dictionary of values
"""
if not prod_id:
return {}
lang = False
@ -1386,6 +1558,10 @@ class stock_move(osv.osv):
return {'value': result}
def _chain_compute(self, cr, uid, moves, context={}):
""" Finds whether the location has chained location type or not.
@param moves: Stock moves
@return: Dictionary containing destination location with chained location type.
"""
result = {}
for m in moves:
dest = self.pool.get('stock.location').chained_location_get(
@ -1408,6 +1584,9 @@ class stock_move(osv.osv):
return result
def action_confirm(self, cr, uid, ids, context={}):
""" Confirms stock move.
@return: List of ids.
"""
# ids = map(lambda m: m.id, moves)
moves = self.browse(cr, uid, ids)
self.write(cr, uid, ids, {'state': 'confirmed'})
@ -1455,6 +1634,9 @@ class stock_move(osv.osv):
return []
def action_assign(self, cr, uid, ids, *args):
""" Changes state to confirmed or waiting.
@return: List of values
"""
todo = []
for move in self.browse(cr, uid, ids):
if move.state in ('confirmed', 'waiting'):
@ -1463,10 +1645,16 @@ class stock_move(osv.osv):
return res
def force_assign(self, cr, uid, ids, context={}):
""" Changes the state to assigned.
@return: True
"""
self.write(cr, uid, ids, {'state': 'assigned'})
return True
def cancel_assign(self, cr, uid, ids, context={}):
""" Changes the state to confirmed.
@return: True
"""
self.write(cr, uid, ids, {'state': 'confirmed'})
return True
@ -1474,6 +1662,9 @@ class stock_move(osv.osv):
# Duplicate stock.move
#
def check_assign(self, cr, uid, ids, context={}):
""" Checks the product type and accordingly writes the state.
@return: No. of moves done
"""
done = []
count = 0
pickings = {}
@ -1515,6 +1706,9 @@ class stock_move(osv.osv):
# Cancel move => cancel others move and pickings
#
def action_cancel(self, cr, uid, ids, context={}):
""" Cancels the moves and if all moves are cancelled it cancels the picking.
@return: True
"""
if not len(ids):
return True
pickings = {}
@ -1540,6 +1734,9 @@ class stock_move(osv.osv):
return True
def action_done(self, cr, uid, ids, context={}):
""" Makes the move done and if all moves are done, it will finish the picking.
@return:
"""
track_flag = False
picking_ids = []
product_uom_obj = self.pool.get('product.uom')
@ -1679,6 +1876,9 @@ class stock_move(osv.osv):
cr, uid, ids, context=context)
def _create_lot(self, cr, uid, ids, product_id, prefix=False):
""" Creates production lot
@return: Production lot id
"""
prodlot_obj = self.pool.get('stock.production.lot')
ir_sequence_obj = self.pool.get('ir.sequence')
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
@ -1694,18 +1894,15 @@ class stock_move(osv.osv):
def action_scrap(self, cr, uid, ids, quantity, location_id, context=None):
'''
Move the scrap/damaged product into scrap location
@ param cr: the database cursor
@ param uid: the user id
@ param ids: ids of stock move object to be scraped
@ param quantity : specify scrap qty
@ param location_id : specify scrap location
@ param context: context arguments
@ return: Scraped lines
'''
""" Move the scrap/damaged product into scrap location
@param cr: the database cursor
@param uid: the user id
@param ids: ids of stock move object to be scraped
@param quantity : specify scrap qty
@param location_id : specify scrap location
@param context: context arguments
@return: Scraped lines
"""
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
res = []
@ -1726,19 +1923,16 @@ class stock_move(osv.osv):
return res
def action_split(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
'''
Split Stock Move lines into production lot which specified split by quantity.
@ param cr: the database cursor
@ param uid: the user id
@ param ids: ids of stock move object to be splited
@ param split_by_qty : specify split by qty
@ param prefix : specify prefix of production lot
@ param with_lot : if true, prodcution lot will assign for split line otherwise not.
@ param context: context arguments
@ return: splited move lines
'''
""" Split Stock Move lines into production lot which specified split by quantity.
@param cr: the database cursor
@param uid: the user id
@param ids: ids of stock move object to be splited
@param split_by_qty : specify split by qty
@param prefix : specify prefix of production lot
@param with_lot : if true, prodcution lot will assign for split line otherwise not.
@param context: context arguments
@return: Splited move lines
"""
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
@ -1789,18 +1983,15 @@ class stock_move(osv.osv):
return res
def action_consume(self, cr, uid, ids, quantity, location_id=False, context=None):
'''
Consumed product with specific quatity from specific source location
@ param cr: the database cursor
@ param uid: the user id
@ param ids: ids of stock move object to be consumed
@ param quantity : specify consume quantity
@ param location_id : specify source location
@ param context: context arguments
@ return: Consumed lines
'''
""" Consumed product with specific quatity from specific source location
@param cr: the database cursor
@param uid: the user id
@param ids: ids of stock move object to be consumed
@param quantity : specify consume quantity
@param location_id : specify source location
@param context: context arguments
@return: Consumed lines
"""
if context is None:
context = {}
@ -1860,9 +2051,10 @@ class stock_move(osv.osv):
return res
def do_partial(self, cr, uid, ids, partial_datas, context={}):
"""
@ partial_datas : dict. contain details of partial picking
like partner_id, address_id, delivery_date, delivery moves with product_id, product_qty, uom
""" Makes partial pickings and moves done.
@param partial_datas: Dictionary containing details of partial picking
like partner_id, address_id, delivery_date, delivery
moves with product_id, product_qty, uom
"""
res = {}
picking_obj = self.pool.get('stock.picking')
@ -2016,10 +2208,17 @@ class stock_inventory(osv.osv):
def _inventory_line_hook(self, cr, uid, inventory_line, move_vals):
'''Creates a stock move from an inventory line'''
""" Creates a stock move from an inventory line
@param inventory_line:
@param move_vals:
@return:
"""
return self.pool.get('stock.move').create(cr, uid, move_vals)
def action_done(self, cr, uid, ids, context=None):
""" Finishes the inventory and writes its finished date
@return: True
"""
for inv in self.browse(cr, uid, ids):
move_ids = []
move_line = []
@ -2066,12 +2265,18 @@ class stock_inventory(osv.osv):
return True
def action_cancel(self, cr, uid, ids, context={}):
""" Cancels the stock move and change inventory state to draft.
@return: True
"""
for inv in self.browse(cr, uid, ids):
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in inv.move_ids], context)
self.write(cr, uid, [inv.id], {'state': 'draft'})
return True
def action_cancel_inventary(self, cr, uid, ids, context={}):
""" Cancels both stock move and inventory
@return: True
"""
for inv in self.browse(cr,uid,ids):
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in inv.move_ids], context)
self.write(cr, uid, [inv.id], {'state':'cancel'})
@ -2095,6 +2300,12 @@ class stock_inventory_line(osv.osv):
}
def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False):
""" Changes UoM and name if product_id changes.
@param location_id: Location id
@param product: Changed product_id
@param uom: UoM product
@return: Dictionary of changed values
"""
if not product:
return {}
if not uom:

View File

@ -34,17 +34,13 @@ class change_standard_price(osv.osv_memory):
}
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
""" 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.
"""
product_pool = self.pool.get('product.product')
product_obj = product_pool.browse(cr, uid, context.get('active_id', False))
@ -68,6 +64,16 @@ class change_standard_price(osv.osv_memory):
return res
def onchange_price(self, cr, uid, ids, new_price, context = {}):
""" Sets stock input and output account according to the difference
of old price and new price.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of IDs selected
@param new_price: Changed price
@param context: A standard dictionary
@return: Dictionary of values
"""
product_obj = self.pool.get('product.product').browse(cr, uid, context.get('active_id', False))
price = product_obj.standard_price
diff = price - new_price
@ -77,18 +83,14 @@ class change_standard_price(osv.osv_memory):
return {'value' : {'enable_stock_in_out_acc':False}}
def change_price(self, cr, uid, ids, context):
"""
Changes the Standard Price of Product.
And creates an account move accordingly.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of IDs selected
@param context: A standard dictionary
@return:
""" Changes the Standard Price of Product.
And creates an account move accordingly.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of IDs selected
@param context: A standard dictionary
@return:
"""
rec_id = context and context.get('active_id', False)
assert rec_id, _('Active ID is not set in Context')

View File

@ -34,21 +34,17 @@ class stock_fill_inventory(osv.osv_memory):
_description = "Fill Inventory"
_columns = {
'location_id': fields.many2one('stock.location', 'Location', required=True),
'recursive': fields.boolean("Include all childs for the location"),
}
'recursive': fields.boolean("Include all children for the location"),
}
def fill_inventory(self, cr, uid, ids, context):
"""
To fill stock inventory according to products available in the selected locations..
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
""" To fill stock inventory according to products available in the selected locations.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
inventory_line_obj = self.pool.get('stock.inventory.line')
location_obj = self.pool.get('stock.location')

View File

@ -35,17 +35,13 @@ class stock_inventory_line_split(osv.osv_memory):
def default_get(self, cr, uid, fields, context):
"""
To check the availability of production lot.
@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.
""" To check the availability of production lot.
@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.
"""
record_id = context and context.get('active_id',False)
res = super(stock_inventory_line_split, self).default_get(cr, uid, fields, context=context)
@ -55,18 +51,14 @@ class stock_inventory_line_split(osv.osv_memory):
return res
def split(self, cr, uid, ids, line_ids, context=None):
"""
To split stock inventory lines according to production lot
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param line_ids: the ID or list of IDs of inventory lines we want to split
@param context: A standard dictionary
@return:
""" To split stock inventory lines according to production lot.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param line_ids: the ID or list of IDs of inventory lines we want to split
@param context: A standard dictionary
@return:
"""
prodlot_obj = self.pool.get('stock.production.lot')
ir_sequence_obj = self.pool.get('ir.sequence')

View File

@ -31,22 +31,15 @@ import wizard
class stock_inventory_merge(osv.osv_memory):
_name = "stock.inventory.merge"
_description = "Merge Inventory"
_columns = {
}
def do_merge(self, cr, uid, ids, context):
"""
To merge selected Inventories.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of IDs selected
@param context: A standard dictionary
@return:
""" To merge selected Inventories.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of IDs selected
@param context: A standard dictionary
@return:
"""
invent_obj = self.pool.get('stock.inventory')
invent_line_obj = self.pool.get('stock.inventory.line')

View File

@ -32,22 +32,19 @@ import wizard
class inventory_set_stock_zero(osv.osv_memory):
_name = "stock.inventory.set.stock.zero"
_description = "Set Stock to 0"
_columns = {
'location_id': fields.many2one('stock.location', 'Location', required=True),
}
}
def do_merge(self, cr, uid, ids, context):
"""
To set stock to Zero
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
""" To set stock to Zero
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
invent_obj = pooler.get_pool(cr.dbname).get('stock.inventory')
invent_line_obj = pooler.get_pool(cr.dbname).get('stock.inventory.line')

View File

@ -39,20 +39,16 @@ class stock_invoice_onshipping(osv.osv_memory):
('out_refund', 'Customer Refund'),
('in_refund', 'Supplier Refund')] , 'Type', required=True),
'invoice_date': fields.date('Invoiced date'),
}
}
def _get_type(self, cr, uid, context=None):
"""
To get invoice type
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return: invoice type
""" To get invoice type.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: The ID or list of IDs if we want more than one
@param context: A standard dictionary
@return: Invoice type
"""
if context is None:
context = {}
@ -80,20 +76,16 @@ class stock_invoice_onshipping(osv.osv_memory):
_defaults = {
'type': _get_type,
}
}
def create_invoice(self, cr, uid, ids, context):
"""
To create invoice
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return: invoice ids
""" To create invoice
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return: Invoice ids
"""
result = []
picking_obj = self.pool.get('stock.picking')

View File

@ -30,16 +30,13 @@ class stock_location_product(osv.osv_memory):
}
def action_open_window(self, cr, uid, ids, context):
"""
To open location wise product information specific to given duration
""" To open location wise product information specific to given duration
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param ids: An ID or list of IDs if we want more than one
@param context: A standard dictionary
@return: invoice type
@return: Invoice type
"""
mod_obj = self.pool.get('ir.model.data')
for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']):

View File

@ -29,24 +29,20 @@ class stock_move_track(osv.osv_memory):
_columns = {
'tracking_prefix': fields.char('Tracking prefix', size=64),
'quantity': fields.float("Quantity per lot")
}
}
_defaults = {
'quantity': lambda *x: 1
}
}
def track_lines(self, cr, uid, ids, context={}):
"""
To track stock moves lines
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
""" To track stock moves lines
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: An ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
datas = self.read(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
@ -67,17 +63,13 @@ class stock_move_consume(osv.osv_memory):
}
def default_get(self, cr, uid, fields, context=None):
"""
Get default values
@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 default value
@param context: A standard dictionary
@return: default values of fields
""" Get default values
@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 default value
@param context: A standard dictionary
@return: default values of fields
"""
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
@ -93,17 +85,13 @@ class stock_move_consume(osv.osv_memory):
return res
def do_move_consume(self, cr, uid, ids, context={}):
"""
To move consumed products
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
""" To move consumed products
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
@ -126,17 +114,13 @@ class stock_move_scrap(osv.osv_memory):
}
def default_get(self, cr, uid, fields, context=None):
"""
Get default values
@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 default value
@param context: A standard dictionary
@return: default values of fields
""" Get default values
@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 default value
@param context: A standard dictionary
@return: default values of fields
"""
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
@ -158,17 +142,13 @@ class stock_move_scrap(osv.osv_memory):
return res
def move_scrap(self, cr, uid, ids, context={}):
"""
To move scraped products
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
""" To move scraped products
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
@ -186,17 +166,13 @@ class split_in_production_lot(osv.osv_memory):
_description = "Split in Production lots"
def default_get(self, cr, uid, fields, context=None):
"""
Get default values
@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 default value
@param context: A standard dictionary
@return: default values of fields
""" Get default values
@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 default value
@param context: A standard dictionary
@return: Default values of fields
"""
res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context)
@ -209,35 +185,28 @@ class split_in_production_lot(osv.osv_memory):
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
'line_ids': fields.one2many('stock.move.split.lines', 'lot_id', 'Lots Number')
}
def split_lot(self, cr, uid, ids, context=None):
"""
To split a lot
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
""" To split a lot
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: An ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
self.split(cr, uid, ids, context.get('active_ids'), context=context)
return {}
def split(self, cr, uid, ids, move_ids, context=None):
"""
To split stock moves into production lot
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param move_ids: the ID or list of IDs of stock move we want to split
@param context: A standard dictionary
@return:
""" To split stock moves into production lot
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param move_ids: the ID or list of IDs of stock move we want to split
@param context: A standard dictionary
@return:
"""
prodlot_obj = self.pool.get('stock.production.lot')
ir_sequence_obj = self.pool.get('ir.sequence')
@ -303,6 +272,7 @@ class stock_move_split_lines(osv.osv_memory):
'lot_id': fields.many2one('stock.move.split', 'Lot'),
'action': fields.selection([('split','Split'),('keepinone','Keep in one lot')],'Action'),
}
_defaults = {
'quantity': lambda *x: 1,
'action' : lambda *x: 'split',

View File

@ -30,10 +30,9 @@ class stock_partial_move(osv.osv_memory):
_name = "stock.partial.move"
_description = "Partial Move"
_columns = {
'date': fields.datetime('Date', required=True),
'partner_id': fields.many2one('res.partner',string="Partner", required=True),
'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered", required=True),
'date': fields.datetime('Date', required=True),
'partner_id': fields.many2one('res.partner',string="Partner", required=True),
'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered", required=True),
}
def view_init(self, cr, uid, fields_list, context=None):
@ -140,17 +139,13 @@ class stock_partial_move(osv.osv_memory):
return result
def default_get(self, cr, uid, fields, context=None):
"""
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.
""" 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 = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
@ -185,7 +180,16 @@ class stock_partial_move(osv.osv_memory):
res['move%s_product_currency'%(m.id)] = currency
return res
def do_partial(self, cr, uid, ids, context):
def do_partial(self, cr, uid, ids, context):
""" Makes partial moves and pickings done.
@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.
"""
rec_id = context and context.get('active_id', False)
tracking_lot = context.get('tracking_lot', False)
if tracking_lot:
@ -218,5 +222,6 @@ class stock_partial_move(osv.osv_memory):
return {}
stock_partial_move()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -29,10 +29,9 @@ class stock_partial_picking(osv.osv_memory):
_name = "stock.partial.picking"
_description = "Partial Picking"
_columns = {
'date': fields.datetime('Date', required=True),
'partner_id': fields.many2one('res.partner',string="Partner", required=True),
'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered", required=True),
'date': fields.datetime('Date', required=True),
'partner_id': fields.many2one('res.partner',string="Partner", required=True),
'address_id': fields.many2one('res.partner.address', 'Delivery Address', help="Address where goods are to be delivered", required=True),
}
def view_init(self, cr, uid, fields_list, context=None):
@ -141,17 +140,13 @@ class stock_partial_picking(osv.osv_memory):
return result
def default_get(self, cr, uid, fields, context=None):
"""
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.
""" 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 = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
@ -191,7 +186,15 @@ class stock_partial_picking(osv.osv_memory):
res['move%s_product_currency'%(m.id)] = currency
return res
def do_partial(self, cr, uid, ids, context):
def do_partial(self, cr, uid, ids, context):
""" Makes partial moves and pickings done.
@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.
"""
pick_obj = self.pool.get('stock.picking')
picking_ids = context.get('active_ids', False)
partial = self.browse(cr, uid, ids[0], context)

View File

@ -38,20 +38,17 @@ class stock_replacement(osv.osv_memory):
return {}
def replace_composant(self, cr, uid, ids, context = {}):
"""
to open a new wizard that acknowledge, a replacement task
@return: it returns the replacement acknowledgement form
""" To open a new wizard that acknowledge, a replacement task
@return: It returns the replacement acknowledgement form
"""
return {
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.replacement.result',
'type': 'ir.actions.act_window',
'target':'new',
}
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.replacement.result',
'type': 'ir.actions.act_window',
'target':'new',
}
stock_replacement()

View File

@ -26,8 +26,7 @@ class stock_split_move_line(osv.osv_memory):
_description = "Split Moves"
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
""" 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
@ -44,8 +43,7 @@ class stock_split_move_line(osv.osv_memory):
return res
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
""" Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@ -67,8 +65,7 @@ class stock_split_move_line(osv.osv_memory):
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
""" Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@ -94,8 +91,7 @@ class stock_split_move_line(osv.osv_memory):
return res
def split_lines(self, cr, uid, ids, context):
"""
Splits moves in quantity given in the wizard.
""" Splits moves in quantity given in the wizard.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in

View File

@ -34,18 +34,15 @@ class action_traceability(osv.osv_memory):
_description = "Action traceability "
def action_traceability(self, cr, uid, ids, context={}):
"""
It traces the information of a product
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of IDs selected
@param context: A standard dictionary
@return: A dictionary of values
""" It traces the information of a product
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of IDs selected
@param context: A standard dictionary
@return: A dictionary of values
"""
type1 = context['type'] or 'move_history_ids'
field = context['field'] or 'tracking_id'
obj = self.pool.get('stock.move')

View File

@ -31,25 +31,25 @@ class stock_ups(osv.osv_memory):
_description = "Stock ups"
def ups_save(self, cr, uid, ids, context = {}):
return {
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.ups.final',
'type': 'ir.actions.act_window',
'target':'new',
}
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.ups.final',
'type': 'ir.actions.act_window',
'target':'new',
}
def ups_upload(self, cr, uid, ids, context = {}):
return {
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.ups.upload',
'type': 'ir.actions.act_window',
'target':'new',
}
'name': False,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.ups.upload',
'type': 'ir.actions.act_window',
'target':'new',
}
_columns = {
'weight': fields.float('Lot weight', required=True),
}
@ -64,6 +64,9 @@ class stock_ups_final(osv.osv_memory):
_description = "Stock ups final"
def create_xmlfile(self, cr, uid, ids, context = {}):
""" Creates xml report file.
@return: xml file
"""
report = netsvc._group['report']['report.stock.move.lot.ups_xml']
data['report_type'] = 'raw'
return {'xmlfile' : report.create(uid, context['active_id'], ids, {})}
@ -79,6 +82,9 @@ class stock_ups_upload(osv.osv_memory):
_description = "Stock ups upload"
def upload_xmlfile(self, cr, uid, ids, context = {}):
""" Uploads xml report file.
@return:
"""
report = netsvc._group['report']['report.stock.move.lot.ups_xml']
data['report_type'] = 'raw'
#FIXME: this seems unfinished