<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>

        <record id="sale_order_template_view_form_inherit" model="ir.ui.view">
            <field name="name">sale.order.template.form</field>
            <field name="model">sale.order.template</field>
            <field name="inherit_id" ref="sale_management.sale_order_template_view_form" />
            <field name="arch" type="xml">

                <xpath expr="//field[@name='name']" position="attributes">
                    <attribute name="placeholder">Proposal Template</attribute>
                </xpath>

                <xpath expr="//label[@for='name']" position="attributes">
                    <attribute name="string">Proposal Template</attribute>
                </xpath>


                <xpath expr="//page[@name='optional_products']" position="before">
                    <page name="mhrs_estimate" string="Mhrs Estimate">
                        <field name="sale_department_template_line_ids" widget="section_and_note_one2many">
                            <tree string="Mhrs Estimate" editable="bottom">
                                <control>
                                    <create name="add_department_control" string="Add a mhrs estimate"/>
                                    <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="display_type" invisible="1"/>
                                <field name="department_id" attrs="{'required': [('display_type', '=', False)]}"/>
                                <field name="name" widget="section_and_note_text"/>
                                <field name="no_sheet" required="1"/>
                                <field name="hrs_sheet" required="1" />
                                <field name="cairo_hrs" required="1" />
                                <field name="ksa_hrs" required="1"/>
                            </tree>
                        </field>
                    </page>

                    <page name="manpower" string="Manpower">
                        <field name="sale_job_template_line_ids" widget="section_and_note_one2many">
                            <tree editable="bottom">
                                <control>
                                    <create name="add_manpower_control" string="Add a manpower"/>
                                    <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="job_id" attrs="{'required': [('display_type', '=', False)]}"/>
                                <field name="name" widget="section_and_note_text"/>
                                <field name="no_year_experience"/>
                                <field name="qty" required="1" />
                                <field name="duration" required="1" />
                                <field name="month_rate" required="1" />
                                <field name="display_type" invisible="1"/>
                            </tree>
                        </field>
                    </page>

                </xpath>
            </field>
        </record>

        <record id="sale_management.sale_order_template_action" model="ir.actions.act_window">
            <field name="name">Proposal Templates</field>
        </record>

        <record id="sale_management.sale_order_template_menu" model="ir.ui.menu">
            <field name="name">Proposal Templates</field>
        </record>

    </data>
</odoo>