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.

0

how to use create,write,env methods..?and what is the use of vals

By
Rahul Nimgade
on 8/9/16, 7:36 AM 112 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.....!

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.

Jérémy Kersten (jke)
on 8/9/16, 7:54 AM

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/9/16, 7:36 AM
Seen: 112 times
Last updated: 8/9/16, 7:45 AM