Odoo Move field












1















I am trying to move a field under res.partner. The field is Barcode and it is under notebook Sales & Purchases. I added a field to the form view but as I have found out Odoo only allows on field per view. Below code works but does not display any data.



<xpath expr="//field[@name='category_id']" position="after">
<field name="barcode" />
<field name="pin"


enter image description here



The barcode field seems to be point_of_sale.view_partner_property_form



enter image description here



I tried below but it did not remove the barcode field



<!--Form -->
<odoo>
<record id="view_partner_pos_form_extend" model="ir.ui.view">
<field name="name">res.partner.pos.form.view.extend</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='barcode']" position="replace">
</xpath>
</field>
</record>
</odoo>









share|improve this question

























  • Both answers seem correct, could you please edit in all your partner form view extensions?

    – CZoellner
    Nov 26 '18 at 17:03
















1















I am trying to move a field under res.partner. The field is Barcode and it is under notebook Sales & Purchases. I added a field to the form view but as I have found out Odoo only allows on field per view. Below code works but does not display any data.



<xpath expr="//field[@name='category_id']" position="after">
<field name="barcode" />
<field name="pin"


enter image description here



The barcode field seems to be point_of_sale.view_partner_property_form



enter image description here



I tried below but it did not remove the barcode field



<!--Form -->
<odoo>
<record id="view_partner_pos_form_extend" model="ir.ui.view">
<field name="name">res.partner.pos.form.view.extend</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='barcode']" position="replace">
</xpath>
</field>
</record>
</odoo>









share|improve this question

























  • Both answers seem correct, could you please edit in all your partner form view extensions?

    – CZoellner
    Nov 26 '18 at 17:03














1












1








1








I am trying to move a field under res.partner. The field is Barcode and it is under notebook Sales & Purchases. I added a field to the form view but as I have found out Odoo only allows on field per view. Below code works but does not display any data.



<xpath expr="//field[@name='category_id']" position="after">
<field name="barcode" />
<field name="pin"


enter image description here



The barcode field seems to be point_of_sale.view_partner_property_form



enter image description here



I tried below but it did not remove the barcode field



<!--Form -->
<odoo>
<record id="view_partner_pos_form_extend" model="ir.ui.view">
<field name="name">res.partner.pos.form.view.extend</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='barcode']" position="replace">
</xpath>
</field>
</record>
</odoo>









share|improve this question
















I am trying to move a field under res.partner. The field is Barcode and it is under notebook Sales & Purchases. I added a field to the form view but as I have found out Odoo only allows on field per view. Below code works but does not display any data.



<xpath expr="//field[@name='category_id']" position="after">
<field name="barcode" />
<field name="pin"


enter image description here



The barcode field seems to be point_of_sale.view_partner_property_form



enter image description here



I tried below but it did not remove the barcode field



<!--Form -->
<odoo>
<record id="view_partner_pos_form_extend" model="ir.ui.view">
<field name="name">res.partner.pos.form.view.extend</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='barcode']" position="replace">
</xpath>
</field>
</record>
</odoo>






xml odoo odoo-10 odoo-9 odoo-view






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 8:09









WaKo

7,92722442




7,92722442










asked Nov 23 '18 at 16:52









user2379186user2379186

122112




122112













  • Both answers seem correct, could you please edit in all your partner form view extensions?

    – CZoellner
    Nov 26 '18 at 17:03



















  • Both answers seem correct, could you please edit in all your partner form view extensions?

    – CZoellner
    Nov 26 '18 at 17:03

















Both answers seem correct, could you please edit in all your partner form view extensions?

– CZoellner
Nov 26 '18 at 17:03





Both answers seem correct, could you please edit in all your partner form view extensions?

– CZoellner
Nov 26 '18 at 17:03












2 Answers
2






active

oldest

votes


















0














May be your second code is not working because there is two fields with the same name
barcodeand odoo cannot distinct witch one you want to locate with XPATH.



So why you create two views for this just keep them in the same view and make sure
to remove the first field then add the second one.



    <!-- remove old field -->
