Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

sales order revision

By
Richard
on 10/21/13, 2:45 PM 1,674 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.

0

Brett Lehrer

--Brett Lehrer--
1252
| 5 4 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 10/21/13, 3:25 PM

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!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 10/21/13, 2:45 PM
Seen: 1674 times
Last updated: 3/16/15, 8:10 AM