Perubahan Attrs, States dan Name_get pada Odoo 17

Jun 3, 2024 | Odoo 17 Development

Pada Odoo 17 ada perubahan pada atribut attrs state name_get. Kita dapat melihat penjelasannya pada youtube mengenai apa yang berubah mengenai ORM pada Odoo 17 yang dapat dilihat pada https://www.youtube.com/watch?v=Fmr4JBzlDyY .

Jika kita menggunakan pemrograman dengan style yang lama mungkin kita akan mengakami error

Since 17.0, the "attrs" and "states" attributes are no longer used.
View: estate.property.form in estate/views/estate_property_views.xml

Perubahan attrs, state, dan name_get pada Odoo 17 adalah seperti penjelasan-penjelasan berikut ini

  1. Perubahan atribut attrs



  2. Perubahan atribut states

  3. Perubahan name_get
  4. Dengan demikian ada perubahan pada estate_property_views.xml menjadi
    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
    <record id="estate_property_view_form" model="ir.ui.view">
    <field name="name">estate.property.form</field>
    <field name="model">estate.property</field>
    <field name="arch" type="xml">
    <form>
    <header>
    <button name="action_sold" type="object" string="Sold" invisible="state not in ('new','offer_received')"/>
    <button name="action_sold" type="object" string="Sold" invisible="state != 'offer_accepted'" class="oe_highlight"/>
    <button name="action_cancel" type="object" string="Cancel" invisible="state not in ('new','offer_received','offer_accepted')"/>
    <field name="state" widget="statusbar" statusbar_visible="new,offer_received,offer_accepted,sold"/> 
    </header>
    <sheet>
    <div class="oe_title">
    <h1>
    <field name="name"/>
    </h1>
    <field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
    </div>
    <group>
    <group>
    <field name="property_type_id" options="{'no_create': True, 'no_edit': True}"/>
    <field name="postcode"/>
    <field name="date_availability"/>
    </group>
    <group>
    <field name="expected_price"/>
    <field name="best_price"/>
    <field name="selling_price"/>
    </group>
    </group>
    <notebook>
    <page string="Description">
    <group>
    <group>
    <field name="description"/>
    <field name="bedrooms"/>
    <field name="living_area"/>
    <field name="facades"/>
    <field name="garage"/>
    <field name="garden"/>
    <field name="garden_area" invisible="garden == False" />
    <field name="garden_orientation" invisible="garden == False"/>
    <field name="total_area"/>
    </group>
    </group>
    </page>
    <page string="Offers">
    <field name="offer_ids"  readonly="state in ('offer_accepted', 'sold', 'canceled')" />
    </page>
    <page string="Other Info">
    <group>
    <group>
    <field name="user_id"/>
    <field name="buyer_id"/>
    </group>
    </group>
    </page>
    </notebook>
    </sheet>
    </form>
    </field>
    </record>
    <record id="estate_property_view_tree" model="ir.ui.view">
    <field name="name">estate.property.tree</field>
    <field name="model">estate.property</field>
    <field name="arch" type="xml">
    <tree string="Properties" decoration-success="state in ('offer_received', 'offer_accepted')" decoration-muted="state == 'sold'" decoration-bf="state == 'offer_accepted'">
    <field name="name"/>
    <field name="property_type_id"/>
    <field name="postcode"/>
    <field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
    <field name="bedrooms"/>
    <field name="living_area"/>
    <field name="expected_price"/>
    <field name="selling_price"/>
    <field name="date_availability" optional="hide"/>
    <field name="state" invisible="1"/>
    </tree>
    </field>
    </record>
    <record id="estate_property_view_search" model="ir.ui.view">
    <field name="name">estate.property.search</field>
    <field name="model">estate.property</field>
    <field name="arch" type="xml">
    <search>
    <field name="name"/>
    <field name="property_type_id"/>
    <field name="postcode"/>
    <field name="expected_price"/>
    <field name="bedrooms"/>
    <field name="living_area" filter_domain="[('living_area', '>=', self)]"/>
    <field name="facades"/>
    <field name="garage"/>
    <field name="garden"/>
    <filter string="Available" name="available" domain="[('state', 'in', ('new', 'offer_received'))]"/>
    <group expand="1" string="Group By">
    <filter string="Postcode" name='postcode' context="{'group_by':'postcode'}"/>
    </group>
    </search>
    </field>
    </record>
    <record id="estate_property_view_kanban" model="ir.ui.view">
    <field name="name">estate.property.kanban</field>
    <field name="model">estate.property</field>
    <field name="arch" type="xml">
    <kanban default_group_by="property_type_id" records_draggable="0">
    <field name="state"/>
    <templates>
    <t t-name="kanban-box">
    <div class="oe_kanban_global_click">
    <div>
    <strong class="o_kanban_record_title">
    <field name="name"/>
    </strong>
    </div>
    <div>
    Expected Price: <field name="expected_price"/>
    </div>
    <div t-if="record.state.raw_value == 'offer_received'">
    Best Offer: <field name="best_price"/>
    </div>
    <div t-if="record.selling_price.raw_value">
    Selling Price: <field name="selling_price"/>
    </div>
    <field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
    </div>
    </t>
    </templates>
    </kanban>
    </field>
    </record>
    <record id="estate_property_action" model="ir.actions.act_window">
    <field name="name">Properties</field>
    <field name="res_model">estate.property</field>
    <field name="view_mode">tree,kanban,form</field>
    <field name="context">{'search_default_available': 1}</field>
    <field name="help" type="html">
    <p class="o_view_nocontent_smiling_face">
    Create a property advertisement
    </p>
    <p>
    Create real estate properties and follow the selling process.
    </p>
    </field>
    </record>
    </odoo>
    
  5. Perubahan estate_property_offer_views.xml menjadi
    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
    <record id="estate_property_offer_view_form" model="ir.ui.view">
    <field name="name">estate.property.offer.form</field>
    <field name="model">estate.property.offer</field>
    <field name="arch" type="xml">
    <form string="Property Offer">
    <group>
    <field name="price"/>
    <field name="partner_id"/>
    </group>
    </form>
    </field>
    </record>
    <record id="estate_property_offer_view_tree" model="ir.ui.view">
    <field name="name">estate.property.offer.tree</field>
    <field name="model">estate.property.offer</field>
    <field name="arch" type="xml">
    <tree string="Property Offers" editable="bottom" decoration-success="state == 'accepted'" decoration-danger="state == 'refused'">
    <field name="price"/>
    <field name="partner_id"/>
    <field name="validity"/>
    <field name="date_deadline"/>
    <button name="action_accept" type="object" title="Accept" icon="fa-check" invisible="state != False"/>
    <button name="action_refuse" type="object" title="Refuse" icon="fa-times" invisible="state != False"/>
    <field name="state" invisible="1"/>
    </tree>
    </field>
    </record>
    <record id="estate_property_offer_action" model="ir.actions.act_window">
    <field name="name">Property Offers</field>
    <field name="res_model">estate.property.offer</field>
    <field name="domain">[('property_type_id','=', active_id)]</field>
    <field name="view_mode">tree,form</field>
    </record>
    </odoo>
    

Kunjungi www.proweb.co.id/implementasi-odoo/ untuk menambah wawasan implementasi Odoo ERP.

Odoo ERP merupakan aplikasi lengkap untuk otomatisasi proses bisnis perusahaan anda.
Jika anda tertarik dengan Odoo ERP silahkan mengisi form di bawah ini