Odoo Help

0

How to inherit "prototype inheritance " from one module to another new module?

By
Takwa
on 6/2/15, 7:23 AM 816 views

hello,I want a "prototype inheritance " of customer billing view from accounting model to another custom module that i called test!but it doesn't work!!can anybody help me please!this is my code:

class test_test(models.Model):

_name = 'test.test'

_inherit = 'account.invoice'

de = fields.Text(string='Des', required=True)

and the xml :

<record id="invoice_tree" model="ir.ui.view">

<field name="name">module.name.account.invoice.tree</field>

<field name="model">test.test</field>

<field name="inherit_id" ref="account.invoice_tree" />

<field name="arch" type="xml">

<field name="state" position="after">

<field name="de" /> </field> </field> </record>

help please!!!i get this erreur:

ParseError: "ValidateError

Field(s) `arch` failed against a constraint: Invalid view definition

Error details:

Field `de` does not exist

Error context:

View `account.invoice.form.inherit`

[view_id: 1092, xml_id: test.view_account_invoice_inherit_form, model: account.invoice, parent_id: 638]" while parsing file:///C:/Workspace/Odoov8/odoo/addons/test/views/dimo_view.xml:27, near

<record model="ir.ui.view" id="view_account_invoice_inherit_form">

<field name="name">account.invoice.form.inherit</field>

<field name="model">account.invoice</field>    <!------ -----  ----   ---   --    -     -->

<field name="type">form</field>

<field name="inherit_id" ref="account.invoice_form"/>

<field name="arch" type="xml">

<field name="partner_id" position="after">

<field name="de"/>

</field>

</field>

</record>

0
Takwa
On 6/3/15, 12:02 PM

hi again Temur, i already tried that but it's not woking it doenst show the "custumer invoice view" that i want!it show another view i dont even know!!

thanks Jaakko for your help!

Update (Takwa)

hey again, well i actually found the problem i think i need to specify which view to open for which view mode and i tried to solve it mysef  thanks every one for your help 

so this is my code again :

    <menuitem name="Test" id="menu_test_root"/>

        <record model="ir.actions.act_window" id="action_test1_form">

            <field name="name">test.test.action</field>

            <field name="res_model">test.test</field>

            <field name="view_type">form</field>

            <field name="view_mode">tree,form</field>

        </record>  

        <menuitem name="Clients" id="menu_test_test" parent="menu_test_root"/>

        <menuitem name="factures clients" id="menu_formation_formation2" action="action_test1_form" parent="menu_test_test"/>

    <record id="view_account_invoice_inherit_tree" model="ir.ui.view">

        <field name="name">my.module.name.tree.inherit</field>

        <field name="model">test.test</field> 

        <field name="inherit_id" ref="account.invoice_tree" />

        <field name="arch" type="xml"> 

            <field name="state" position="after">

                <field name="de" /> </field> </field></record>

    <!-- les formulaire -->

    <record model="ir.ui.view" id="view_account_invoice_inherit_form">

        <field name="name">my.module.name.form.inherit</field>

        <field name="model">test.test</field>

        <field name="type">form</field>

        <field name="inherit_id" ref="account.invoice_form"/> 

        <field name="arch" type="xml">

             <field name="partner_id" position="after">

             <field name="de"/></field> </field></record>

      <record model="ir.actions.act_window.view" id="action_test_tree">

        <field name="sequence" eval="1"/>

        <field name="view_mode">tree</field>

        <field name="view_id" ref="view_account_invoice_inherit_tree"/>

        <field name="act_window_id" ref="action_test1_form"/>

    </record>     

    <record model="ir.actions.act_window.view" id="action_test_form">

        <field name="sequence" eval="1"/>

        <field name="view_mode">form</field>

        <field name="view_id" ref="view_account_invoice_inherit_form"/>

        <field name="act_window_id" ref="action_test1_form"/> </record>

 

0

Temur

--Temur--
2912
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 6/2/15, 11:32 AM

in XML record from your error log, in C:/Workspace/Odoov8/odoo/addons/test/views/dimo_view.xml replace account.invoice with test.test 

Error message says: 
Field `de` does not exist
-yes, 'de' does not exist in the account.invoice model, but in test.test model... you forgot to rename account.invoice to test.test in XML (you renamed in tree view part, but not in form view part).

0
seifeddine Euchi
On 6/3/15, 12:25 PM

replace models.Model by osv.osv andi add in the top from openerp import osv

0
Jaakko Komulainen
On 6/2/15, 9:10 AM

You need to put your field definitions in _columns dictionary:

_columns = { 
'de':fields.text('des',required=True)
}


About This Community

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

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/2/15, 7:23 AM
Seen: 816 times
Last updated: 6/4/15, 6:53 AM