Community mailing list archives

community@mail.odoo.com

Problem extending state

by
Anders Wallenquist
- 08/27/2014 06:27:36
I'm trying to extend state in account.invoice.

class account_invoice(osv.osv):
     _inherit = "account.invoice"
     _columns = {
         'state': fields.selection([
             ('draft','Draft'),
             ('submitted','Submitted'),
             ('proforma','Pro-forma'),
             ('proforma2','Pro-forma'),
             ('open','Open'),
             ('paid','Paid'),
             ('cancel','Cancelled'),
             ],'Status', select=True, readonly=True, 
track_visibility='onchange',
             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 
invoice.'),
     }

     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, [inv.id], 
{'status': 'submitted'})
         return True


__openerp__.py:
...
     'depends': ['account'],
...

__init__.py:
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?

Regards
Anders Wallenquist