Community Mailinglisten Archive


Re: Problem extending state

Kalpana Hemnani
- 27.08.2014 06:45:01
Hello Anders,

Put field name(instead of field string) as {'state': 'submitted'} instead {'status': 'submitted'}.

Hope this helps.

On Wed, Aug 27, 2014 at 4:03 PM, Anders Wallenquist <> wrote:
I'm trying to extend state in account.invoice.

class account_invoice(osv.osv):
     _inherit = "account.invoice"
     _columns = {
         'state': fields.selection([
             ],'Status', select=True, readonly=True, 
             help=' * The \'Draft\' status is used when a user is 
encoding a new and unconfirmed Invoice. \
             \n* The \'Submitted\' when invoice is in submitted 
status,invoice does not have an invoice number and waits for approval. \
             \n* The \'Pro-forma\' when invoice is in Pro-forma 
status,invoice does not have an invoice number. \
             \n* The \'Open\' status is used when user create invoice,a 
invoice number is generated.Its in open status till user does not pay 
invoice. \
             \n* The \'Paid\' status is set automatically when the 
invoice is paid. Its related journal entries may or may not be reconciled. \
             \n* The \'Cancelled\' status is used when user cancel 

     def invoice_submitted(self, cr, uid, ids, context=None,):
         for inv in self.browse(cr, uid, ids, context=context):
             self.pool.get('account.invoice').write(cr, uid, [], 
{'status': 'submitted'})
         return True
     'depends': ['account'],
import account_invoice

I get this error message:

The value "submitted" for the field "account.invoice.state" is not in 
the selection

What is my wrong doing?

Anders Wallenquist

Post to:

Thank You,
Kalpana Hemnani
Software Engineer