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.

1

Unable to Confirm a sale order from user ?

By
Vikram
on 8/13/13, 5:10 AM 2,816 views

Hi,

I created one user under adminstrator. Now i want to conform a sale order from user. After logged on from user, Press a confirm button following error shown.

Scenario :, User should not approve a sale order value greater than 2.5 lakhs. For that i inherit a class, sale.config.setting , Code for your reference

class sale_config(osv.osv_memory):

_inherit = 'sale.config.settings'

_columns = {
    'quote_limit': fields.float('Sales Person limit for raising Sale order',
        digits=(16,2),
        help="To allow your salesman to make invoices for sales order lines amount for limit."),
    }

sale_config()

class quote_approve_limit(osv.osv): _name= 'quote.approve.limit' _description =' Change the limit of quotation '

_columns = {
    'name' : fields.char('Description for Setting Quotation limit', size=128),
    'value' : fields.float('Limit', digits=(16,2)),
    }

quote_approve_limit()

Validation in sale.py .

class sale_order(osv.osv):

""" Inherits Qutation insert field to validity date """

_inherit = 'sale.order'

def action_button_confirm(self, cr, uid, ids, context=None):

    a = self.browse(cr,uid, ids)[0]

    l_obj=self.pool.get('quote.approve.limit').search(cr,uid,[('id','=', 1)])

    l2= self.pool.get('quote.approve.limit').browse(cr,uid,l_obj[0])

    if a.amount_total > l2.value and uid != 1:
        raise osv.except_osv(_('Warning!'),_('You cannot confirm a sales order which has greater than 2.5 Lakhs. Need a approval from Higher Authority'))
    else:
        assert len(ids) == 1, 'This option should only be used for a single id at a time.'
        wf_service = netsvc.LocalService('workflow')
        wf_service.trg_validate(uid, 'sale.order', ids[0], 'order_confirm', cr)
    return True

Executed well, When i logged in as user and try to press confirm button it shows following error: Unable to confirm a sale order....

Access Denied Sorry, you are not allowed to access this document. Please contact your system administrator if you think this is an error. (Document model: quote.approve.limit)

Any solution for that error let me know.. Thanks in advance...

1
Vikram
On 8/14/13, 5:25 AM

Hi,

The problem solved by adding a object [quote.approve.limit] to group. To enable this goto Setting -> User -> Group -> choose Access Right tab -> Add a object [quote.approve.limit] and enable read and write check box. After i try to confirm the sale order its working fine. Can any one Say My solution is correct or not ?

Thanks,

Vikram.

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

1 follower(s)

Stats

Asked: 8/13/13, 5:10 AM
Seen: 2816 times
Last updated: 5/5/15, 10:11 AM