[IMP]: stock,sale:docstrings added in the osv_memory files
bzr revid: mso@mso-20100312134255-b8h0bg1gjah1s2e1
This commit is contained in:
parent
c95150b75a
commit
c6be2d42a3
|
@ -38,7 +38,7 @@ class product_margin(osv.osv_memory):
|
|||
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: the account ID or list of IDs if we want more than one
|
||||
@param ids: the ID or list of IDs if we want more than one
|
||||
|
||||
@return:
|
||||
"""
|
||||
|
@ -73,7 +73,7 @@ class product_margin(osv.osv_memory):
|
|||
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: the account ID or list of IDs if we want more than one
|
||||
@param ids: the ID or list of IDs if we want more than one
|
||||
|
||||
@return:
|
||||
"""
|
||||
|
|
|
@ -37,11 +37,33 @@ class sale_order_line_make_invoice(osv.osv_memory):
|
|||
}
|
||||
|
||||
def make_invoices(self, cr, uid, ids, context):
|
||||
"""
|
||||
@summary: To make invoices.
|
||||
|
||||
@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: A dictionary which of fields with values.
|
||||
|
||||
"""
|
||||
|
||||
res = False
|
||||
invoices = {}
|
||||
|
||||
#TODO: merge with sale.py/make_invoice
|
||||
def make_invoice(order, lines):
|
||||
"""
|
||||
@summary: To make invoices.
|
||||
|
||||
@param order:
|
||||
@param lines:
|
||||
|
||||
@return:
|
||||
|
||||
"""
|
||||
a = order.partner_id.property_account_receivable.id
|
||||
if order.partner_id and order.partner_id.property_payment_term.id:
|
||||
pay_term = order.partner_id.property_payment_term.id
|
||||
|
|
|
@ -39,6 +39,18 @@ class sale_advance_payment_inv(osv.osv_memory):
|
|||
'qtty' : lambda *a: 1
|
||||
}
|
||||
def create_invoices(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
@summary: To create invoices.
|
||||
|
||||
@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:
|
||||
|
||||
"""
|
||||
list_inv = []
|
||||
obj_sale = self.pool.get('sale.order')
|
||||
obj_lines = self.pool.get('account.invoice.line')
|
||||
|
@ -130,6 +142,18 @@ class sale_open_invoice(osv.osv_memory):
|
|||
}
|
||||
|
||||
def open_invoice(self, cr, uid, ids, context):
|
||||
"""
|
||||
@summary: To open 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:
|
||||
|
||||
"""
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
invoices = []
|
||||
#TODO: Can not get invoice ids here
|
||||
|
|
|
@ -1713,8 +1713,12 @@ class stock_inventory_line(osv.osv):
|
|||
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
|
||||
'product_qty': fields.float('Quantity'),
|
||||
'company_id': fields.related('inventory_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
|
||||
'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]")
|
||||
'prod_lot_id': fields.many2one('stock.production.lot', 'Production Lot', domain="[('product_id','=',product_id)]"),
|
||||
# 'state': fields.selection( (('draft', 'Draft'), ('done', 'Done'), ('cancel','Cancelled')), 'State', readonly=True),
|
||||
}
|
||||
# _defaults = {
|
||||
# 'state': lambda *a: 'draft',
|
||||
# }
|
||||
def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False):
|
||||
if not product:
|
||||
return {}
|
||||
|
|
|
@ -18,7 +18,11 @@
|
|||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
<field name="prod_lot_id"/>
|
||||
<button name="%(stock.action_view_stock_inventory_line_split)d"
|
||||
string="Split inventory lines"
|
||||
type="action" icon="gtk-justify-fill"/>
|
||||
<field name="location_id"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -87,6 +91,9 @@
|
|||
<field name="product_uom"/>
|
||||
<field name="prod_lot_id"/>
|
||||
<field colspan="4" domain="[('usage','=','internal')]" name="location_id" select="1"/>
|
||||
<button name="%(stock.action_view_stock_inventory_line_split)d"
|
||||
string="Split inventory lines"
|
||||
type="action" icon="gtk-justify-fill" states="draft"/>
|
||||
</tree>
|
||||
<form string="Inventory Lines">
|
||||
<field colspan="4" context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" select="1" domain="[('type','<>','service')]"/>
|
||||
|
|
|
@ -38,6 +38,18 @@ class stock_fill_inventory(osv.osv_memory):
|
|||
}
|
||||
|
||||
def fill_inventory(self, cr, uid, ids, context):
|
||||
"""
|
||||
@summary: 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')
|
||||
product_obj = self.pool.get('product.product')
|
||||
|
|
|
@ -37,6 +37,17 @@ class stock_inventory_line_split(osv.osv_memory):
|
|||
}
|
||||
|
||||
def _check_production_lot(self, cr, uid, context):
|
||||
"""
|
||||
@summary: 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 context: A standard dictionary
|
||||
|
||||
@return:
|
||||
|
||||
"""
|
||||
stock_inventory_line_obj = self.pool.get('stock.inventory.line')
|
||||
for inv_obj in stock_inventory_line_obj.browse(cr, uid, \
|
||||
context['active_ids']):
|
||||
|
@ -51,6 +62,18 @@ inventory lines, make sure the production lot is assigned to this product.'))
|
|||
}
|
||||
|
||||
def split_lines(self, cr, uid, ids, context):
|
||||
"""
|
||||
@summary: 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 context: A standard dictionary
|
||||
|
||||
@return:
|
||||
|
||||
"""
|
||||
inv_id = context['active_id']
|
||||
inv_line_obj = self.pool.get('stock.inventory.line')
|
||||
prodlot_obj = self.pool.get('stock.production.lot')
|
||||
|
|
|
@ -29,14 +29,26 @@ import time
|
|||
import wizard
|
||||
|
||||
|
||||
class inventory_merge_stock_zero(osv.osv_memory):
|
||||
_name = "stock.inventory.merge.stock.zero"
|
||||
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):
|
||||
"""
|
||||
@summary: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')
|
||||
prod_obj = pooler.get_pool(cr.dbname).get('product.product')
|
||||
|
@ -67,6 +79,6 @@ class inventory_merge_stock_zero(osv.osv_memory):
|
|||
})
|
||||
return {}
|
||||
|
||||
inventory_merge_stock_zero()
|
||||
inventory_set_stock_zero()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_inventory_merge_stock_zero" model="ir.ui.view">
|
||||
<record id="view_inventory_set_stock_zero" model="ir.ui.view">
|
||||
<field name="name">Set Stock to Zero</field>
|
||||
<field name="model">stock.inventory.merge.stock.zero</field>
|
||||
<field name="model">stock.inventory.set.stock.zero</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Set Stock to Zero">
|
||||
|
@ -20,12 +20,12 @@
|
|||
</record>
|
||||
|
||||
<act_window name="Set Stock to Zero"
|
||||
res_model="stock.inventory.merge.stock.zero"
|
||||
res_model="stock.inventory.set.stock.zero"
|
||||
src_model="stock.inventory"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_inventory_merge_stock_zero"/>
|
||||
id="action_view_inventory_set_stock_zero"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -42,6 +42,18 @@ class stock_invoice_onshipping(osv.osv_memory):
|
|||
}
|
||||
|
||||
def _get_type(self, cr, uid, context):
|
||||
"""
|
||||
@summary: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
|
||||
|
||||
"""
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
usage = 'customer'
|
||||
pick = picking_obj.browse(cr, uid, context['active_id'])
|
||||
|
@ -69,6 +81,18 @@ class stock_invoice_onshipping(osv.osv_memory):
|
|||
}
|
||||
|
||||
def create_invoice(self, cr, uid, ids, context):
|
||||
"""
|
||||
@summary: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')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
|
|
@ -37,6 +37,18 @@ class stock_location_product(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context):
|
||||
"""
|
||||
@summary: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 context: A standard dictionary
|
||||
|
||||
@return: invoice type
|
||||
|
||||
"""
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']):
|
||||
result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view')
|
||||
|
|
|
@ -36,6 +36,18 @@ class stock_move_track(osv.osv_memory):
|
|||
}
|
||||
|
||||
def track_lines(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
@summary: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:
|
||||
|
||||
"""
|
||||
datas = self.read(cr, uid, ids)[0]
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_obj._track_lines(cr, uid, context['active_id'], datas, context=context)
|
||||
|
@ -55,18 +67,63 @@ class stock_move_consume(osv.osv_memory):
|
|||
}
|
||||
|
||||
def _get_product_id(self, cr, uid, context):
|
||||
"""
|
||||
@summary:To get product id
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: product id
|
||||
|
||||
"""
|
||||
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
|
||||
return move.product_id.id
|
||||
|
||||
def _get_product_qty(self, cr, uid, context):
|
||||
"""
|
||||
@summary:To get product quantity
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: quantity
|
||||
|
||||
"""
|
||||
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
|
||||
return move.product_qty
|
||||
|
||||
def _get_product_uom(self, cr, uid, context):
|
||||
"""
|
||||
@summary:To get Unit of measure
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: uom
|
||||
|
||||
"""
|
||||
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
|
||||
return move.product_uom.id
|
||||
|
||||
def _get_location_id(self, cr, uid, context):
|
||||
"""
|
||||
@summary:To get location id
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: location id
|
||||
|
||||
"""
|
||||
|
||||
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
|
||||
return move.location_id.id
|
||||
|
||||
|
@ -78,6 +135,18 @@ class stock_move_consume(osv.osv_memory):
|
|||
}
|
||||
|
||||
def do_move_consume(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
@summary: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']
|
||||
for data in self.read(cr, uid, ids):
|
||||
|
@ -99,6 +168,18 @@ class stock_move_scrap(osv.osv_memory):
|
|||
}
|
||||
|
||||
def move_scrap(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
@summary: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']
|
||||
for data in self.read(cr, uid, ids):
|
||||
|
@ -128,10 +209,35 @@ class split_in_production_lot(osv.osv_memory):
|
|||
}
|
||||
|
||||
def split_lot(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
@summary: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:
|
||||
|
||||
"""
|
||||
self.split(cr, uid, ids, context.get('active_ids'), context=context)
|
||||
return {}
|
||||
|
||||
def split(self, cr, uid, ids, move_ids, context=None):
|
||||
"""
|
||||
@summary: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')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
|
|
Loading…
Reference in New Issue