<xpath expr="//field[@name='barcode']" position="replace"/>
<!-- add new fields -->
<xpath expr="//field[@name='category_id']" position="after">
<field name="barcode" />
<field name="pin"/>
....
</xpath>





share|improve this answer
























  • No this this not work either. I thought this would be easy. I just need to move barcode to the main form. Also in Sale Order Module. Their is a field called Sales Person. I am having same problem moving this to main form.

    – user2379186
    Nov 25 '18 at 7:27











  • Do you keep seeing both fields ??

    – EasyOdoo
    Nov 25 '18 at 8:49



















0














Instead of using xpath expression just use field.



<field name="barcode" position="replace"/>


Example:



<record id="view_partner_pos_form_extend" model="ir.ui.view">
<field name="name">res.partner.pos.form.view.extend</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
<field name="arch" type="xml">
<!-- Uncomment this line and comment the second line the remove the group -->
<!--group name="point_of_sale" position="replace"/-->
<field name="barcode" position='replace'/>
<field name="category_id" position='after'>
<field name="barcode"/>
</field>
</field>
</record>





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450437%2fodoo-move-field%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    May be your second code is not working because there is two fields with the same name
    barcodeand odoo cannot distinct witch one you want to locate with XPATH.



    So why you create two views for this just keep them in the same view and make sure
    to remove the first field then add the second one.



        <!-- remove old field -->
    <xpath expr="//field[@name='barcode']" position="replace"/>
    <!-- add new fields -->
    <xpath expr="//field[@name='category_id']" position="after">
    <field name="barcode" />
    <field name="pin"/>
    ....
    </xpath>





    share|improve this answer
























    • No this this not work either. I thought this would be easy. I just need to move barcode to the main form. Also in Sale Order Module. Their is a field called Sales Person. I am having same problem moving this to main form.

      – user2379186
      Nov 25 '18 at 7:27











    • Do you keep seeing both fields ??

      – EasyOdoo
      Nov 25 '18 at 8:49
















    0














    May be your second code is not working because there is two fields with the same name
    barcodeand odoo cannot distinct witch one you want to locate with XPATH.



    So why you create two views for this just keep them in the same view and make sure
    to remove the first field then add the second one.



        <!-- remove old field -->
    <xpath expr="//field[@name='barcode']" position="replace"/>
    <!-- add new fields -->
    <xpath expr="//field[@name='category_id']" position="after">
    <field name="barcode" />
    <field name="pin"/>
    ....
    </xpath>





    share|improve this answer
























    • No this this not work either. I thought this would be easy. I just need to move barcode to the main form. Also in Sale Order Module. Their is a field called Sales Person. I am having same problem moving this to main form.

      – user2379186
      Nov 25 '18 at 7:27











    • Do you keep seeing both fields ??

      – EasyOdoo
      Nov 25 '18 at 8:49














    0












    0








    0







    May be your second code is not working because there is two fields with the same name
    barcodeand odoo cannot distinct witch one you want to locate with XPATH.



    So why you create two views for this just keep them in the same view and make sure
    to remove the first field then add the second one.



        <!-- remove old field -->
    <xpath expr="//field[@name='barcode']" position="replace"/>
    <!-- add new fields -->
    <xpath expr="//field[@name='category_id']" position="after">
    <field name="barcode" />
    <field name="pin"/>
    ....
    </xpath>





    share|improve this answer













    May be your second code is not working because there is two fields with the same name
    barcodeand odoo cannot distinct witch one you want to locate with XPATH.



    So why you create two views for this just keep them in the same view and make sure
    to remove the first field then add the second one.



        <!-- remove old field -->
    <xpath expr="//field[@name='barcode']" position="replace"/>
    <!-- add new fields -->
    <xpath expr="//field[@name='category_id']" position="after">
    <field name="barcode" />
    <field name="pin"/>
    ....
    </xpath>






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 23 '18 at 18:07









    EasyOdooEasyOdoo

    7,1392823




    7,1392823













    • No this this not work either. I thought this would be easy. I just need to move barcode to the main form. Also in Sale Order Module. Their is a field called Sales Person. I am having same problem moving this to main form.

      – user2379186
      Nov 25 '18 at 7:27











    • Do you keep seeing both fields ??

      – EasyOdoo
      Nov 25 '18 at 8:49



















    • No this this not work either. I thought this would be easy. I just need to move barcode to the main form. Also in Sale Order Module. Their is a field called Sales Person. I am having same problem moving this to main form.

      – user2379186
      Nov 25 '18 at 7:27











    • Do you keep seeing both fields ??

      – EasyOdoo
      Nov 25 '18 at 8:49

















    No this this not work either. I thought this would be easy. I just need to move barcode to the main form. Also in Sale Order Module. Their is a field called Sales Person. I am having same problem moving this to main form.

    – user2379186
    Nov 25 '18 at 7:27





    No this this not work either. I thought this would be easy. I just need to move barcode to the main form. Also in Sale Order Module. Their is a field called Sales Person. I am having same problem moving this to main form.

    – user2379186
    Nov 25 '18 at 7:27













    Do you keep seeing both fields ??

    – EasyOdoo
    Nov 25 '18 at 8:49





    Do you keep seeing both fields ??

    – EasyOdoo
    Nov 25 '18 at 8:49













    0














    Instead of using xpath expression just use field.



    <field name="barcode" position="replace"/>


    Example:



    <record id="view_partner_pos_form_extend" model="ir.ui.view">
    <field name="name">res.partner.pos.form.view.extend</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
    <field name="arch" type="xml">
    <!-- Uncomment this line and comment the second line the remove the group -->
    <!--group name="point_of_sale" position="replace"/-->
    <field name="barcode" position='replace'/>
    <field name="category_id" position='after'>
    <field name="barcode"/>
    </field>
    </field>
    </record>





    share|improve this answer






























      0














      Instead of using xpath expression just use field.



      <field name="barcode" position="replace"/>


      Example:



      <record id="view_partner_pos_form_extend" model="ir.ui.view">
      <field name="name">res.partner.pos.form.view.extend</field>
      <field name="model">res.partner</field>
      <field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
      <field name="arch" type="xml">
      <!-- Uncomment this line and comment the second line the remove the group -->
      <!--group name="point_of_sale" position="replace"/-->
      <field name="barcode" position='replace'/>
      <field name="category_id" position='after'>
      <field name="barcode"/>
      </field>
      </field>
      </record>





      share|improve this answer




























        0












        0








        0







        Instead of using xpath expression just use field.



        <field name="barcode" position="replace"/>


        Example:



        <record id="view_partner_pos_form_extend" model="ir.ui.view">
        <field name="name">res.partner.pos.form.view.extend</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
        <field name="arch" type="xml">
        <!-- Uncomment this line and comment the second line the remove the group -->
        <!--group name="point_of_sale" position="replace"/-->
        <field name="barcode" position='replace'/>
        <field name="category_id" position='after'>
        <field name="barcode"/>
        </field>
        </field>
        </record>





        share|improve this answer















        Instead of using xpath expression just use field.



        <field name="barcode" position="replace"/>


        Example:



        <record id="view_partner_pos_form_extend" model="ir.ui.view">
        <field name="name">res.partner.pos.form.view.extend</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="point_of_sale.view_partner_property_form" />
        <field name="arch" type="xml">
        <!-- Uncomment this line and comment the second line the remove the group -->
        <!--group name="point_of_sale" position="replace"/-->
        <field name="barcode" position='replace'/>
        <field name="category_id" position='after'>
        <field name="barcode"/>
        </field>
        </field>
        </record>






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 25 '18 at 8:08

























        answered Nov 25 '18 at 7:00









        WaKoWaKo

        7,92722442




        7,92722442






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450437%2fodoo-move-field%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Sphinx de Gizeh

            Dijon

            Determine an Integral..