Skip to content

Commit

Permalink
[MERGE][IMP] sale,base,account : improve sales onboarding
Browse files Browse the repository at this point in the history
Purpose : Ease navigation in default screens of Sales app to better onboard new
users and fix various issues in the views.

- onboarding tour : fix "quotations" filter and tooltip appearance
- config bar :
  -remove "Default incoterm" field in "company info" form and move it in
  "invoicing" settings.
  - improve "document layout" form design, set "paper format" as required
  field and add a "preview" button
  - rename FieldReportLayout "Preview" link and put standard report layout (the default one in odoo) as first image
  - fix small design issue in widget
  - "done" button design

- customer form :
  - improve address type tooltip
  - various changes in "accounting" and "sales & purchases" tabs (stat button, fields reorganizing)

- product form : fix "re-invoice policy" field hazardous hiding behavior and improve field appearance
- customer portal :
  - reorganize fields in "customer details" view
  - minor changes in "quotation" view

- Correct "sales order" model description

This merge is related to task ID 1892500 .

closes #28254
  • Loading branch information
robodoo committed Nov 19, 2018
2 parents 76d29d1 + df81f20 commit 2b896bc
Show file tree
Hide file tree
Showing 31 changed files with 77 additions and 80 deletions.
1 change: 0 additions & 1 deletion addons/account/__manifest__.py
Expand Up @@ -59,7 +59,6 @@
'views/account_fiscal_year_view.xml',
'views/account_incoterms_view.xml',
'data/account_incoterms_data.xml',
'views/res_company_view.xml',
'views/digest_views.xml',
'wizard/account_invoice_send_views.xml',
],
Expand Down
1 change: 1 addition & 0 deletions addons/account/models/res_config_settings.py
Expand Up @@ -89,6 +89,7 @@ class ResConfigSettings(models.TransientModel):
qr_code = fields.Boolean(string='Display SEPA QR code', related='company_id.qr_code', readonly=False)
invoice_is_print = fields.Boolean(string='Print', related='company_id.invoice_is_print', readonly=False)
invoice_is_email = fields.Boolean(string='Send Email', related='company_id.invoice_is_email', readonly=False)
incoterm_id = fields.Many2one('account.incoterms', string='Default incoterm', related='company_id.incoterm_id', help='International Commercial Terms are a series of predefined commercial terms used in international transactions.', readonly=False)

@api.multi
def set_values(self):
Expand Down
14 changes: 4 additions & 10 deletions addons/account/views/partner_view.xml
Expand Up @@ -156,7 +156,7 @@
<button name="toggle_active" position="before">
<button class="oe_stat_button" type="action" name="%(account.action_open_partner_analytic_accounts)d"
groups="account.group_account_invoice"
icon="fa-book" title="Analytic Accounts">
icon="fa-book" title="Analytic Accounts" attrs="{'invisible': [('contracts_count', '=', 0)]}">
<field string="Analytic Accounts" name="contracts_count" widget="statinfo"/>
</button>
</button>
Expand Down Expand Up @@ -204,12 +204,6 @@
<field name="acc_holder_name" invisible="1"/>
</tree>
</field>
<button type="action" class="btn-link"
name="%(base.action_res_partner_bank_account_form)d"
context="{'search_default_partner_id': active_id, 'default_partner_id': active_id, 'form_view_ref': 'account.view_company_partner_bank_form'}"
string="View accounts detail"
colspan="2"
/>
</group>
<group string="Accounting Entries" name="accounting_entries" groups="account.group_account_user">
<field name="currency_id" invisible="1"/>
Expand All @@ -224,16 +218,16 @@
</div>
</page>
</page>
<xpath expr="//page[@name='sales_purchases']/group" position="inside">
<xpath expr="//group[@name='misc']" position="before">
<group string="Fiscal Information" name="fiscal_information" priority="5" groups="account.group_account_invoice">
<field name="property_account_position_id" options="{'no_create': True, 'no_open': True}"/>
</group>
</xpath>
<group name="sale" position="inside">
<field string="Payment Terms" name="property_payment_term_id" widget="selection" groups="account.group_account_invoice"/>
<field string="Payment Terms" name="property_payment_term_id" widget="selection" groups="account.group_account_invoice" attrs="{'invisible': [('customer','=', False)]}"/>
</group>
<group name="purchase" position="inside">
<field string="Payment Terms" name="property_supplier_payment_term_id" widget="selection" groups="account.group_account_invoice"/>
<field string="Payment Terms" name="property_supplier_payment_term_id" widget="selection" groups="account.group_account_invoice" attrs="{'invisible': [('supplier','=', False)]}"/>
</group>
</field>
</record>
Expand Down
15 changes: 0 additions & 15 deletions addons/account/views/res_company_view.xml

This file was deleted.

