commit
7813f13442
|
@ -952,6 +952,7 @@
|
|||
<data>
|
||||
<xpath expr="//field[@name='move_id']" position="before">
|
||||
<field name="bom_id" domain="[('product_id','=',product_id),('bom_id','=',False)]"/>
|
||||
<field name="production_id" attrs="{'invisible': [('production_id','=',False)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='close_move']" position="after">
|
||||
<group colspan="4" groups="product.group_mrp_properties">
|
||||
|
|
|
@ -31,6 +31,7 @@ class procurement_order(osv.osv):
|
|||
_columns = {
|
||||
'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
|
||||
'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'),
|
||||
'production_id': fields.many2one('mrp.production', 'Manufacturing Order'),
|
||||
}
|
||||
|
||||
def check_produce_product(self, cr, uid, procurement, context=None):
|
||||
|
@ -95,16 +96,22 @@ class procurement_order(osv.osv):
|
|||
'move_prod_id': res_id,
|
||||
'company_id': procurement.company_id.id,
|
||||
})
|
||||
|
||||
res[procurement.id] = produce_id
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
self.running_send_note(cr, uid, ids, context=context)
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running', 'production_id': produce_id})
|
||||
bom_result = production_obj.action_compute(cr, uid,
|
||||
[produce_id], properties=[x.id for x in procurement.property_ids])
|
||||
wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
|
||||
if res_id:
|
||||
move_obj.write(cr, uid, [res_id],
|
||||
{'location_id': procurement.location_id.id})
|
||||
self.production_order_create_note(cr, uid, ids, context=context)
|
||||
return res
|
||||
|
||||
def production_order_create_note(self, cr, uid, ids, context=None):
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
body = _("Manufacturing Order created.")
|
||||
self.message_post(cr, uid, [procurement.id], body=body, context=context)
|
||||
|
||||
procurement_order()
|
||||
|
||||
|
|
|
@ -362,11 +362,10 @@ class procurement_order(osv.osv):
|
|||
""" Changes procurement state to Running and writes message.
|
||||
@return: True
|
||||
"""
|
||||
message = _('From stock: products assigned.')
|
||||
message = _('Products reserved from stock.')
|
||||
self.write(cr, uid, ids, {'state': 'running',
|
||||
'message': message}, context=context)
|
||||
self.message_post(cr, uid, ids, body=message, context=context)
|
||||
self.running_send_note(cr, uid, ids, context=context)
|
||||
return True
|
||||
|
||||
def _check_make_to_stock_service(self, cr, uid, procurement, context=None):
|
||||
|
@ -390,8 +389,6 @@ class procurement_order(osv.osv):
|
|||
order_point_id = self.pool.get('stock.warehouse.orderpoint').search(cr, uid, [('product_id', '=', procurement.product_id.id)], context=context)
|
||||
if not order_point_id and not ok:
|
||||
message = _("Not enough stock and no minimum orderpoint rule defined.")
|
||||
elif not order_point_id:
|
||||
message = _("No minimum orderpoint rule defined.")
|
||||
elif not ok:
|
||||
message = _("Not enough stock.")
|
||||
|
||||
|
@ -407,7 +404,6 @@ class procurement_order(osv.osv):
|
|||
"""
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
return True
|
||||
|
||||
def action_produce_assign_product(self, cr, uid, ids, context=None):
|
||||
|
@ -469,7 +465,6 @@ class procurement_order(osv.osv):
|
|||
@return: True
|
||||
"""
|
||||
res = self.write(cr, uid, ids, {'state': 'ready'})
|
||||
self.ready_send_note(cr, uid, ids, context=None)
|
||||
return res
|
||||
|
||||
def action_done(self, cr, uid, ids):
|
||||
|
@ -503,12 +498,6 @@ class procurement_order(osv.osv):
|
|||
def confirm_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement <b>confirmed</b>."), context=context)
|
||||
|
||||
def running_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement set to <b>running</b>."), context=context)
|
||||
|
||||
def ready_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement set to <b>ready</b>."), context=context)
|
||||
|
||||
def cancel_send_note(self, cr, uid, ids, context=None):
|
||||
self.message_post(cr, uid, ids, body=_("Procurement <b>cancelled</b>."), context=context)
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class procurement_order(osv.osv):
|
||||
_name = "procurement.order"
|
||||
|
@ -83,10 +84,15 @@ class procurement_order(osv.osv):
|
|||
'project_id': project and project.id or False,
|
||||
'company_id': procurement.company_id.id,
|
||||
},context=context)
|
||||
self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':'from project: task created.'}, context=context)
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running', 'message':_('Task created.')}, context=context)
|
||||
self.project_task_create_note(cr, uid, ids, context=context)
|
||||
return task_id
|
||||
|
||||
def project_task_create_note(self, cr, uid, ids, context=None):
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
body = _("Task created")
|
||||
self.message_post(cr, uid, [procurement.id], body=body, context=context)
|
||||
|
||||
procurement_order()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1084,9 +1084,14 @@ class procurement_order(osv.osv):
|
|||
}
|
||||
res[procurement.id] = self.create_procurement_purchase_order(cr, uid, procurement, po_vals, line_vals, context=new_context)
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': res[procurement.id]})
|
||||
self.running_send_note(cr, uid, [procurement.id], context=context)
|
||||
self.purchase_order_create_note(cr, uid, ids, context=context)
|
||||
return res
|
||||
|
||||
def purchase_order_create_note(self, cr, uid, ids, context=None):
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
body = _("Draft Purchase Order created")
|
||||
self.message_post(cr, uid, [procurement.id], body=body, context=context)
|
||||
|
||||
procurement_order()
|
||||
|
||||
class mail_mail(osv.osv):
|
||||
|
|
|
@ -115,9 +115,9 @@ class procurement_order(osv.osv):
|
|||
if proc.move_id:
|
||||
move_obj.write(cr, uid, [proc.move_id.id],
|
||||
{'location_id':proc.location_id.id})
|
||||
self.write(cr, uid, [proc.id], {'state':'running', 'message':_('Pulled from another location via procurement %d') % proc_id})
|
||||
self.running_send_note(cr, uid, [proc.id], context=context)
|
||||
|
||||
msg = _('Pulled from another location.')
|
||||
self.write(cr, uid, [proc.id], {'state':'running', 'message': msg})
|
||||
self.message_post(cr, uid, [proc.id], body=msg, context=context)
|
||||
# trigger direct processing (the new procurement shares the same planned date as the original one, which is already being processed)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue