Odoo Help


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.


How to remove is_company check box from res.partner form use Xpath ? I got an error When I use Xpath .

on 9/30/14, 12:48 PM 996 views

<record id="partner_form_inherited" model="ir.ui.view">
    <field name="name">partner.form.inherited</field>
    <field name="model">res.partner</field>
    <field name="type">form</field>
    <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
             <xpath expr="/form/sheet/div/div/field[@name='is_company']" position="replace">#####How to modify ?

<page string="Accounting" position="attributes">
                        <attribute name='invisible'>1</attribute>                
#This tag also not working

also I want to remove Page string ,Accounting from res.partner from



Med Said BARA

--Med Said BARA--
| 5 5 7
--Med Said BARA--
Med Said BARA
On 9/30/14, 1:26 PM

Try with: <xpath expr="//div//label[@for='name']/field[@name='is_company']" position="replace">

Or: <xpath expr="//field[@name='is_company']" position="replace">

Hi Med Thx for rply, I tried both of the tag in first one I gor invalid xml error ,and in second I got Error: Unknown field is_company in domain [["is_company","=",true]] this error when I create a customer ...

on 9/30/14, 9:27 PM

What about your .py file, which kind of inheritance are you using ?

Med Said BARA
on 10/1/14, 3:08 AM
Hi Sir Med ,
I have one daught from my custom module .I create one button name as Create Invoice ,when I click on this button form will goes to customer invoicing form ,there customer name is coming automatically from my res.partner form(custom form ie,'ohealth.appointment) ,But in my custom module I am selecting product as service (currently it is many2one,need a one 2many line),that product value is is not coming into my account invoice line ,How to change my code? please need  a help.

Here My customer name(partner_id) is coming in Invoices form but that corresponding product id  line is not coming in invoice line? How can I modify to  code when I click on create invoice button.


class OHealthAppointment(osv.Model):
    _name = 'ohealth.appointment'
    _inherits = {'res.partner':'partner_id'}

    _columns = {

        'partner_id': fields.many2one('res.partner', string='Patient'),

        'consultations': fields.many2one('product.product',
                                         string='Consultation Services',
                                          help='Consultation Services'
                                        , domain="[('type', '=', 'service'), ]"),#Here the products, sale price should come on account  invoice line.


def create_invoice(self, cr, uid, ids, context={}):
        self.write(cr, uid, ids, {'state':'done'} ,context=context)
        """ Create invoice for Tour payment process of Customers """
        invoice_pool = self.pool.get('account.invoice')

        default_fields = invoice_pool.fields_get(cr, uid, context=context)
        invoice_default = invoice_pool.default_get(cr, uid, default_fields, context=context)

        for student in self.browse(cr, uid, ids, context=context):

            onchange_partner = invoice_pool.onchange_partner_id(cr, uid, [], type='out_invoice',\

            invoice_data = {

                            'partner_id': student.partner_id.id,  #only customer name is coming in the invoice form
                            'date_invoice': time.strftime('%Y-%m-%d'),#I need to add what product I select                  

                    # like(if  i select a service prodcut then its price should come on the invoice line,right #now only customer name is coming how to change my code)
                           # 'payment_term': student.standard_id.payment_term and student.standard_id.payment_term.id or student.course_id.payment_term and student.course_id.payment_term.id or False,
        invoice_id = invoice_pool.create(cr, uid, invoice_default, context=context)
        models_data = self.pool.get('ir.model.data')
        form_view = models_data.get_object_reference(cr, uid, 'account', 'invoice_form')
        tree_view = models_data.get_object_reference(cr, uid, 'account', 'invoice_tree')
        value = {
                'domain': str([('id', '=', invoice_id)]),
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': 'account.invoice',
                'view_id': False,
                'views': [(form_view and form_view[1] or False, 'form'),
                          (tree_view and tree_view[1] or False, 'tree')],
                'type': 'ir.actions.act_window',
                'res_id': invoice_id,
                'target': 'current',
                'nodestroy': True
        return value



<button name="create_invoice" string="Create Invoice"
                                type="object" icon="gtk-apply" states="confirm,waiting,in_

consultation,done" class="oe_highlight" />  

On Wed, Oct 1, 2014 at 12:38 PM, Med Said BARA <diassynthesis@mail.odoo.com> wrote:

What about your .py file, which kind of inheritance are you using ?

Med Said BARA
Sent by Odoo Inc. using Odoo about Forum Post False

Libu Koshy
on 10/23/14, 2:22 PM

Just an idea: You are using an inheritance by delegation (_inherits). Why not adding an inheritance by delegation to product.product ('product.product: 'consultations')

Med Said BARA
on 10/24/14, 1:12 PM

when I click on this create_invoice button it will goes to customer invoice form ,How to add 'consultations': fields.many2one('product.product',) to the invoice line ),Then How to change my code use inheritance by delegation to product.product?Can u help

on 10/27/14, 12:18 AM

I added this way but I dont know from here how to come this corresponding product come into invoice line need a help.. product _inherits = {'res.partner':'partner_id','product.product':'consultations'}

on 10/27/14, 7:26 AM

Just change your _inherits line from: _inherits = {'res.partner':'partner_id'} to _inherits = {'res.partner':'partner_id', product.product':'consultations'}

Med Said BARA
on 10/27/14, 8:50 AM
Hi sir,
Thanks for your valuable answers, I changed the  code as you mentioned above,After but the product price and other details are not coming in the invoice line.How to change my code

On Mon, Oct 27, 2014 at 6:20 PM, Med Said BARA <diassynthesis@mail.odoo.com> wrote:

Just change your _inherits line from: _inherits = {'res.partner':'partner_id'} to _inherits = {'res.partner':'partner_id', product.product':'consultations'}

Med Said BARA
Sent by Odoo Inc. using Odoo about Forum Post False

Libu Koshy
on 10/27/14, 11: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

2 follower(s)


Asked: 9/30/14, 12:48 PM
Seen: 996 times
Last updated: 3/16/15, 8:10 AM