12 changes: 12 additions & 0 deletions addons/account/views/res_config_settings_views.xml
Expand Up @@ -524,6 +524,18 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<span class="o_form_label">Default Incoterm</span>
<div class="text-muted">
Default Incoterm of your company
</div>
<div class="text-muted">
<field name="incoterm_id"/>
</div>
</div>
</div>
</div>
<h2 groups="account.group_account_user">Automated Entries</h2>
<div class="row mt16 o_settings_container" id="recommended_apps" groups="account.group_account_user">
Expand Down
2 changes: 1 addition & 1 deletion addons/delivery/models/partner.py
Expand Up @@ -7,4 +7,4 @@
class ResPartner(models.Model):
_inherit = 'res.partner'

property_delivery_carrier_id = fields.Many2one('delivery.carrier', company_dependent=True, string="Delivery Method", help="This delivery method will be used when invoicing from picking.")
property_delivery_carrier_id = fields.Many2one('delivery.carrier', company_dependent=True, string="Delivery Method", help="Default delivery method used in sales orders.")
8 changes: 4 additions & 4 deletions addons/delivery/views/partner_view.xml
Expand Up @@ -4,11 +4,11 @@
<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.carrier.property.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="mail.res_partner_view_form_inherit_mail" />
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="message_bounce" position="before">
<field name="property_delivery_carrier_id"/>
</field>
<xpath expr="//page[@name='sales_purchases']//field[@name='user_id']" position="after">
<field name="property_delivery_carrier_id" attrs="{'invisible': [('customer','=', False)]}"/>
</xpath>
</field>
</record>

Expand Down
11 changes: 9 additions & 2 deletions addons/mail/views/res_partner_views.xml
Expand Up @@ -16,8 +16,15 @@
<field name="email" widget="email"/>
</div>
</xpath>
<xpath expr="//page[@name='sales_purchases']//field[@name='user_id']" position="after">
<field name="message_bounce" groups="base.group_no_one"/>
<xpath expr="//button[@name='toggle_active']" position="before">
<button class="oe_stat_button" icon="fa-envelope" groups="base.group_no_one" attrs="{'invisible':[('message_bounce', '=', 0)]}">
<div class="o_form_field o_stat_info">
<span class="o_stat_value">
<field name="message_bounce" widget="statinfo" nolabel="1"/>
</span>
<span class="o_stat_text">Bounce(s)</span>
</div>
</button>
</xpath>
<xpath expr="//sheet" position="after">
<div class="oe_chatter">
Expand Down
Expand Up @@ -33,7 +33,7 @@
<field name="payment_method" widget="radio" nolabel="1"/>
</group>
</div>
<div class="col offset-md-1" name="right-column">
<div class="col" name="right-column">
<div attrs="{'invisible': [('payment_method', '!=', 'paypal')]}">
<group>
<field name="paypal_email_account" attrs="{'required': [('payment_method', '=', 'paypal')]}" />
Expand Down
Expand Up @@ -30,7 +30,7 @@ class PaymentWizard(models.TransientModel):

@api.onchange('journal_name', 'acc_number')
def _set_manual_post_msg_value(self):
self.manual_post_msg = _('Please make a payment to <ul><li>Bank: %s</li><li>Account Number: %s</li><li>Account Holder: %s</li></ul>') %\
self.manual_post_msg = _('<h3>Please make a payment to: </h3><ul><li>Bank: %s</li><li>Account Number: %s</li><li>Account Holder: %s</li></ul>') %\
(self.journal_name or _("Bank") , self.acc_number or _("Account"), self.env.user.company_id.name)

