=========MENU=========
<record id="action_sales_order" model="ir.actions.act_window"> <field name="name">Sales SO</field> <field name="res_model">sale.order</field> <field name="view_mode">tree,form</field> <field name="view_id" ref="view_sales_so_form"/> <field name="view_ids" eval="[(5, 0, 0), (0, 0, {'view_mode': 'tree', 'view_id': ref('view_sales_so_tree')}), (0, 0, {'view_mode': 'form', 'view_id': ref('view_sales_so_form')})]"/> <field name="domain">[('is_sales_so', '=', True)]</field> <field name="context">{'default_is_sales_so': True}</field> </record>
========FORM========
<record id="view_sales_so_form" model="ir.ui.view"> <field name="name">sales.so.form</field> <field name="model">sale.order</field> <field name="arch" type="xml"> <form string="Sales SO" groups="cust_sale.group_sales_so_user"> <header> <field name="state" widget="statusbar" statusbar_visible="draft,sent,sale"/> <button name="action_confirm" type="object" string="Confirm" states="draft" class="btn-primary"/> <button name="action_cancel" type="object" string="Cancel" states="draft,sent,sale" class="btn-secondary" attrs="{'invisible': [('state', '!=', 'cancel')]}"/> </header> <sheet> <div class="oe_title"> <h1> <field name="name" class="oe_inline" readonly="1"/> </h1> </div> <group col="2"> <group> <field name="company_id" required="1" groups="base.group_multi_company"/> <field name="customer_display_name" string="Customer" readonly="1" attrs="{'invisible': [('id', '=', False)]}"/> <field name="partner_id" required="1" context="{'show_address': True}" attrs="{'invisible': [('id', '!=', False)]}"/> <field name="pricelist_id" readonly="1"/> <field name="product_type" string='SO Type' /> </group> <group> <field name="date_order" options="{'no_open': True}"/> <field name="user_id" /> <field name="team_id" invisible="1"/> <field name="reference_so" attrs="{'invisible': [('is_stock_empty', '=', False), ('state', 'in', ['sale', 'draft', 'cancel'])]}" string="Reference SO"/> <field name="is_stock_empty" invisible="1"/> </group> </group> <notebook> <page string="Order Lines"> <field name="order_line" widget="one2many_list" context="{'default_order_id': active_id}"> <tree string="Sales Order Lines" editable="bottom" > <control> <create name="add_product_control" string="Add a product"/> <create name="add_section_control" string="Add a section" context="{'default_display_type': 'line_section'}"/> <create name="add_note_control" string="Add a note" context="{'default_display_type': 'line_note'}"/> </control>
<field name="sequence" widget="handle" /> <field name="display_type" invisible="1"/> <field name="product_uom_category_id" invisible="1"/>
<field name="product_updatable" invisible="1"/> <field name="product_id" attrs="{ 'readonly': [('product_updatable', '=', False)], 'required': [('display_type', '=', False)], }" force_save="1" context="{ 'partner_id': parent.partner_id, 'quantity': product_uom_qty, 'pricelist': parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id, 'default_lst_price': price_unit, 'default_description_sale': name }" domain="[('sale_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" widget="product_configurator" /> <field name="product_template_id" string="Product" invisible="1" attrs="{ 'readonly': [('product_updatable', '=', False)], 'required': [('display_type', '=', False)], }" context="{ 'partner_id': parent.partner_id, 'quantity': product_uom_qty, 'pricelist': parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id, 'default_list_price': price_unit, 'default_description_sale': name }" domain="[('sale_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" widget="product_configurator"/> <field name="name" widget="section_and_note_text" invisible="1" /> <field name="analytic_tag_ids" optional="hide" groups="analytic.group_analytic_tags" widget="many2many_tags" options="{'color_field': 'color'}" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" /> <field name="product_uom_qty" decoration-info="(not display_type and invoice_status == 'to invoice')" decoration-bf="(not display_type and invoice_status == 'to invoice')" context="{ 'partner_id': parent.partner_id, 'quantity': product_uom_qty, 'pricelist': parent.pricelist_id, 'uom': product_uom, 'company_id': parent.company_id }" /> <field name="qty_delivered" decoration-info="(not display_type and invoice_status == 'to invoice')" decoration-bf="(not display_type and invoice_status == 'to invoice')" string="Delivered" attrs="{ 'column_invisible': [('parent.state', 'not in', ['sale', 'done'])], 'readonly': [('qty_delivered_method', '!=', 'manual')] }" invisible="1" /> <field name="qty_delivered_manual" invisible="1"/> <field name="qty_delivered_method" invisible="1"/> <field name="qty_invoiced" decoration-info="(not display_type and invoice_status == 'to invoice')" decoration-bf="(not display_type and invoice_status == 'to invoice')" string="Invoiced" attrs="{'column_invisible': [('parent.state', 'not in', ['sale', 'done'])]}" invisible="1" /> <field name="qty_to_invoice" invisible="1"/> <field name="product_uom_readonly" invisible="1"/> <field name="product_uom" force_save="1" string="UoM" attrs="{ 'readonly': [('product_uom_readonly', '=', True)], 'required': [('display_type', '=', False)], }" context="{'company_id': parent.company_id}" groups="uom.group_uom" options='{"no_open": True}' optional="show" /> <field name="customer_lead" optional="hide" attrs="{'readonly': [('parent.state', 'not in', ['draft', 'sent', 'sale'])]}" invisible="1" /> <field name="product_packaging_qty" attrs="{'invisible': ['|', ('product_id', '=', False), ('product_packaging_id', '=', False)]}" groups="product.group_stock_packaging" optional="show"/> <field name="product_packaging_id" attrs="{'invisible': [('product_id', '=', False)]}" context="{'default_product_id': product_id, 'tree_view_ref':'product.product_packaging_tree_view', 'form_view_ref':'product.product_packaging_form_view'}" groups="product.group_stock_packaging" optional="show"/> <field name="price_unit" attrs="{'readonly': [('qty_invoiced', '>', 0)]}" invisible="1" /> <field name="discount" string="Disc.%" groups="product.group_discount_per_so_line" optional="show" widget="product_discount"/> <field name="price_subtotal" widget="monetary" groups="account.group_show_line_subtotals_tax_excluded"/> <field name="price_total" widget="monetary" groups="account.group_show_line_subtotals_tax_included"/> <field name="state" invisible="1"/> <field name="invoice_status" invisible="1"/> <field name="currency_id" invisible="1"/> <field name="price_tax" invisible="1"/> <field name="company_id" invisible="1"/> </tree> </field> </page> </notebook> <group name="note_group" col="6" class="mt-2 mt-md-0"> <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total"> <field name="tax_totals_json" widget="account-tax-totals-field" nolabel="1" colspan="2"/> </group> <div class="oe_clear"/> </group> </sheet> </form> </field> </record>
I want to change the default Odoo 15 form in this menu, there is a custom create button that has been created. So if you click the Create custom button, a custom form will appear. but I can't. is there anyone who can help me???