Skip to Content
Menu
This question has been flagged
2 Replies
1548 Views

Hi peeps


i have pulled quants of a product in a new model as many2one and now i see my locations of the product.

How can i hide the partner locations and group the actual locations?



Avatar
Discard
Author Best Answer

I use Studio on v15 enterprise.

This is the inherited view:

<data>

  <xpath expr="//field[@name='x_name']" position="attributes">

    <attribute name="attrs">{}</attribute>

    <attribute name="force_save">True</attribute>

    <attribute name="required"/>

    <attribute name="readonly">1</attribute>

  </xpath>

  <xpath expr="//field[@name='x_studio_tag_ids']" position="before">

    <field name="x_studio_many2one_field_nyWp6" string="Part number" help="Please select the part number you are requesting. Just start typing..." options="{&quot;no_create&quot;:true}"/>

    <field name="x_studio_qty_requested" string="Qty Requested" attrs="{}" help="How many do you need?"/>

  </xpath>

  <xpath expr="//field[@name='x_studio_tag_ids']" position="attributes">

    <attribute name="help">Just tag this request. You can create your custom tags.</attribute>

  </xpath>

  <xpath expr="//group[@name='studio_group_5497ce_right']" position="inside">

    <field name="x_studio_product_description"/>

    <field name="x_studio_qty_on_hand" string="Qty on hand" help="This is the qty we have right now in stock."/>

    <field name="x_studio_related_field_0hJsT" string="Department"/>

    <field name="x_studio_user_id" widget="many2one_avatar"/>

    <field name="x_studio_started_processing" string="Started Processing" attrs="{&quot;invisible&quot;: [[&quot;x_studio_started_processing&quot;,&quot;=&quot;,False]]}" force_save="True" readonly="1"/>

    <field name="x_studio_date_delivered" string="Date Delivered" force_save="True" attrs="{&quot;invisible&quot;: [[&quot;x_studio_date_delivered&quot;,&quot;=&quot;,False]]}" readonly="1"/>

  </xpath>

  <xpath expr="//group[@name='studio_group_5497ce']" position="after">

    <notebook name="studio_notebook_FEUrJ">

      <page string="Notes" name="studio_page_FEUrJ">

        <group name="studio_group_FEUrJ">

          <field name="x_studio_type_your_message_here" string="Type a message:" help="Here you can add more info for the person in charge."/>

        </group>

      </page>

      <page string="Location Availability" name="studio_page_BOclI">

        <field name="x_studio_related_field_9d45O" string="Location Availability">

          <tree default_order="location_id desc" decoration-warning="is_outdated" editable="bottom" create="1" edit="1" import="1" js_class="singleton_list" sample="1">

            <header>

              <button name="stock.action_stock_inventory_adjustement_name" groups="stock.group_stock_manager" type="action" string="Apply"/>

              <button name="action_reset" type="object" string="Clear"/>

              <button name="stock.action_stock_request_count" groups="stock.group_stock_manager" type="action" string="Request a Count"/>

            </header>

            <field name="id" invisible="1"/>

            <field name="is_outdated" invisible="1"/>

            <field name="tracking" invisible="1"/>

            <field name="inventory_quantity_set" invisible="1"/>

            <field name="x_studio_received_date_1" optional="show" widget="remaining_days" attrs="{}" invisible="1"/>

            <field name="location_id" attrs="{&quot;readonly&quot;: [[&quot;id&quot;,&quot;!=&quot;,False]]}" invisible="context.get('hide_location', False)" options="{'no_create': True}" domain="[[&quot;name&quot;,&quot;not ilike&quot;,'Partner']]"/>

            <field optional="show" name="x_studio_status_1" string="Status" attrs="{}" invisible="1"/>

            <field optional="show" name="x_studio_location_type" string="Location Type" widget="badge" attrs="{}" invisible="1"/>

            <field optional="show" name="x_studio_related_field_BtMfT" string="Boxed tracking number" attrs="{}" invisible="1"/>

            <field optional="hide" name="x_studio_received_date" string="Received Date"/>

            <field name="x_studio_part_number" optional="show"/>

            <field name="x_studio_product_discription" optional="show" string="Product Description"/>

            <field optional="show" name="x_studio_related_field_vO33T" attrs="{}" invisible="1"/>

            <field name="product_id" attrs="{'readonly': [('id', '!=', False)]}" readonly="context.get('single_product', False)" force_save="1" options="{'no_create': True}" optional="hide"/>

            <field name="product_categ_id" optional="hide"/>

            <field name="lot_id" groups="stock.group_production_lot" attrs="{'readonly': ['|', ('id', '!=', False), ('tracking', 'not in', ['serial', 'lot'])]}" invisible="context.get('hide_lot', False)" context="{'default_product_id': product_id, 'default_company_id': company_id}"/>

            <field optional="show" name="x_studio_related_field_3i3Z4" widget="many2many_tags" options="{&quot;color_field&quot;: &quot;x_color&quot;, &quot;no_create&quot;: true}" string="Flag" attrs="{}" invisible="1"/>

            <field name="x_studio_related_field_6dosZ" optional="show" options="{&quot;no_create&quot;:true}" domain="[]"/>

            <field optional="hide" name="x_studio_product_condition" string="Product Condition"/>

            <field optional="show" name="x_studio_related_field_b2OPM" string="Grade" attrs="{}" invisible="1"/>

            <field name="package_id" groups="stock.group_tracking_lot" attrs="{}" options="{&quot;no_create&quot;:true}"/>

            <field optional="hide" name="x_studio_serialized"/>

            <field name="owner_id" optional="hide" groups="stock.group_tracking_owner" attrs="{}" options="{'no_create': True}" invisible="1"/>

            <field name="x_studio_unit_owner_1" optional="show" string="Portal Owner" options="{&quot;no_create&quot;:true}"/>

            <field optional="show" name="x_studio_related_field_bIv9W" string="Inventory Owner" attrs="{}" invisible="1"/>

            <field name="available_quantity" string="Available Quantity" decoration-danger="available_quantity &lt; 0" optional="hidden"/>

            <field name="quantity" optional="show" string="On Hand Quantity"/>

            <field name="product_uom_id" groups="uom.group_uom" string="UoM"/>

            <field name="accounting_date" optional="hide"/>

            <field name="inventory_quantity" widget="counted_quantity_widget" attrs="{}" invisible="1"/>

            <field name="inventory_diff_quantity" string="Difference" attrs="{'invisible': [('inventory_quantity_set', '=', False)]}" decoration-muted="inventory_diff_quantity == 0" decoration-danger="inventory_diff_quantity &lt; 0" decoration-success="inventory_diff_quantity &gt; 0" decoration-bf="inventory_diff_quantity != 0" optional="hide"/>

            <field name="inventory_date" optional="show" attrs="{}" invisible="1"/>

            <field name="create_date" optional="show"/>

            <field name="user_id" string="User" optional="show" attrs="{}" invisible="1"/>

            <field name="company_id" groups="base.group_multi_company" optional="hide"/>

            <button name="action_inventory_history" type="object" class="btn btn-link text-info" icon="fa-history" string="History"/>

            <button name="action_apply_inventory" groups="stock.group_stock_manager" type="object" string="Apply" class="btn btn-link" icon="fa-save" attrs="{'invisible': [('inventory_quantity_set', '=', False)]}"/>

            <button name="action_set_inventory_quantity" type="object" string="Set" class="btn btn-link" icon="fa-bullseye" attrs="{'invisible': [('inventory_quantity_set', '=', True)]}"/>

            <button name="action_set_inventory_quantity_to_zero" type="object" string="Clear" class="btn text-warning" icon="fa-times" attrs="{'invisible': [('inventory_quantity_set', '=', False)]}"/>

            <field name="__last_update" optional="show" attrs="{}" invisible="1"/>

            <field optional="show" name="x_studio_warranty" string="Warranty?" attrs="{}" invisible="1"/>

            <field name="write_uid" optional="show" widget="badge" attrs="{}" invisible="1"/>

          </tree>

          <form string="Inventory Valuation" create="false" edit="false" delete="false">

            <sheet name="studio_sheet_9f0b44">

              <group name="studio_group_8ecd5e">

                <group name="studio_group_396975">

                  <field name="tracking" invisible="1"/>

                  <field name="product_id" readonly="0" options="{&quot;no_create&quot;:true,&quot;no_open&quot;:true}"/>

                  <field name="location_id" readonly="0" options="{'no_create': True}"/>

                  <field name="lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('tracking', 'not in', ['serial', 'lot'])], 'required': [('tracking', '!=', 'none')]}" context="{'default_product_id': product_id, 'default_company_id': company_id}"/>

                  <field name="package_id" readonly="0" groups="stock.group_tracking_lot"/>

                  <field name="owner_id" readonly="0" groups="stock.group_tracking_owner" options="{'no_create': True}"/>

                  <field name="company_id" groups="base.group_multi_company"/>

                </group>

                <group name="studio_group_d89f32">

                  <field name="x_studio_received_date_1" string="Received Date"/>

                  <field name="x_studio_related_field_6dosZ" string="Serial Condition"/>

                  <label for="inventory_quantity" string="Quantity On Hand"/>

                  <div class="o_row" name="studio_div_21940b">

                    <field name="inventory_quantity"/>

                    <field name="product_uom_id" groups="uom.group_uom"/>

                  </div>

                  <label for="reserved_quantity" string="Quantity Reserved"/>

                  <div class="o_row" name="studio_div_388fcd">

                    <field name="reserved_quantity"/>

                    <field name="product_uom_id" groups="uom.group_uom"/>

                  </div>

                </group>

              </group>

              <field name="x_studio_many2many_field_Q7YXb" string="Related Product Template"/>

            </sheet>

          </form>

        </field>

      </page>

      <page string="Other info" name="studio_page_dCpvX">

        <group name="studio_group_dCpvX">

          <group name="studio_group_dCpvX_left">

            <field name="create_uid" options="{&quot;no_create&quot;:true}" attrs="{}"/>

            <field name="create_date"/>

            <xpath expr="//field[@name='x_studio_user_id']" position="move"/>

            <xpath expr="//field[@name='x_studio_user_id']" position="move"/>

          </group>

          <group name="studio_group_dCpvX_right"/>

        </group>

      </page>

    </notebook>

  </xpath>

</data>

 



Avatar
Discard
Best Answer

Hi,

Create a new view that inherits the original view. You can do this by creating an XML file in your custom module. For example, create a file named views/stock_location_views.xml

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

<field name="name">stock.location.form.inherit</field>

<field name="model">stock.location</field>

<field name="inherit_id" ref="stock.view_location_form"/>

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

        <!-- Your customizations go here -->

    </field>

</record>

   



In the newly created view, you can customize the XML to hide the partner locations and group the actual locations. For example:

<record id="view_stock_location_form_inherit" model="ir.ui.view">
    <field name="arch" type="xml">
<xpath expr="//field[@name='location_id']" position="attributes">
            <attribute name="domain">[('usage', '=', 'internal')]</attribute>
        </xpath>
    </field>
</record>


Hope it helps

Avatar
Discard