_payment_acquirer_onboarding_cache = {}
Expand Down
2 changes: 1 addition & 1 deletion addons/point_of_sale/views/product_view.xml
Expand Up @@ -54,7 +54,7 @@
<field name="arch" type="xml">
<xpath expr="//group[@name='pricelists']" position="before">
<group name="pos" string="Point Of Sale">
<group>
<group colspan="2">
<field name="available_in_pos"/>
<field name="pos_categ_id" attrs="{'invisible': [('available_in_pos', '=', False)]}" string="Category"/>
<field name="to_weight" attrs="{'invisible': [('available_in_pos', '=', False)]}"/>
Expand Down
1 change: 0 additions & 1 deletion addons/portal/static/src/scss/portal.scss
Expand Up @@ -363,7 +363,6 @@ img.o_we_custom_image {

address {
span[itemprop="name"] {
font-weight: bold;
margin-bottom: 0.3em;
}

Expand Down
8 changes: 4 additions & 4 deletions addons/portal/views/portal_templates.xml
Expand Up @@ -370,10 +370,6 @@
<label class="col-form-label" for="email">Email</label>
<input type="email" name="email" t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}" t-att-value="email or partner.email" />
</div>
<div t-attf-class="form-group #{error.get('phone') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="phone">Phone</label>
<input type="tel" name="phone" t-attf-class="form-control #{error.get('phone') and 'is-invalid' or ''}" t-att-value="phone or partner.phone" />
</div>

<div class="clearfix" />
<div t-attf-class="form-group #{error.get('company_name') and 'o_has_error' or ''} col-xl-6">
Expand All @@ -385,6 +381,10 @@
<label class="col-form-label label-optional" for="vat">VAT Number</label>
<input type="text" name="vat" t-attf-class="form-control #{error.get('vat') and 'is-invalid' or ''}" t-att-value="vat or partner.vat" t-att-readonly="None if partner.can_edit_vat() else '1'" t-att-title="None if partner.can_edit_vat() else 'Changing VAT number is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.'" />
</div>
<div t-attf-class="form-group #{error.get('phone') and 'o_has_error' or ''} col-xl-6">
<label class="col-form-label" for="phone">Phone</label>
<input type="tel" name="phone" t-attf-class="form-control #{error.get('phone') and 'is-invalid' or ''}" t-att-value="phone or partner.phone" />
</div>

<div class="clearfix" />
<div t-attf-class="form-group #{error.get('street') and 'o_has_error' or ''} col-xl-6">
Expand Down
2 changes: 1 addition & 1 deletion addons/sale/controllers/portal.py
Expand Up @@ -198,7 +198,7 @@ def portal_quote_accept(self, res_id, access_token=None, partner_name=None, sign
return {'error': _('Invalid order')}

if not order_sudo.has_to_be_signed():
return {'error': _('Order is not in a state requiring customer signature.')}
return {'error': _('The order is not in a state requiring customer signature.')}
if not signature:
return {'error': _('Signature is missing.')}

Expand Down
1 change: 1 addition & 0 deletions addons/sale/data/mail_data.xml
Expand Up @@ -84,6 +84,7 @@
% if object.partner_id.parent_id:
(${object.partner_id.parent_id.name})
% endif
,
<br /><br />
Here is
% if ctx.get('proforma')
Expand Down
3 changes: 2 additions & 1 deletion addons/sale/models/product_template.py
Expand Up @@ -19,7 +19,7 @@ class ProductTemplate(models.Model):
sale_line_warn_msg = fields.Text('Message for Sales Order Line')
expense_policy = fields.Selection(
[('no', 'No'), ('cost', 'At cost'), ('sales_price', 'Sales price')],
string='Re-Invoice Policy',
string='Re-Invoice Expenses',
default='no',
help="Expenses and vendor bills can be re-invoiced to a customer."
"With this option, a validated expense can be re-invoice to a customer at its cost or sales price.")
Expand All @@ -33,6 +33,7 @@ class ProductTemplate(models.Model):
default='order')

@api.multi
@api.depends('name')
def _compute_hide_expense_policy(self):
hide_expense_policy = self.user_has_groups('!analytic.group_analytic_accounting,!project.group_project_user,!hr_expense.group_hr_expense_user')
for template in self:
Expand Down
2 changes: 1 addition & 1 deletion addons/sale/models/sale.py
Expand Up @@ -20,7 +20,7 @@
class SaleOrder(models.Model):
_name = "sale.order"
_inherit = ['portal.mixin', 'mail.thread', 'mail.activity.mixin']
_description = "Sale Order"
_description = "Sales Order"
_order = 'date_order desc, id desc'

def _default_validity_date(self):
Expand Down
2 changes: 1 addition & 1 deletion addons/sale/static/src/js/tour.js
Expand Up @@ -67,7 +67,7 @@ tour.register('sale_tour', {
}, {
trigger: ".o_sale_print",
extra_trigger: ".o_sale_order.o_form_readonly",
content: _t("<b>Print this quotation to preview it.</b>"),
content: _t("Print this quotation to preview it."),
position: "bottom"
}, {
trigger: ".breadcrumb-item:not(.active):last",
Expand Down
7 changes: 5 additions & 2 deletions addons/sale/views/sale_onboarding_views.xml
Expand Up @@ -61,7 +61,7 @@
</field>
</record>
<record id="action_open_sale_onboarding_payment_acquirer_wizard" model="ir.actions.act_window">
<field name="name">How your customers can confirm an order</field>
<field name="name">Choose how to confirm quotations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.payment.acquirer.onboarding.wizard</field>
<field name="view_type">form</field>
Expand All @@ -77,6 +77,9 @@
<field name="mode">primary</field>
<field name="priority">1000</field>
<field name="arch" type="xml">
<xpath expr="//button[@special='save']" position="after">
<button string="Preview" type="action" class="btn btn-secondary" name="web.action_report_externalpreview"/>
</xpath>
<xpath expr="//button[@special='save']" position="replace">
<button string="Apply" class="btn btn-primary" type="object" name="action_save_onboarding_quotation_layout" />
</xpath>
Expand Down Expand Up @@ -112,7 +115,7 @@
</record>

<record id="action_open_sale_onboarding_sample_quotation" model="ir.actions.act_window">
<field name="name">Send a sample quotation.</field>
<field name="name">Send a sample quotation</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mail.compose.message</field>
<field name="view_mode">form</field>
Expand Down
11 changes: 3 additions & 8 deletions addons/sale/views/sale_portal_templates.xml
Expand Up @@ -305,11 +305,6 @@
<strong>This quotation has been canceled.</strong> <a role="button" href="#discussion"><i class="fa fa-comment"/> Contact us to get a new quotation.</a>
</div>

<div t-if="sale_order.state == 'draft'" class="alert alert-warning alert-dismissable d-print-none" role="status">
<button type="button" class="close" data-dismiss="alert" aria-label="close">&amp;times;</button>
<strong>This is a draft quotation.</strong> <a role="button" href="#discussion"><i class="fa fa-comment"/> Contact us to get the final version.</a>
</div>

<div t-if="sale_order.is_expired" class="alert alert-warning alert-dismissable d-print-none" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="close">&amp;times;</button>
<strong>This offer expired!</strong> <a role="button" href="#discussion"><i class="fa fa-comment"/> Contact us to get a new quotation.</a>
Expand Down Expand Up @@ -343,7 +338,7 @@

<!-- chatter -->
<div id="sale_order_communication" class="mt-4">
<h2>Communication</h2>
<h2>History</h2>
<t t-call="portal.message_thread">
<t t-set="object" t-value="sale_order"/>
</t>
Expand All @@ -361,8 +356,8 @@
<template id="sale_order_portal_content" name="Sales Order Portal Content">
<!-- Intro -->
<div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}">
<h2 class="my-0">
<span t-field="sale_order.type_name"></span>
<h2 class="my-0">
<t t-esc="sale_order.type_name"/>
<em t-esc="sale_order.name"/>
</h2>
</div>
Expand Down
2 changes: 1 addition & 1 deletion addons/sale/wizard/payment_acquirer_onboarding_wizard.py
Expand Up @@ -15,7 +15,7 @@ def _get_default_payment_method(self):
return self.env.user.company_id.sale_onboarding_payment_method or 'digital_signature'

payment_method = fields.Selection([
('digital_signature', 'Sign online'),
('digital_signature', 'Online signature'),
('paypal', "Pay with PayPal"),
('stripe', "Pay with credit card (via Stripe)"),
('other', "Pay with another payment acquirer"),
Expand Down
2 changes: 1 addition & 1 deletion addons/stock/views/res_partner_views.xml
Expand Up @@ -12,7 +12,7 @@
<field name="arch" type="xml">
<xpath expr="//page[@name='sales_purchases']/group" position="inside">
<group name="container_row_stock" groups="base.group_no_one" priority="6">
<group string="Warehouse" name="warehouse">
<group string="Inventory" name="inventory" colspan="2">
<field name="property_stock_customer" domain="[('usage','=','customer')]"/>
<field name="property_stock_supplier" domain="[('usage','=','supplier')]"/>
</group>
Expand Down
10 changes: 5 additions & 5 deletions addons/web/data/report_layout.xml
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="report_layout_standard" model="report.layout">
<field name="view_id" ref="web.external_layout_standard"/>
<field name="image">/web/static/img/preview_standard.png</field>
<field name="pdf">/web/static/pdf/preview_standard.pdf</field>
</record>
<record id="report_layout_background" model="report.layout">
<field name="view_id" ref="web.external_layout_background"/>
<field name="image">/web/static/img/preview_background.png</field>
Expand All @@ -16,10 +21,5 @@
<field name="image">/web/static/img/preview_clean.png</field>
<field name="pdf">/web/static/pdf/preview_clean.pdf</field>
</record>
<record id="report_layout_standard" model="report.layout">
<field name="view_id" ref="web.external_layout_standard"/>
<field name="image">/web/static/img/preview_standard.png</field>
<field name="pdf">/web/static/pdf/preview_standard.pdf</field>
</record>
</data>
</odoo>
2 changes: 1 addition & 1 deletion addons/web/static/src/js/fields/special_fields.js
Expand Up @@ -163,7 +163,7 @@ var FieldReportLayout = relational_fields.FieldMany2One.extend({
$container.append($img);
if (val.pdf) {
var $previewLink = $('<a>')
.text('Preview')
.text('Example')
.attr('href', val.pdf)
.attr('target', '_blank');
$container.append($previewLink);
Expand Down

0 comments on commit 2b896bc

Please sign in to comment.