[IMP] delivery,stock,mrp: minor cleanup/spellchecking/nit-picking while reviewing
bzr revid: odo@openerp.com-20140507165951-th4iqsrp6l67dvve
This commit is contained in:
parent
3fcc60c689
commit
083108a624
|
@ -101,7 +101,7 @@
|
||||||
UPS Express, UPS Standard) with a set of pricing rules attached
|
UPS Express, UPS Standard) with a set of pricing rules attached
|
||||||
to each method.
|
to each method.
|
||||||
</p><p>
|
</p><p>
|
||||||
These methods allows to automaticaly compute the delivery price
|
These methods allow to automatically compute the delivery price
|
||||||
according to your settings; on the sales order (based on the
|
according to your settings; on the sales order (based on the
|
||||||
quotation) or the invoice (based on the delivery orders).
|
quotation) or the invoice (based on the delivery orders).
|
||||||
</p>
|
</p>
|
||||||
|
@ -224,7 +224,7 @@
|
||||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//page[@string='Additional Info']/group[last()]" position="after">
|
<xpath expr="//page[@string='Additional Info']/group[last()]" position="after">
|
||||||
<separator string="Carrier Informations"/>
|
<separator string="Carrier Information"/>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="carrier_id"/>
|
<field name="carrier_id"/>
|
||||||
|
|
|
@ -67,7 +67,7 @@ class stock_picking(osv.osv):
|
||||||
'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
|
'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
|
||||||
'number_of_packages': fields.integer('Number of Packages'),
|
'number_of_packages': fields.integer('Number of Packages'),
|
||||||
'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of measurement for Weight",),
|
'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of measurement for Weight",),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _prepare_shipping_invoice_line(self, cr, uid, picking, invoice, context=None):
|
def _prepare_shipping_invoice_line(self, cr, uid, picking, invoice, context=None):
|
||||||
"""Prepare the invoice line to add to the shipping costs to the shipping's
|
"""Prepare the invoice line to add to the shipping costs to the shipping's
|
||||||
|
@ -119,8 +119,6 @@ class stock_picking(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None):
|
def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None):
|
||||||
''' This function simply creates the invoice from the given values. It is overriden in delivery module to add the delivery costs. picking is a browse_record
|
|
||||||
'''
|
|
||||||
invoice_line_obj = self.pool.get('account.invoice.line')
|
invoice_line_obj = self.pool.get('account.invoice.line')
|
||||||
invoice_id = super(stock_picking, self)._create_invoice_from_picking(cr, uid, picking, vals, context=context)
|
invoice_id = super(stock_picking, self)._create_invoice_from_picking(cr, uid, picking, vals, context=context)
|
||||||
invoice = self.browse(cr, uid, invoice_id, context=context)
|
invoice = self.browse(cr, uid, invoice_id, context=context)
|
||||||
|
@ -129,11 +127,12 @@ class stock_picking(osv.osv):
|
||||||
invoice_line_obj.create(cr, uid, invoice_line)
|
invoice_line_obj.create(cr, uid, invoice_line)
|
||||||
return invoice_id
|
return invoice_id
|
||||||
|
|
||||||
def _get_default_uom(self, cr, uid, c):
|
def _get_default_uom(self, cr, uid, context=None):
|
||||||
uom_categ, uom_categ_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'product_uom_categ_kgm')
|
uom_categ_id = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'product.product_uom_categ_kgm')
|
||||||
return self.pool.get('product.uom').search(cr, uid, [('category_id', '=', uom_categ_id), ('factor', '=', 1)])[0]
|
return self.pool.get('product.uom').search(cr, uid, [('category_id', '=', uom_categ_id), ('factor', '=', 1)])[0]
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'weight_uom_id': lambda self, cr, uid, c: self._get_default_uom(cr, uid, c)
|
'weight_uom_id': lambda self, cr, uid, c: self._get_default_uom(cr, uid, c),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,11 +172,13 @@ class stock_move(osv.osv):
|
||||||
}),
|
}),
|
||||||
'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of Measure (Unit of Measure) is the unit of measurement for Weight",),
|
'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of Measure (Unit of Measure) is the unit of measurement for Weight",),
|
||||||
}
|
}
|
||||||
def _get_default_uom(self,cr,uid,c):
|
|
||||||
uom_categ, uom_categ_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'product_uom_categ_kgm')
|
def _get_default_uom(self, cr, uid, context=None):
|
||||||
|
uom_categ_id = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'product.product_uom_categ_kgm')
|
||||||
return self.pool.get('product.uom').search(cr, uid, [('category_id', '=', uom_categ_id),('factor','=',1)])[0]
|
return self.pool.get('product.uom').search(cr, uid, [('category_id', '=', uom_categ_id),('factor','=',1)])[0]
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'weight_uom_id': lambda self,cr,uid,c: self._get_default_uom(cr,uid,c)
|
'weight_uom_id': lambda self, cr, uid, c: self._get_default_uom(cr, uid, c),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,13 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
from openerp.osv import fields
|
from openerp.osv import fields
|
||||||
from openerp.osv import osv
|
from openerp.osv import osv
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp import SUPERUSER_ID
|
from openerp import SUPERUSER_ID
|
||||||
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
||||||
import time
|
|
||||||
|
|
||||||
class StockMove(osv.osv):
|
class StockMove(osv.osv):
|
||||||
_inherit = 'stock.move'
|
_inherit = 'stock.move'
|
||||||
|
@ -69,8 +70,6 @@ class StockMove(osv.osv):
|
||||||
"""
|
"""
|
||||||
bom_obj = self.pool.get('mrp.bom')
|
bom_obj = self.pool.get('mrp.bom')
|
||||||
move_obj = self.pool.get('stock.move')
|
move_obj = self.pool.get('stock.move')
|
||||||
procurement_obj = self.pool.get('procurement.order')
|
|
||||||
product_obj = self.pool.get('product.product')
|
|
||||||
to_explode_again_ids = []
|
to_explode_again_ids = []
|
||||||
processed_ids = []
|
processed_ids = []
|
||||||
bis = self._check_phantom_bom(cr, uid, move, context=context)
|
bis = self._check_phantom_bom(cr, uid, move, context=context)
|
||||||
|
@ -140,9 +139,9 @@ class StockMove(osv.osv):
|
||||||
ids2 = []
|
ids2 = []
|
||||||
for move in self.browse(cr, uid, ids, context=context):
|
for move in self.browse(cr, uid, ids, context=context):
|
||||||
if move.state == 'draft':
|
if move.state == 'draft':
|
||||||
ids2.extend(self.action_confirm(cr, uid, [move.id], context=context))
|
ids2.extend(self.action_confirm(cr, uid, [move.id], context=context))
|
||||||
else:
|
else:
|
||||||
ids2.append(move.id)
|
ids2.append(move.id)
|
||||||
|
|
||||||
for move in self.browse(cr, uid, ids2, context=context):
|
for move in self.browse(cr, uid, ids2, context=context):
|
||||||
move_qty = move.product_qty
|
move_qty = move.product_qty
|
||||||
|
|
|
@ -33,9 +33,9 @@ class TestMrpMulticompany(common.TransactionCase):
|
||||||
self.res_users = self.registry('res.users')
|
self.res_users = self.registry('res.users')
|
||||||
self.stock_location = self.registry('stock.location')
|
self.stock_location = self.registry('stock.location')
|
||||||
|
|
||||||
model, group_user_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'base', 'group_user')
|
group_user_id = self.registry('ir.model.data').xmlid_to_res_id(cr, uid, 'base.group_user')
|
||||||
model, group_stock_manager_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'group_stock_manager')
|
group_stock_manager_id = self.registry('ir.model.data').xmlid_to_res_id(cr, uid, 'stock.group_stock_manager')
|
||||||
model, company_2_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'res_company_1')
|
company_2_id = self.registry('ir.model.data').xmlid_to_res_id(cr, uid, 'stock.res_company_1')
|
||||||
self.multicompany_user_id = self.res_users.create(cr, uid,
|
self.multicompany_user_id = self.res_users.create(cr, uid,
|
||||||
{'name': 'multicomp', 'login': 'multicomp',
|
{'name': 'multicomp', 'login': 'multicomp',
|
||||||
'groups_id': [(6, 0, [group_user_id, group_stock_manager_id])],
|
'groups_id': [(6, 0, [group_user_id, group_stock_manager_id])],
|
||||||
|
@ -47,7 +47,7 @@ class TestMrpMulticompany(common.TransactionCase):
|
||||||
cr, uid, context = self.cr, self.multicompany_user_id, {}
|
cr, uid, context = self.cr, self.multicompany_user_id, {}
|
||||||
fields = ['location_src_id', 'location_dest_id']
|
fields = ['location_src_id', 'location_dest_id']
|
||||||
defaults = self.stock_location.default_get(cr, uid, ['location_id', 'location_dest_id', 'type'], context)
|
defaults = self.stock_location.default_get(cr, uid, ['location_id', 'location_dest_id', 'type'], context)
|
||||||
for field in fields:
|
for field in fields:
|
||||||
if defaults.get(field):
|
if defaults.get(field):
|
||||||
try:
|
try:
|
||||||
self.stock_location.check_access_rule(cr, uid, [defaults[field]], 'read', context)
|
self.stock_location.check_access_rule(cr, uid, [defaults[field]], 'read', context)
|
||||||
|
|
|
@ -28,12 +28,12 @@ class mrp_product_produce_line(osv.osv_memory):
|
||||||
_description = "Product Produce Consume lines"
|
_description = "Product Produce Consume lines"
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'product_id': fields.many2one('product.product', 'Product'),
|
'product_id': fields.many2one('product.product', 'Product'),
|
||||||
'product_qty': fields.float('Quantity (in default UoM)'),
|
'product_qty': fields.float('Quantity (in default UoM)'),
|
||||||
'lot_id': fields.many2one('stock.production.lot', 'Lot'),
|
'lot_id': fields.many2one('stock.production.lot', 'Lot'),
|
||||||
'produce_id': fields.many2one('mrp.product.produce'),
|
'produce_id': fields.many2one('mrp.product.produce'),
|
||||||
'track_production': fields.related('product_id', 'track_production', type='boolean')
|
'track_production': fields.related('product_id', 'track_production', type='boolean'),
|
||||||
}
|
}
|
||||||
|
|
||||||
class mrp_product_produce(osv.osv_memory):
|
class mrp_product_produce(osv.osv_memory):
|
||||||
_name = "mrp.product.produce"
|
_name = "mrp.product.produce"
|
||||||
|
|
|
@ -37,14 +37,6 @@ class stock_move_consume(osv.osv_memory):
|
||||||
|
|
||||||
#TOFIX: product_uom should not have different category of default UOM of product. Qty should be convert into UOM of original move line before going in consume and scrap
|
#TOFIX: product_uom should not have different category of default UOM of product. Qty should be convert into UOM of original move line before going in consume and scrap
|
||||||
def default_get(self, cr, uid, fields, context=None):
|
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
|
|
||||||
"""
|
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
|
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
|
||||||
|
@ -62,14 +54,6 @@ class stock_move_consume(osv.osv_memory):
|
||||||
|
|
||||||
|
|
||||||
def do_move_consume(self, cr, uid, ids, context=None):
|
def do_move_consume(self, cr, uid, ids, context=None):
|
||||||
""" 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:
|
|
||||||
"""
|
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
move_obj = self.pool.get('stock.move')
|
move_obj = self.pool.get('stock.move')
|
||||||
|
@ -80,5 +64,3 @@ class stock_move_consume(osv.osv_memory):
|
||||||
context=context)
|
context=context)
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4098,20 +4098,17 @@ class stock_picking_type(osv.osv):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
obj_data = self.pool.get('ir.model.data')
|
obj_data = self.pool.get('ir.model.data')
|
||||||
stock_loc = obj_data.get_object_reference(cr, uid, 'stock','stock_location_stock')[1]
|
stock_loc = obj_data.xmlid_to_res_id(cr, uid, 'stock.stock_location_stock')
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'default_location_src_id': stock_loc,
|
'default_location_src_id': stock_loc,
|
||||||
'default_location_dest_id': stock_loc,
|
'default_location_dest_id': stock_loc,
|
||||||
}
|
}
|
||||||
if picking_code == 'incoming':
|
if picking_code == 'incoming':
|
||||||
result['default_location_src_id'] = obj_data.get_object_reference(cr, uid, 'stock','stock_location_suppliers')[1]
|
result['default_location_src_id'] = obj_data.xmlid_to_res_id(cr, uid, 'stock.stock_location_suppliers')
|
||||||
return {'value': result}
|
elif picking_code == 'outgoing':
|
||||||
if picking_code == 'outgoing':
|
result['default_location_dest_id'] = obj_data.xmlid_to_res_id(cr, uid, 'stock.stock_location_customers')
|
||||||
result['default_location_dest_id'] = obj_data.get_object_reference(cr, uid, 'stock','stock_location_customers')[1]
|
return {'value': result}
|
||||||
return {'value': result}
|
|
||||||
else:
|
|
||||||
return {'value': result}
|
|
||||||
|
|
||||||
def _get_name(self, cr, uid, ids, field_names, arg, context=None):
|
def _get_name(self, cr, uid, ids, field_names, arg, context=None):
|
||||||
return dict(self.name_get(cr, uid, ids, context=context))
|
return dict(self.name_get(cr, uid, ids, context=context))
|
||||||
|
|
Loading…
Reference in New Issue