[IMP] sale,sale_management: fix minor bugs and rename strings

Sales Order report:
- fix Total table alignment (to the right)
- remove misplaced /> characters
- remove page-break before optional products

Sales assets:
- fix duplicate ID preventing assets files from being loaded

My Home:
- fix link to sales orders

Optional Products:
- renamed various strings
- made product_id required to prevent a traceback

PR: none
Task: 1838924, 1876864
This commit is contained in:
Sébastien Theys
2018-08-17 10:40:07 +02:00
parent 3ec6624754
commit 02a73ed62c
10 changed files with 50 additions and 59 deletions
-1
View File
@@ -38,7 +38,6 @@ This module contains all the common features of Sales Management and eCommerce.
'data/product_product_demo.xml',
],
'uninstall_hook': "uninstall_hook",
'css': ['static/src/css/sale.css'],
'installable': True,
'auto_install': False,
}
+2 -2
View File
@@ -66,7 +66,7 @@
<!-- Is there a discount on at least one line? -->
<t t-set="display_discount" t-value="any([l.discount for l in doc.order_line])"/>
/>
<table class="table table-sm">
<thead>
<tr>
@@ -153,7 +153,7 @@
<div class="clearfix">
<div class="row" name="total">
<div class="col-4 float-right">
<div class="col-4 ml-auto">
<table class="table table-sm" style="min-width: 200px;max-width: 350px;">
<tr class="border-black" style="border-bottom:1px solid #dddddd;">
<td><strong>Subtotal</strong></td>
+11 -9
View File
@@ -1,18 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" inherit_id="sales_team.assets_backend" name="Sale backend assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/sale/static/src/js/sale.js"></script>
</xpath>
</template>
<template id="assets_backend_onboarding" name="onboarding_assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<template id="assets_backend_inherit_sale" inherit_id="web.assets_backend" name="Sale backend assets">
<xpath expr="link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/sale/static/src/scss/sale_onboarding.scss"/>
</xpath>
<xpath expr="script[last()]" position="after">
<script type="text/javascript" src="/sale/static/src/js/sale.js"></script>
<script type="text/javascript" src="/sale/static/src/js/tour.js"></script>
</xpath>
</template>
<template id="assets_frontend" inherit_id="web.assets_frontend" name="Sale frontend assets">
<xpath expr="." position="inside">
<template id="assets_frontend_inherit_sale" inherit_id="web.assets_frontend" name="Sale frontend assets">
<xpath expr="link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/sale/static/src/scss/sale_portal.scss"/>
</xpath>
<xpath expr="script[last()]" position="after">
<script type="text/javascript" src="/sale/static/src/js/sale_portal_sidebar.js"></script>
</xpath>
</template>
</odoo>
+5 -16
View File
@@ -1,18 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_frontend" inherit_id="web.assets_frontend" name="Sale frontend assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/sale/static/src/js/sale_portal_sidebar.js"></script>
</xpath>
</template>
<template id="assets_backend" name="project assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/sale/static/src/js/tour.js"></script>
</xpath>
</template>
<template id="portal_my_home_menu_sale" name="Portal layout : sales menu entries" inherit_id="portal.portal_layout" priority="20">
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
<li t-if="page_name == 'quote' or sales_order and sales_order.state in ('sent', 'cancel')" class="breadcrumb-item">
@@ -115,7 +103,7 @@
<t t-foreach="orders" t-as="order">
<tr>
<td>
<a t-attf-href="quotation.get_portal_url()"><t t-esc="order.name"/></a>
<a t-att-href="order.get_portal_url()"><t t-esc="order.name"/></a>
</td>
<td>
<span t-field="order.date_order" t-options="{'widget': 'date'}"/>&amp;nbsp;
@@ -568,9 +556,10 @@
<t t-if="current_section and (line_last or sale_order.order_line[line_index+1].display_type == 'line_section')">
<tr class="is-subtotal text-right">
<td t-att-colspan="colspan">
<strong>Subtotal:</strong> <span
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": sale_order.pricelist_id.currency_id}'
<strong>Subtotal:</strong>
<span
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": sale_order.pricelist_id.currency_id}'
/>
</td>
</tr>
+2 -2
View File
@@ -225,12 +225,12 @@ class SaleOrderOption(models.Model):
order_id = fields.Many2one('sale.order', 'Sales Order Reference', ondelete='cascade', index=True)
line_id = fields.Many2one('sale.order.line', on_delete="set null")
name = fields.Text('Description', required=True)
product_id = fields.Many2one('product.product', 'Product', domain=[('sale_ok', '=', True)])
product_id = fields.Many2one('product.product', 'Product', required=True, domain=[('sale_ok', '=', True)])
price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'))
discount = fields.Float('Discount (%)', digits=dp.get_precision('Discount'))
uom_id = fields.Many2one('uom.uom', 'Unit of Measure ', required=True)
quantity = fields.Float('Quantity', required=True, digits=dp.get_precision('Product UoS'), default=1)
sequence = fields.Integer('Sequence', help="Gives the sequence order when displaying a list of suggested product.")
sequence = fields.Integer('Sequence', help="Gives the sequence order when displaying a list of optional products.")
@api.onchange('product_id', 'uom_id')
def _onchange_product_id(self):
@@ -23,7 +23,7 @@ class SaleOrderTemplate(models.Model):
name = fields.Char('Quotation Template', required=True)
sale_order_template_line_ids = fields.One2many('sale.order.template.line', 'sale_order_template_id', 'Lines', copy=True)
note = fields.Text('Terms and conditions')
sale_order_template_option_ids = fields.One2many('sale.order.template.option', 'sale_order_template_id', 'Optional Lines', copy=True)
sale_order_template_option_ids = fields.One2many('sale.order.template.option', 'sale_order_template_id', 'Optional Products', copy=True)
number_of_days = fields.Integer('Quotation Duration',
help='Number of days for the validity date computation of the quotation')
require_signature = fields.Boolean('Online Signature', default=_get_default_require_signature, help='Request a online signature to the customer in order to confirm orders automatically.')
@@ -2,9 +2,9 @@
<odoo>
<template id="report_saleorder_validity_date" inherit_id="sale.report_saleorder_document">
<xpath expr="//div[hasclass('page')]/p[@id='fiscal_position_remark']" position="after">
<div t-if="doc.sale_order_option_ids and doc.state in ['draft', 'sent']" style="page-break-before:always;">
<div t-if="doc.sale_order_option_ids and doc.state in ['draft', 'sent']">
<h2>
<span>Suggested Products</span>
<span>Optional Products</span>
</h2>
<table class="table table-sm">
<thead>
@@ -15,7 +15,7 @@
<div class="o_setting_right_pane">
<label for="group_sale_order_template"/>
<div class="text-muted">
Create standardized offers
Create standardized offers with default products
</div>
<div class="content-group" attrs="{'invisible': [('group_sale_order_template', '=', False)]}">
<div class="mt16">
@@ -48,16 +48,10 @@
<field name="display_type" invisible="1"/>
<group attrs="{'invisible': [('display_type', '!=', False)]}">
<group>
<field
name="product_id"
attrs="{
'required': [('display_type', '=', False)]
}"
/>
<field name="product_id" attrs="{'required': [('display_type', '=', False)]}"/>
<label for="product_uom_qty"/>
<div>
<field
name="product_uom_qty" class="oe_inline"/>
<field name="product_uom_qty" class="oe_inline"/>
</div>
<field name="price_unit" invisible="1"/>
<label for="discount" groups="sale.group_discount_per_so_line"/>
@@ -93,9 +87,7 @@
<field
name="product_uom_id"
groups="uom.group_uom"
attrs="{
'required': [('display_type', '=', False)]
}"
attrs="{'required': [('display_type', '=', False)]}"
/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="price_unit" invisible="1"/>
@@ -5,45 +5,54 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//header/button[@name='action_confirm'][1]" position="after">
<button name="preview_sale_order" type="object" string="Preview"/>
</xpath>
<xpath expr="//page/field[@name='order_line']/.." position="after">
<page string="Optional Products">
<field name="sale_order_option_ids">
<tree string="Sales Quotation Template Lines" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="product_id"/>
<field name="name"/>
<field name="quantity"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="price_unit"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<button name="button_add_to_order" class="oe_link" icon="fa-shopping-cart" string="Add to order lines" type="object"/>
<control>
<create string="Add a product"/>
</control>
<field name="sequence" widget="handle"/>
<field name="product_id"/>
<field name="name"/>
<field name="quantity"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="price_unit"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<button name="button_add_to_order" class="oe_link" icon="fa-shopping-cart" string="Add to order lines" type="object"/>
</tree>
</field>
</page>
</xpath>
<xpath expr="//field[@name='partner_shipping_id']" position="after">
<field name="sale_order_template_id" context="{'company_id': company_id}"
options="{'no_create': True, 'no_open': True}"
groups="sale_management.group_sale_order_template"
/>
</xpath>
<xpath expr="//field[@name='client_order_ref']" position="after">
<field name="require_signature" attrs="{'invisible': [('sale_order_template_id', '=', False)]}"/>
<field name="require_payment" attrs="{'invisible': [('sale_order_template_id', '=', False)]}"/>
</xpath>
</field>
</record>
<record id="sale.action_quotations" model="ir.actions.act_window">
<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>
<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>
</odoo>
</odoo>