[MERGE] Merge procurment
bzr revid: sbh@tinyerp.com-20120514120531-pionchjinalrucfm
This commit is contained in:
commit
d424067702
|
@ -962,10 +962,10 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="/form/notebook/page/field[@name='move_id']" position="before">
|
||||
<xpath expr="/form/sheet/notebook/page/field[@name='move_id']" position="before">
|
||||
<field name="bom_id" domain="[('product_id','=',product_id),('bom_id','=',False)]"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page/field[@name='close_move']" position="after">
|
||||
<xpath expr="/form/sheet/notebook/page/field[@name='close_move']" position="after">
|
||||
<group colspan="4" groups="product.group_mrp_properties">
|
||||
<separator colspan="4" string="Properties" />
|
||||
<field colspan="4" name="property_ids" nolabel="1"/>
|
||||
|
|
|
@ -43,7 +43,7 @@ class procurement_order(osv.osv):
|
|||
cr.execute('update procurement_order set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
|
||||
for (id, name) in self.name_get(cr, uid, procurement.id):
|
||||
message = _("Procurement '%s' has an exception: 'No BoM defined for this product !'") % name
|
||||
self.log(cr, uid, id, message)
|
||||
self.message_append_note(cr, uid, [procurement], body=message, context=context)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -97,6 +97,7 @@ class procurement_order(osv.osv):
|
|||
})
|
||||
res[procurement.id] = produce_id
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
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)
|
||||
|
|
|
@ -81,6 +81,7 @@ class procurement_order(osv.osv):
|
|||
_name = "procurement.order"
|
||||
_description = "Procurement"
|
||||
_order = 'priority,date_planned desc'
|
||||
_inherit = ['mail.thread']
|
||||
_log_create = False
|
||||
_columns = {
|
||||
'name': fields.char('Reason', size=64, required=True, help='Procurement name.'),
|
||||
|
@ -346,6 +347,7 @@ class procurement_order(osv.osv):
|
|||
move_obj.action_confirm(cr, uid, [id], context=context)
|
||||
self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1})
|
||||
self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''})
|
||||
self.confirm_send_note(cr, uid, ids, context)
|
||||
return True
|
||||
|
||||
def action_move_assigned(self, cr, uid, ids, context=None):
|
||||
|
@ -354,6 +356,7 @@ class procurement_order(osv.osv):
|
|||
"""
|
||||
self.write(cr, uid, ids, {'state': 'running',
|
||||
'message': _('from stock: products assigned.')})
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
return True
|
||||
|
||||
def _check_make_to_stock_service(self, cr, uid, procurement, context=None):
|
||||
|
@ -383,7 +386,8 @@ class procurement_order(osv.osv):
|
|||
message = _("Not enough stock.")
|
||||
|
||||
if message:
|
||||
self.log(cr, uid, procurement.id, _("Procurement '%s' is in exception: ") % (procurement.name) + message)
|
||||
message = _("Procurement '%s' is in exception: ") % (procurement.name) + message
|
||||
self.message_append_note(cr, uid, [procurement], body=message, context=context)
|
||||
cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
|
||||
return ok
|
||||
|
||||
|
@ -393,6 +397,7 @@ 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):
|
||||
|
@ -427,6 +432,7 @@ class procurement_order(osv.osv):
|
|||
if len(todo):
|
||||
move_obj.write(cr, uid, todo, {'state': 'assigned'})
|
||||
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
self.cancel_send_note(cr, uid, ids, context=None)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'procurement.order', id, cr)
|
||||
|
@ -451,6 +457,7 @@ 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):
|
||||
|
@ -463,11 +470,45 @@ class procurement_order(osv.osv):
|
|||
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
||||
move_obj.action_done(cr, uid, [procurement.move_id.id])
|
||||
res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
|
||||
self.done_send_note(cr, uid, ids, context=None)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'procurement.order', id, cr)
|
||||
return res
|
||||
|
||||
# ----------------------------------------
|
||||
# OpenChatter methods and notifications
|
||||
# ----------------------------------------
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
obj_id = super(procurement_order, self).create(cr, uid, vals, context)
|
||||
self.create_send_note(cr, uid, [obj_id], context=context)
|
||||
return obj_id
|
||||
|
||||
def create_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_append_note(cr, uid, [obj.id], body=_("Procurement has been <b>created</b>."), context=context)
|
||||
|
||||
def confirm_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_append_note(cr, uid, [obj.id], body=_("Procurement has been <b>confirmed</b>."), context=context)
|
||||
|
||||
def running_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_append_note(cr, uid, [obj.id], body=_("Procurement has been set to <b>running</b>."), context=context)
|
||||
|
||||
def ready_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_append_note(cr, uid, [obj.id], body=_("Procurement has been set to <b>ready</b>."), context=context)
|
||||
|
||||
def cancel_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_append_note(cr, uid, [obj.id], body=_("Procurement has been <b>cancelled</b>."), context=context)
|
||||
|
||||
def done_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_append_note(cr, uid, [obj.id], body=_("Procurement has been <b>done</b>."), context=context)
|
||||
|
||||
procurement_order()
|
||||
|
||||
class StockPicking(osv.osv):
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
<field name="model">procurement.order</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Procurement">
|
||||
<form string="Procurement" layout="manual">
|
||||
<sheet layout="auto">
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="References"/>
|
||||
<field name="name" string="Procurement Reason"/>
|
||||
|
@ -91,6 +92,10 @@
|
|||
<field name="note" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<div class="oe_form_sheet_width">
|
||||
<field name="message_ids" colspan="4" widget="ThreadView" nolabel="1"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -81,6 +81,7 @@ class procurement_order(osv.osv):
|
|||
'company_id': procurement.company_id.id,
|
||||
},context=context)
|
||||
self.write(cr, uid, [procurement.id], {'task_id': task_id, 'state': 'running'}, context=context)
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
return task_id
|
||||
|
||||
procurement_order()
|
||||
|
|
|
@ -991,6 +991,7 @@ class procurement_order(osv.osv):
|
|||
}
|
||||
res[procurement.id] = self.create_procurement_purchase_order(cr, uid, procurement, po_vals, line_vals, context=context)
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': res[procurement.id]})
|
||||
self.running_send_note(cr, uid, ids, context=None)
|
||||
return res
|
||||
|
||||
procurement_order()
|
||||
|
|
|
@ -506,7 +506,7 @@
|
|||
<field name="inherit_id" ref="procurement.procurement_form_view"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='close_move']" position="before">
|
||||
<xpath expr="/form/sheet/notebook/page/field[@name='close_move']" position="before">
|
||||
<field name="purchase_id"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
|
@ -259,7 +259,7 @@ class procurement_order(osv.osv):
|
|||
})],
|
||||
'purchase_ids': [(6,0,[po_id])]
|
||||
})
|
||||
self.write(cr,uid,proc_id,{'requisition_id':requisition_id})
|
||||
self.write(cr,uid,[proc_id],{'requisition_id':requisition_id})
|
||||
return res
|
||||
|
||||
procurement_order()
|
||||
|
|
|
@ -116,6 +116,7 @@ class procurement_order(osv.osv):
|
|||
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, ids, context=None)
|
||||
|
||||
# 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)
|
||||
|
|
Loading…
Reference in New Issue