[IMP] sale: xml cleanup

* indentation
* avoid xpath expressions when the targeted element can be specified 
cleanly
* other minor cleanups & todos
This commit is contained in:
Victor Feyens
2022-01-03 12:22:47 +01:00
parent f1e60818b1
commit decd2b5093
8 changed files with 123 additions and 101 deletions
+3 -3
View File
@@ -6,9 +6,9 @@
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_account_invoice_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_user_id']" position="after">
<field name="invoice_user_id" position="after">
<field name="team_id"/>
</xpath>
</field>
<xpath expr="//group/filter[@name='status']" position="after">
<filter string="Sales Team" name="sales_channel" domain="[]" context="{'group_by':'team_id'}"/>
</xpath>
@@ -91,4 +91,4 @@
<field name="act_window_id" ref="sale.action_invoice_salesteams"/>
</record>
</odoo>
</odoo>
+6 -6
View File
@@ -22,18 +22,18 @@
<field name="priority">9</field>
<field name="inherit_id" ref="sales_team.crm_team_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='options_active']" position="inside">
<div name="options_active" position="inside">
<div class="o_row" style="display:inherit">
<field name="use_quotations"/><label for="use_quotations"/>
</div>
</xpath>
<xpath expr="//field[@name='company_id']" position="after">
</div>
<field name="company_id" position="after">
<label for="invoiced_target"/>
<div class="o_row">
<field name="invoiced_target" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<span class="oe_read_only">/ Month</span>
</div>
</xpath>
</field>
</field>
</record>
@@ -105,7 +105,7 @@
</div>
</xpath>
<xpath expr="//div[hasclass('o_kanban_manage_reports')]/div[@name='o_team_kanban_report_separator']" position="before">
<div name="o_team_kanban_report_separator" position="before">
<div t-if="record.use_quotations.raw_value">
<a name="%(action_order_report_quotation_salesteam)d" type="action">
Quotations
@@ -121,7 +121,7 @@
Invoices
</a>
</div>
</xpath>
</div>
</data>
</field>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<odoo>
<!-- Activity types config -->
<record id="mail_activity_type_action_config_sale" model="ir.actions.act_window">
<field name="name">Activity Types</field>
<field name="res_model">mail.activity.type</field>
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_packaging_form_view_sale" model="ir.ui.view">
<field name="name">product.packaging.form.view.sale</field>
<field name="model">product.packaging</field>
<field name="inherit_id" ref="product.product_packaging_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='group_product']" position="inside">
<group name="group_product" position="inside">
<field name="sales"/>
</xpath>
</group>
</field>
</record>
@@ -16,9 +17,10 @@
<field name="model">product.packaging</field>
<field name="inherit_id" ref="product.product_packaging_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_uom_id']" position="after">
<field name="product_uom_id" position="after">
<field name="sales" optional="show"/>
</xpath>
</field>
</field>
</record>
</odoo>
+20 -8
View File
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- TODO VFE remove useless view (same change done in view below) -->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.product.website.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='sales']" position="attributes">
<page name="sales" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
</page>
</field>
</record>
<!-- TODO VFE inherit product_template_form_view and factorize both views -->
<record model="ir.ui.view" id="product_form_view_sale_order_button">
<field name="name">product.product.sale.order</field>
<field name="model">product.product</field>
@@ -19,8 +21,13 @@
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" name="action_view_sales"
type="object" icon="fa-signal" groups="sales_team.group_sale_salesman" help="Sold in the last 365 days" attrs="{'invisible': [('sale_ok', '=', False)]}">
<button class="oe_stat_button"
name="action_view_sales"
type="object"
icon="fa-signal"
help="Sold in the last 365 days"
groups="sales_team.group_sale_salesman"
attrs="{'invisible': [('sale_ok', '=', False)]}">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="sales_count" widget="statinfo" nolabel="1" class="mr4"/>
@@ -47,8 +54,12 @@
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" name="action_view_sales"
type="object" icon="fa-signal" groups="sales_team.group_sale_salesman" help="Sold in the last 365 days" attrs="{'invisible': [('sale_ok', '=', False)]}">
<button class="oe_stat_button"
name="action_view_sales"
type="object" icon="fa-signal"
help="Sold in the last 365 days"
groups="sales_team.group_sale_salesman"
attrs="{'invisible': [('sale_ok', '=', False)]}">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="sales_count" widget="statinfo" nolabel="1" class="mr4"/>
@@ -68,6 +79,7 @@
</field>
</record>
<!-- TODO VFE merge both views -->
<record model="ir.ui.view" id="product_template_form_view_invoice_policy">
<field name="name">product.template.invoice.policy</field>
<field name="model">product.template</field>
@@ -90,9 +102,9 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='sale']" position="attributes">
<group name="sale" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
</group>
<field name="product_tooltip" position="after">
<label for="product_tooltip" string="" attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'order')]}"/>
<div attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'order')]}" class="font-italic text-muted">
@@ -8,7 +8,11 @@
<field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block o_not_app" data-string="Sales" string="Sales" data-key="sale_management" groups="sales_team.group_sale_manager">
<div class="app_settings_block o_not_app"
string="Sales"
data-string="Sales"
data-key="sale_management"
groups="sales_team.group_sale_manager">
<h2>Product Catalog</h2>
<div class="row mt16 o_settings_container" name="catalog_setting_container">
<div class="col-12 col-lg-6 o_setting_box" id="variant_options">
+81 -77
View File
@@ -1,87 +1,91 @@
<?xml version="1.0"?>
<odoo>
<record id="act_res_partner_2_sale_order" model="ir.actions.act_window">
<field name="name">Quotations and Sales</field>
<field name="res_model">sale.order</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'search_default_partner_id': active_id, 'default_partner_id': active_id}</field>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new quotation, the first step of a new sale!
</p><p>
Once the quotation is confirmed by the customer, it becomes a sales order.<br/> You will be able to create an invoice and collect the payment.
</p>
</field>
</record>
<!-- Partner kanban view inherte -->
<record model="ir.ui.view" id="crm_lead_partner_kanban_view">
<field name="name">res.partner.kanban.saleorder.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="priority" eval="20"/>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="arch" type="xml">
<field name="mobile" position="after">
<field name="sale_order_count"/>
</field>
<xpath expr="//span[hasclass('oe_kanban_partner_links')]" position="inside">
<span t-if="record.sale_order_count.value>0" class="badge badge-pill"><i class="fa fa-fw fa-usd" role="img" aria-label="Sale orders" title="Sales orders"/><t t-esc="record.sale_order_count.value"/></span>
</xpath>
</field>
</record>
<record id="act_res_partner_2_sale_order" model="ir.actions.act_window">
<field name="name">Quotations and Sales</field>
<field name="res_model">sale.order</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'search_default_partner_id': active_id, 'default_partner_id': active_id}</field>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new quotation, the first step of a new sale!
</p><p>
Once the quotation is confirmed by the customer, it becomes a sales order.<br/> You will be able to create an invoice and collect the payment.
</p>
</field>
</record>
<record id="res_partner_view_buttons" model="ir.ui.view">
<field name="name">res.partner.view.buttons</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="3"/>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" type="action" name="%(sale.act_res_partner_2_sale_order)d"
groups="sales_team.group_sale_salesman"
icon="fa-usd">
<field string="Sales" name="sale_order_count" widget="statinfo"/>
</button>
</div>
<page name="internal_notes" position="inside">
<group colspan="2" col="2" groups="sale.group_warning_sale">
<separator string="Warning on the Sales Order" colspan="4" />
<field name="sale_warn" nolabel="1" />
<field name="sale_warn_msg" colspan="3" nolabel="1"
attrs="{'required':[('sale_warn','!=', False), ('sale_warn','!=','no-message')], 'invisible':[('sale_warn','in',(False,'no-message'))]}"/>
</group>
</page>
<record model="ir.ui.view" id="crm_lead_partner_kanban_view">
<field name="name">res.partner.kanban.saleorder.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="priority" eval="20"/>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="arch" type="xml">
<field name="mobile" position="after">
<field name="sale_order_count"/>
</field>
</record>
<xpath expr="//span[hasclass('oe_kanban_partner_links')]" position="inside">
<span t-if="record.sale_order_count.value>0" class="badge badge-pill">
<i class="fa fa-fw fa-usd" role="img" aria-label="Sale orders" title="Sales orders"/>
<t t-esc="record.sale_order_count.value"/>
</span>
</xpath>
</field>
</record>
<record id="res_partner_view_form_payment_defaultcreditcard" model="ir.ui.view">
<field name="name">res.partner.view.form.payment.defaultcreditcard</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="payment.view_partners_form_payment_defaultcreditcard"/>
<field name="arch" type="xml">
<button name="%(payment.action_payment_token)d" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
<record id="res_partner_view_buttons" model="ir.ui.view">
<field name="name">res.partner.view.buttons</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="3"/>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" type="action" name="%(sale.act_res_partner_2_sale_order)d"
groups="sales_team.group_sale_salesman"
icon="fa-usd">
<field string="Sales" name="sale_order_count" widget="statinfo"/>
</button>
</field>
</record>
<record id="res_partner_view_form_property_inherit" model="ir.ui.view">
<field name="name">res.partner.view.form.property.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.view_partner_property_form"/>
<field name="arch" type="xml">
<group name="fiscal_information" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</div>
<page name="internal_notes" position="inside">
<group colspan="2" col="2" groups="sale.group_warning_sale">
<separator string="Warning on the Sales Order" colspan="4" />
<field name="sale_warn" nolabel="1" />
<field name="sale_warn_msg" colspan="3" nolabel="1"
attrs="{'required':[('sale_warn','!=', False), ('sale_warn','!=','no-message')], 'invisible':[('sale_warn','in',(False,'no-message'))]}"/>
</group>
<field name="property_payment_term_id" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</field>
<field name="property_supplier_payment_term_id" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</field>
</page>
</field>
</record>
<record id="res_partner_view_form_payment_defaultcreditcard" model="ir.ui.view">
<field name="name">res.partner.view.form.payment.defaultcreditcard</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="payment.view_partners_form_payment_defaultcreditcard"/>
<field name="arch" type="xml">
<button name="%(payment.action_payment_token)d" position="attributes">
<attribute name="groups">sales_team.group_sale_salesman</attribute>
</button>
</field>
</record>
<record id="res_partner_view_form_property_inherit" model="ir.ui.view">
<field name="name">res.partner.view.form.property.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.view_partner_property_form"/>
<field name="arch" type="xml">
<group name="fiscal_information" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</group>
<field name="property_payment_term_id" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</field>
</record>
<field name="property_supplier_payment_term_id" position="attributes">
<attribute name="groups">account.group_account_invoice, sales_team.group_sale_salesman</attribute>
</field>
</field>
</record>
</odoo>
+1 -1
View File
@@ -23,7 +23,7 @@
<t t-set="state" t-value="state.get('sale_onboarding_order_confirmation_state')" />
</t>
</template>
<template id="sale_onboarding_sample_quotation_step">
<template id="sale_onboarding_sample_quotation_step">
<t t-call="base.onboarding_step">
<t t-set="title">Sample Quotation</t>
<t t-set="description">Send a quotation to test the customer portal.</t>