This question has been flagged
5921 Views

hello all

i am new in odoo v8, i am trying to create one boolean field so when it checked make invoice for customer if not then dont

so how can i do this,when i research i understand   use write,read methods,,,,but how can i achieve this i do not understand please anybody help me


from openerp import api, fields, models, _

class create_invoice_customer(models.Model):

_inherit="sale.order"

_description ="create invoice for customer"

@api.model

def make_invoice1(self):

res=super(sale_order, self).create(vals)

partner_ids=self.env[account.invoice].create(vals)

#partner_ids=self.env[sale.order].search([('partner_id','=',False)])

return res

make1 = fields.Boolean(compute='make_invoice1',string="Make Invoice")


i refer these links:

https://www.odoo.com/forum/help-1/question/override-create-method-in-the-new-openerp-api-59809

http://stackoverflow.com/questions/29157555/in-odoo-v8-how-can-i-have-a-function-called-when-a-record-is-created-in-a-given

Thank you.....!

Avatar
Discard

you are on the wrong way...

I really suggest you to take a look in https://www.odoo.com/documentation/9.0/howtos/backend.html#build-an-odoo-module

Why do you want a Boolean to execute a code ... probably a button will be better ?

You are creating a sale order and an invoice with the same value an in a compute function ... no sense.