Question

I am having a problem with MRP standard module on OpenERP. The problem is on the sequence number of all manufactoring orders.

If I click on Create button and then Discard button, the manufactory order number increases in sequence. This is happening because the action of achiving the number is on the Create button and not on Save button. So, if I click Create/Discard 10 times, this number will increase 10 times even thinking that none of them were saved.

What I need to do is do add an action on the Save button, to verify on the database what was the last saved number (independently of its state) and add the next number to the manufactoring order I am saving at that moment. This way I will garantee that the manufactoring order number sequence is correct.

Thank you all in advance

Paulo

Was it helpful?

Solution

You need to change few following changes in your file of core module.

  • addons/mrp/mrp.py

In above file first find class mrp_production and _columns = { and field is name remove required=True and readonly=Ture and than find _defaults = and than comment on name.

After than write below create method.

def create(self, cr, uid, vals, context=None):
    vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'mrp.production')
    return super(mrp_production, self).create(cr, uid, vals, context=context)
  • addons/mrp/mrp_view.xml

In this file find <h1>Manufacturing Order <field name="name" class="oe_inline"/></h1> and replace with this

<h1>Manufacturing Order <field name="name" class="oe_inline" readonly="1"/></h1>

After than restart your server with upgrade database and module name mrp.

Hope this will solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top