[REVERT]: Reverted some changes of trunk-dev-addons2
bzr revid: rpa@tinyerp.com-20110228112535-8qedlwhmgmsvh6ho
This commit is contained in:
+2
-20
@@ -240,29 +240,11 @@ class mrp_bom(osv.osv):
|
||||
return False
|
||||
level -= 1
|
||||
return True
|
||||
|
||||
def _check_product(self, cr, uid, ids, context=None):
|
||||
all_prod = []
|
||||
bom_obj = self.pool.get('mrp.bom')
|
||||
boms = self.browse(cr, uid, ids, context=context)
|
||||
def check_bom(boms):
|
||||
res = True
|
||||
for bom in boms:
|
||||
if bom.product_id.id in all_prod:
|
||||
res = res and False
|
||||
all_prod.append(bom.product_id.id)
|
||||
lines = bom.bom_lines
|
||||
if lines:
|
||||
newboms = [a for a in lines if a not in boms]
|
||||
res = res and check_bom(newboms)
|
||||
return res
|
||||
return check_bom(boms)
|
||||
|
||||
_constraints = [
|
||||
(_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id']),
|
||||
(_check_product, 'BoM line product should not be same as BoM product.', ['product_id']),
|
||||
(_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id'])
|
||||
]
|
||||
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id, name, context=None):
|
||||
""" Changes UoM and name if product_id changes.
|
||||
@param name: Name of the field
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
<field name="name">procurement.order.tree.board</field>
|
||||
<field name="model">procurement.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field eval="20" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Procurement Lines" colors="red:date_planned<current_date and state in ('exception');black:state=='running';darkgreen:state=='confirmed';gray:state in ['done','cancel'];blue:state in ('ready')">
|
||||
<field name="date_planned" widget="date"/>
|
||||
@@ -247,8 +246,8 @@
|
||||
<act_window
|
||||
context="{'search_default_warehouse_id': active_id}"
|
||||
id="act_stock_warehouse_2_stock_warehouse_orderpoint"
|
||||
name="Minimum Stock Rules"
|
||||
res_model="stock.warehouse.orderpoint"
|
||||
name="Minimum Stock Rules"
|
||||
res_model="stock.warehouse.orderpoint"
|
||||
src_model="stock.warehouse"
|
||||
groups="stock.group_stock_user"/>
|
||||
|
||||
|
||||
@@ -262,9 +262,9 @@ class product_pricelist(osv.osv):
|
||||
price = currency_obj.compute(cr, uid,
|
||||
price_type.currency_id.id, res['currency_id'],
|
||||
product_obj.price_get(cr, uid, [product_id],
|
||||
price_type.field, context=context)[product_id], round=False, context=context)
|
||||
price_type.field)[product_id], round=False, context=context)
|
||||
|
||||
if price >= 0.0:
|
||||
if price:
|
||||
price_limit = price
|
||||
|
||||
price = price * (1.0+(res['price_discount'] or 0.0))
|
||||
@@ -385,7 +385,7 @@ class product_pricelist(osv.osv):
|
||||
else:
|
||||
price_tmp = self.price_get(cr, uid,
|
||||
[res['base_pricelist_id']], prod_id,
|
||||
qty, context=context)[res['base_pricelist_id']]
|
||||
qty)[res['base_pricelist_id']]
|
||||
ptype_src = self.browse(cr, uid,
|
||||
res['base_pricelist_id']).currency_id.id
|
||||
price = currency_obj.compute(cr, uid, ptype_src,
|
||||
@@ -413,7 +413,7 @@ class product_pricelist(osv.osv):
|
||||
price = currency_obj.compute(cr, uid,
|
||||
price_type.currency_id.id, res['currency_id'],
|
||||
product_obj.price_get(cr, uid, [prod_id],
|
||||
price_type.field, context=context)[prod_id], round=False, context=context)
|
||||
price_type.field)[prod_id], round=False, context=context)
|
||||
|
||||
if price:
|
||||
price_limit = price
|
||||
|
||||
@@ -170,7 +170,7 @@ class purchase_order(osv.osv):
|
||||
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
|
||||
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True,
|
||||
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"),
|
||||
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', domain="[('partner_id', '!=', False)]",
|
||||
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',
|
||||
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
|
||||
help="Put an address if you want to deliver directly from the supplier to the customer." \
|
||||
"In this case, it will remove the warehouse link and set the customer location."
|
||||
|
||||
+12
-14
@@ -1166,7 +1166,8 @@ class stock_picking(osv.osv):
|
||||
for move in pick.move_lines:
|
||||
if move.state in ('done', 'cancel'):
|
||||
continue
|
||||
partial_data = partial_datas.get('move%s'%(move.id), {})
|
||||
partial_data = partial_datas.get('move%s'%(move.id), False)
|
||||
assert partial_data, _('Missing partial picking data for move #%s') % (move.id)
|
||||
product_qty = partial_data.get('product_qty',0.0)
|
||||
move_product_qty[move.id] = product_qty
|
||||
product_uom = partial_data.get('product_uom',False)
|
||||
@@ -1247,9 +1248,9 @@ class stock_picking(osv.osv):
|
||||
|
||||
if new_picking:
|
||||
move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking})
|
||||
for move in complete:
|
||||
if prodlot_ids.get(move.id):
|
||||
move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]})
|
||||
for move in complete:
|
||||
if prodlot_ids.get(move.id):
|
||||
move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]})
|
||||
for move in too_many:
|
||||
product_qty = move_product_qty[move.id]
|
||||
defaults = {
|
||||
@@ -1462,7 +1463,7 @@ class stock_move(osv.osv):
|
||||
_description = "Stock Move"
|
||||
_order = 'date_expected desc, id'
|
||||
_log_create = False
|
||||
|
||||
|
||||
def action_partial_move(self, cr, uid, ids, context=None):
|
||||
if context is None: context = {}
|
||||
partial_id = self.pool.get("stock.partial.move").create(
|
||||
@@ -1480,7 +1481,7 @@ class stock_move(osv.osv):
|
||||
'domain': '[]',
|
||||
'context': context
|
||||
}
|
||||
|
||||
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
res = []
|
||||
@@ -1854,6 +1855,11 @@ class stock_move(osv.osv):
|
||||
"""
|
||||
moves = self.browse(cr, uid, ids, context=context)
|
||||
self.write(cr, uid, ids, {'state': 'confirmed'})
|
||||
res_obj = self.pool.get('res.company')
|
||||
location_obj = self.pool.get('stock.location')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
||||
self.create_chained_picking(cr, uid, moves, context)
|
||||
return []
|
||||
|
||||
@@ -1880,14 +1886,6 @@ class stock_move(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state': 'confirmed'})
|
||||
|
||||
# fix for bug lp:707031
|
||||
# called write of related picking because changing move availability does
|
||||
# not trigger workflow of picking in order to change the state of picking
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for move in self.browse(cr, uid, ids, context):
|
||||
if move.picking_id:
|
||||
wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
|
||||
return True
|
||||
|
||||
#
|
||||
|
||||
@@ -115,7 +115,7 @@ class stock_invoice_onshipping(osv.osv_memory):
|
||||
if context is None:
|
||||
context = {}
|
||||
picking_pool = self.pool.get('stock.picking')
|
||||
onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'], context=context)
|
||||
onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'])
|
||||
if context.get('new_picking', False):
|
||||
onshipdata_obj['id'] = onshipdata_obj.new_picking
|
||||
onshipdata_obj[ids] = onshipdata_obj.new_picking
|
||||
@@ -127,7 +127,7 @@ class stock_invoice_onshipping(osv.osv_memory):
|
||||
res = picking_pool.action_invoice_create(cr, uid, active_ids,
|
||||
journal_id = onshipdata_obj[0]['journal_id'],
|
||||
group = onshipdata_obj[0]['group'],
|
||||
type = context.get('inv_type'),
|
||||
type = None,
|
||||
context=context)
|
||||
return res
|
||||
|
||||
|
||||
@@ -21,6 +21,35 @@
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class stock_move_track(osv.osv_memory):
|
||||
_name = "stock.move.track"
|
||||
_description = "Track moves"
|
||||
|
||||
_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=None):
|
||||
""" 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')
|
||||
move_obj._track_lines(cr, uid, context['active_id'], datas, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
stock_move_track()
|
||||
|
||||
class stock_move_consume(osv.osv_memory):
|
||||
_name = "stock.move.consume"
|
||||
_description = "Consume Products"
|
||||
@@ -69,9 +98,9 @@ class stock_move_consume(osv.osv_memory):
|
||||
context = {}
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context['active_ids']
|
||||
for data in self.browse(cr, uid, ids):
|
||||
for data in self.read(cr, uid, ids):
|
||||
move_obj.action_consume(cr, uid, move_ids,
|
||||
data.product_qty, data.location_id.id,
|
||||
data['product_qty'], data['location_id'],
|
||||
context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@@ -130,9 +159,9 @@ class stock_move_scrap(osv.osv_memory):
|
||||
context = {}
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context['active_ids']
|
||||
for data in self.browse(cr, uid, ids):
|
||||
for data in self.read(cr, uid, ids):
|
||||
move_obj.action_scrap(cr, uid, move_ids,
|
||||
data.product_qty, data.location_id.id,
|
||||
data['product_qty'], data['location_id'],
|
||||
context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
@@ -2,6 +2,34 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_stock_move_track_wizard" model="ir.ui.view">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="model">stock.move.track</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Tracking a move">
|
||||
<field name="tracking_prefix" colspan="4"/>
|
||||
<field name="quantity" colspan="4"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="_Cancel" />
|
||||
<button name="track_lines" string="Ok"
|
||||
type="object" icon="gtk-ok" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="track_line_old" model="ir.actions.act_window">
|
||||
<field name="name">Tracking a move</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move.track</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Consume, scrap move -->
|
||||
|
||||
<record id="view_stock_move_consume_wizard" model="ir.ui.view">
|
||||
|
||||
@@ -67,9 +67,8 @@ class stock_partial_picking(osv.osv_memory):
|
||||
for m in pick.move_lines:
|
||||
if m.state in ('done', 'cancel'):
|
||||
continue
|
||||
move_memory = self.__create_partial_picking_memory(m, pick_type)
|
||||
if move_memory:
|
||||
result.append(move_memory)
|
||||
result.append(self.__create_partial_picking_memory(m, pick_type))
|
||||
|
||||
if 'product_moves_in' in fields:
|
||||
res.update({'product_moves_in': result})
|
||||
if 'product_moves_out' in fields:
|
||||
@@ -125,27 +124,12 @@ class stock_partial_picking(osv.osv_memory):
|
||||
'prodlot_id' : picking.prodlot_id.id,
|
||||
'move_id' : picking.id,
|
||||
}
|
||||
|
||||
|
||||
if pick_type == 'in':
|
||||
move_memory.update({
|
||||
'cost' : picking.product_id.standard_price,
|
||||
'currency' : picking.product_id.company_id and picking.product_id.company_id.currency_id and picking.product_id.company_id.currency_id.id or False,
|
||||
})
|
||||
|
||||
if pick_type == 'out':
|
||||
type = picking.picking_id.move_type
|
||||
qty_avl = picking.product_id.qty_available
|
||||
if type == 'direct' :
|
||||
if qty_avl <= 0.0 and picking.state != 'assigned':
|
||||
move_memory = {}
|
||||
if picking.product_qty > qty_avl and qty_avl > 0.0:
|
||||
move_memory.update({
|
||||
'quantity' : qty_avl,
|
||||
})
|
||||
if picking.state == 'assigned':
|
||||
move_memory.update({
|
||||
'quantity' : picking.product_qty,
|
||||
})
|
||||
return move_memory
|
||||
|
||||
def do_partial(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -61,13 +61,14 @@ class survey_browse_answer(osv.osv_memory):
|
||||
@return : Dictionary value for Open the browse answer wizard.
|
||||
"""
|
||||
if context is None: context = {}
|
||||
sur_response_obj = self.pool.get('survey.response')
|
||||
for record in self.browse(cr, uid, ids,context=context):
|
||||
if record.response_id.id:
|
||||
res_id = record.response_id.id
|
||||
else:
|
||||
res_id = sur_response_obj.search(cr, uid, [('survey_id', '=',record.survey_id)])[0]
|
||||
context.update({'active' : True,'survey_id' : record.survey_id, 'response_id' : [res_id], 'response_no' : 0})
|
||||
record = self.read(cr, uid, ids, [])
|
||||
record = record and record[0] or {}
|
||||
if record['response_id']:
|
||||
res_id = [(record['response_id'])]
|
||||
else:
|
||||
sur_response_obj = self.pool.get('survey.response')
|
||||
res_id = sur_response_obj.search(cr, uid, [('survey_id', '=',int(record['survey_id']))])
|
||||
context.update({'active' : True,'survey_id' : record['survey_id'], 'response_id' : res_id, 'response_no' : 0})
|
||||
search_obj = self.pool.get('ir.ui.view')
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user