Skip to content

Commit 083108a

Browse files
committed
[IMP] delivery,stock,mrp: minor cleanup/spellchecking/nit-picking while reviewing
bzr revid: [email protected]
1 parent 3fcc60c commit 083108a

File tree

7 files changed

+31
-52
lines changed

7 files changed

+31
-52
lines changed

addons/delivery/delivery_view.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
UPS Express, UPS Standard) with a set of pricing rules attached
102102
to each method.
103103
</p><p>
104-
These methods allows to automaticaly compute the delivery price
104+
These methods allow to automatically compute the delivery price
105105
according to your settings; on the sales order (based on the
106106
quotation) or the invoice (based on the delivery orders).
107107
</p>
@@ -224,7 +224,7 @@
224224
<field name="inherit_id" ref="stock.view_picking_form"/>
225225
<field name="arch" type="xml">
226226
<xpath expr="//page[@string='Additional Info']/group[last()]" position="after">
227-
<separator string="Carrier Informations"/>
227+
<separator string="Carrier Information"/>
228228
<group>
229229
<group>
230230
<field name="carrier_id"/>

addons/delivery/stock.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _get_picking_line(self, cr, uid, ids, context=None):
6767
'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
6868
'number_of_packages': fields.integer('Number of Packages'),
6969
'weight_uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True,readonly="1",help="Unit of measurement for Weight",),
70-
}
70+
}
7171

7272
def _prepare_shipping_invoice_line(self, cr, uid, picking, invoice, context=None):
7373
"""Prepare the invoice line to add to the shipping costs to the shipping's
@@ -119,8 +119,6 @@ def _prepare_shipping_invoice_line(self, cr, uid, picking, invoice, context=None
119119
}
120120

121121
def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None):
122-
''' 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
123-
'''
124122
invoice_line_obj = self.pool.get('account.invoice.line')
125123
invoice_id = super(stock_picking, self)._create_invoice_from_picking(cr, uid, picking, vals, context=context)
126124
invoice = self.browse(cr, uid, invoice_id, context=context)
@@ -129,11 +127,12 @@ def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None):
129127
invoice_line_obj.create(cr, uid, invoice_line)
130128
return invoice_id
131129

132-
def _get_default_uom(self, cr, uid, c):
133-
uom_categ, uom_categ_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'product_uom_categ_kgm')
130+
def _get_default_uom(self, cr, uid, context=None):
131+
uom_categ_id = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'product.product_uom_categ_kgm')
134132
return self.pool.get('product.uom').search(cr, uid, [('category_id', '=', uom_categ_id), ('factor', '=', 1)])[0]
133+
135134
_defaults = {
136-
'weight_uom_id': lambda self, cr, uid, c: self._get_default_uom(cr, uid, c)
135+
'weight_uom_id': lambda self, cr, uid, c: self._get_default_uom(cr, uid, c),
137136
}
138137

139138

@@ -173,11 +172,13 @@ def _cal_move_weight(self, cr, uid, ids, name, args, context=None):
173172
}),
174173
'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",),
175174
}
176-
def _get_default_uom(self,cr,uid,c):
177-
uom_categ, uom_categ_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'product_uom_categ_kgm')
175+
176+
def _get_default_uom(self, cr, uid, context=None):
177+
uom_categ_id = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'product.product_uom_categ_kgm')
178178
return self.pool.get('product.uom').search(cr, uid, [('category_id', '=', uom_categ_id),('factor','=',1)])[0]
179+
179180
_defaults = {
180-
'weight_uom_id': lambda self,cr,uid,c: self._get_default_uom(cr,uid,c)
181+
'weight_uom_id': lambda self, cr, uid, c: self._get_default_uom(cr, uid, c),
181182
}
182183

183184

addons/mrp/stock.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
#
2020
##############################################################################
2121

22+
import time
23+
2224
from openerp.osv import fields
2325
from openerp.osv import osv
2426
from openerp.tools.translate import _
2527
from openerp import SUPERUSER_ID
2628
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
27-
import time
2829

2930
class StockMove(osv.osv):
3031
_inherit = 'stock.move'
@@ -69,8 +70,6 @@ def _action_explode(self, cr, uid, move, context=None):
6970
"""
7071
bom_obj = self.pool.get('mrp.bom')
7172
move_obj = self.pool.get('stock.move')
72-
procurement_obj = self.pool.get('procurement.order')
73-
product_obj = self.pool.get('product.product')
7473
to_explode_again_ids = []
7574
processed_ids = []
7675
bis = self._check_phantom_bom(cr, uid, move, context=context)
@@ -140,9 +139,9 @@ def action_consume(self, cr, uid, ids, product_qty, location_id=False, restrict_
140139
ids2 = []
141140
for move in self.browse(cr, uid, ids, context=context):
142141
if move.state == 'draft':
143-
ids2.extend(self.action_confirm(cr, uid, [move.id], context=context))
142+
ids2.extend(self.action_confirm(cr, uid, [move.id], context=context))
144143
else:
145-
ids2.append(move.id)
144+
ids2.append(move.id)
146145

147146
for move in self.browse(cr, uid, ids2, context=context):
148147
move_qty = move.product_qty

addons/mrp/tests/test_multicompany.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def setUp(self):
3333
self.res_users = self.registry('res.users')
3434
self.stock_location = self.registry('stock.location')
3535

36-
model, group_user_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'base', 'group_user')
37-
model, group_stock_manager_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'group_stock_manager')
38-
model, company_2_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'res_company_1')
36+
group_user_id = self.registry('ir.model.data').xmlid_to_res_id(cr, uid, 'base.group_user')
37+
group_stock_manager_id = self.registry('ir.model.data').xmlid_to_res_id(cr, uid, 'stock.group_stock_manager')
38+
company_2_id = self.registry('ir.model.data').xmlid_to_res_id(cr, uid, 'stock.res_company_1')
3939
self.multicompany_user_id = self.res_users.create(cr, uid,
4040
{'name': 'multicomp', 'login': 'multicomp',
4141
'groups_id': [(6, 0, [group_user_id, group_stock_manager_id])],
@@ -47,7 +47,7 @@ def test_00_multicompany_user(self):
4747
cr, uid, context = self.cr, self.multicompany_user_id, {}
4848
fields = ['location_src_id', 'location_dest_id']
4949
defaults = self.stock_location.default_get(cr, uid, ['location_id', 'location_dest_id', 'type'], context)
50-
for field in fields:
50+
for field in fields:
5151
if defaults.get(field):
5252
try:
5353
self.stock_location.check_access_rule(cr, uid, [defaults[field]], 'read', context)

addons/mrp/wizard/mrp_product_produce.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class mrp_product_produce_line(osv.osv_memory):
2828
_description = "Product Produce Consume lines"
2929

3030
_columns = {
31-
'product_id': fields.many2one('product.product', 'Product'),
32-
'product_qty': fields.float('Quantity (in default UoM)'),
33-
'lot_id': fields.many2one('stock.production.lot', 'Lot'),
34-
'produce_id': fields.many2one('mrp.product.produce'),
35-
'track_production': fields.related('product_id', 'track_production', type='boolean')
36-
}
31+
'product_id': fields.many2one('product.product', 'Product'),
32+
'product_qty': fields.float('Quantity (in default UoM)'),
33+
'lot_id': fields.many2one('stock.production.lot', 'Lot'),
34+
'produce_id': fields.many2one('mrp.product.produce'),
35+
'track_production': fields.related('product_id', 'track_production', type='boolean'),
36+
}
3737

3838
class mrp_product_produce(osv.osv_memory):
3939
_name = "mrp.product.produce"

addons/mrp/wizard/stock_move.py

-18
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ class stock_move_consume(osv.osv_memory):
3737

3838
#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
3939
def default_get(self, cr, uid, fields, context=None):
40-
""" Get default values
41-
@param self: The object pointer.
42-
@param cr: A database cursor
43-
@param uid: ID of the user currently logged in
44-
@param fields: List of fields for default value
45-
@param context: A standard dictionary
46-
@return: default values of fields
47-
"""
4840
if context is None:
4941
context = {}
5042
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
@@ -62,14 +54,6 @@ def default_get(self, cr, uid, fields, context=None):
6254

6355

6456
def do_move_consume(self, cr, uid, ids, context=None):
65-
""" To move consumed products
66-
@param self: The object pointer.
67-
@param cr: A database cursor
68-
@param uid: ID of the user currently logged in
69-
@param ids: the ID or list of IDs if we want more than one
70-
@param context: A standard dictionary
71-
@return:
72-
"""
7357
if context is None:
7458
context = {}
7559
move_obj = self.pool.get('stock.move')
@@ -80,5 +64,3 @@ def do_move_consume(self, cr, uid, ids, context=None):
8064
context=context)
8165
return {'type': 'ir.actions.act_window_close'}
8266

