This question has been flagged
1 Reply
6318 Views

We are in the process of setting up OERP but have just found out that sales orders are locked once confirmed and there is no way to create or track revisions to sales orders.
Has anyone come up with a solution to revise SOs and subsequent POs and MRP? Many customers issues revisions to their orders and we must track them and change our documentation accordingly, so if orders cannot be revised OERP is an unworkable solution.

Avatar
Discard
Best Answer

The reason orders can't be edited after they're confirmed is more of an accounting concept. PDFs are generated at that point and emailed out, and you don't want to modify a record like that after it has been seen by another party (you'll have a single sales order number saying two different things). The proper method to handle that situation would be to cancel that sales order and duplicate it, then write in your changes before re-confirming.

The less proper but viable method would be to write a module that changes when sales order fields can be edited. If you look at the sales order columns definition, you'll see a lot of stuff like this:

'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address', readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Delivery address for current sales order."),

This means that the field is by default readonly, but if the order state is in 'draft' or 'sent', then readonly is disabled. You could potentially have that say:

'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address', required=True, states={'done': [('readonly', True)], help="Delivery address for current sales order."),

This sets the field to always be writable except when the order is in the 'done' state. Again, not entirely recommended, but if you want to redefine what should be allowed to be edited, a new module inheriting sale.order and redefining these existing columns with new readonly properties will definitely get the job done. The full python code for modifying that field in a new module would look like this:

from openerp.osv import osv,fields

class sale_order(osv.osv):
    _inherit = "sale.order"
    _columns = {
        'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address', required=True, states={'done': [('readonly', True)], help="Delivery address for current sales order."),
    }

Just keep copying in field definitions from the original sale.py file and writing in your changes. Remember, don't modify the original source code. Make new modules that inherit!

Avatar
Discard