Community mailing list archives

community@mail.odoo.com

Re: Problem extending state

by
Kalpana Hemnani
- 08/27/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 <aw@kreawit.se> wrote:
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

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Thank You,
Regards,
Kalpana Hemnani
Software Engineer