83-
84-

addons/stock/stock.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -4098,20 +4098,17 @@ def onchange_picking_code(self, cr, uid, ids, picking_code=False):
40984098
return False
40994099

41004100
obj_data = self.pool.get('ir.model.data')
4101-
stock_loc = obj_data.get_object_reference(cr, uid, 'stock','stock_location_stock')[1]
4101+
stock_loc = obj_data.xmlid_to_res_id(cr, uid, 'stock.stock_location_stock')
41024102

41034103
result = {
41044104
'default_location_src_id': stock_loc,
41054105
'default_location_dest_id': stock_loc,
41064106
}
41074107
if picking_code == 'incoming':
4108-
result['default_location_src_id'] = obj_data.get_object_reference(cr, uid, 'stock','stock_location_suppliers')[1]
4109-
return {'value': result}
4110-
if picking_code == 'outgoing':
4111-
result['default_location_dest_id'] = obj_data.get_object_reference(cr, uid, 'stock','stock_location_customers')[1]
4112-
return {'value': result}
4113-
else:
4114-
return {'value': result}
4108+
result['default_location_src_id'] = obj_data.xmlid_to_res_id(cr, uid, 'stock.stock_location_suppliers')
4109+
elif picking_code == 'outgoing':
4110+
result['default_location_dest_id'] = obj_data.xmlid_to_res_id(cr, uid, 'stock.stock_location_customers')
4111+
return {'value': result}
41154112

41164113
def _get_name(self, cr, uid, ids, field_names, arg, context=None):
41174114
return dict(self.name_get(cr, uid, ids, context=context))

0 commit comments

Comments
 (0)