This question has been flagged
1 Reply
3931 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 ?
                 
            </xpath>

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

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

 

Avatar
Discard
Best Answer

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

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

Avatar
Discard
Author

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 ...

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

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'
    _inherit=['mail.thread',]
    _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',\
                                partner_id=student.partner_id.id)
            invoice_default.update(onchange_partner['value'])


            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_default.update(invoice_data)
        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

 

.xml---------

<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



--
Thanks&Regards
Libu Koshy

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

Author

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

Author

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'}

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

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



--
Thanks&Regards
Libu Koshy