Initialize v18 branch

Rename *_usability modules to *_usability_akretion
This commit is contained in:
Alexis de Lattre
2024-12-24 10:11:21 +01:00
parent 9913924202
commit 13744fc404
264 changed files with 50 additions and 87 deletions

View File

@@ -0,0 +1,73 @@
==============
Sale Usability
==============
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github
:target: https://github.com/akretion/odoo-usability/tree/12.0/sale_usability
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
This modules adds the following functions:
* Display amount untaxed in tree view
* Add sale_ids and sale_count on Invoice
* Methods for py3o sale reports
* Add tracking on partner warning fields
* Add tracking on product fields
* Add tracking on Sale Order fields
* Add menu for Pricelist Items
* Add `has_discount` field on Sale Order
* Restore drill-through on sale and invoice reports
* Move client_order_ref from the second tab to the top
* Protect Cancel button with a confirmation pop-up
* Remove Sale Orders from Quotations menu
* Add Group By Customer on Sales order search view
* Add sum=1 on several quantity fields
* Add Product Category Menu entry
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/akretion/odoo-usability/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/akretion/odoo-usability/issues/new?body=module:%20sale_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Akretion
Contributors
~~~~~~~~~~~~
Alexis de Lattre <alexis.delattre@akretion.com>
Maintainers
~~~~~~~~~~~
This module is part of the `akretion/odoo-usability <https://github.com/akretion/odoo-usability/tree/12.0/sale_usability>`_ project on GitHub.
You are welcome to contribute.

View File

@@ -0,0 +1,2 @@
from . import models
from . import wizards

View File

@@ -0,0 +1,28 @@
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Sale Usability',
'version': '16.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Usability improvements on sale module',
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': [
'sale',
'account_usability_akretion', # for company view
'base_view_inheritance_extension',
],
'data': [
'views/sale_order.xml',
'views/product_category.xml',
'views/sale_report.xml',
'views/product_pricelist_item.xml',
'views/account_move.xml',
'views/res_company.xml',
"views/res_partner.xml",
],
'installable': False,
}

View File

@@ -0,0 +1,281 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-04 16:06+0000\n"
"PO-Revision-Date: 2024-07-04 16:06+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: sale_usability
#: model_terms:ir.ui.view,arch_db:sale_usability.view_order_form
msgid "Are you sure you want to cancel this sale order?"
msgstr "Êtes-vous sûr de vouloir annuler cette commande client ?"
#. module: sale_usability
#: model:ir.model,name:sale_usability.model_res_company
msgid "Companies"
msgstr "Sociétés"
#. module: sale_usability
#: model:ir.model,name:sale_usability.model_res_partner
msgid "Contact"
msgstr ""
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_invoice_discount_all_lines__create_uid
msgid "Created by"
msgstr "Créé par"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_invoice_discount_all_lines__create_date
msgid "Created on"
msgstr "Créé le"
#. module: sale_usability
#: model:ir.model.fields,help:sale_usability.field_sale_order__date_order
msgid ""
"Creation date of draft/sent orders,\n"
"Confirmation date of confirmed orders."
msgstr ""
"Date de création des commandes à l'état brouillon/envoyés.\n"
"Date de confirmation des commandes confirmées."
#. module: sale_usability
#: model_terms:ir.ui.view,arch_db:sale_usability.view_sales_order_line_filter
msgid "Customer"
msgstr "Client"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__client_order_ref
msgid "Customer Reference"
msgstr "Référence client"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__partner_shipping_id
msgid "Delivery Address"
msgstr "Adresse de livraison"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_invoice_discount_all_lines__display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: sale_usability
#: model:ir.model.fields,help:sale_usability.field_product_product__expense_policy
#: model:ir.model.fields,help:sale_usability.field_product_template__expense_policy
msgid ""
"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."
msgstr ""
"Les notes de frais et les factures fournisseurs peuvent être refacturées à "
"un client. Avec cette option, une dépense validée peut être refacturée au "
"client à son coût ou à son prix de vente."
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__fiscal_position_id
msgid "Fiscal Position"
msgstr "Position fiscale"
#. module: sale_usability
#: model:ir.model.fields,help:sale_usability.field_sale_order__fiscal_position_id
msgid ""
"Fiscal positions are used to adapt taxes and accounts for particular "
"customers or sales orders/invoices.The default value comes from the "
"customer."
msgstr ""
"Les positions fiscales sont utilisées pour adapter les taxes et les comptes "
"comptables pour un client spécifique ou pour une commande/facture. La valeur"
" par défaut sera celle renseignée sur le client."
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__has_attachment
msgid "Has Attachment"
msgstr "Possède une pièce jointe"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__has_discount
msgid "Has Discount"
msgstr "A une remise"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_invoice_discount_all_lines__id
msgid "ID"
msgstr ""
#. module: sale_usability
#: model:ir.model.fields,help:sale_usability.field_sale_order_line__product_barcode
msgid "International Article Number used for product identification."
msgstr "Numéro d'article international utilisé pour identifier ce produit."
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__partner_invoice_id
msgid "Invoice Address"
msgstr "Adresse de facturation"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_product_product__invoice_policy
#: model:ir.model.fields,field_description:sale_usability.field_product_template__invoice_policy
msgid "Invoicing Policy"
msgstr "Politique de facturation"
#. module: sale_usability
#: model:ir.model,name:sale_usability.model_account_move
msgid "Journal Entry"
msgstr "Pièce comptable"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_invoice_discount_all_lines____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_invoice_discount_all_lines__write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_invoice_discount_all_lines__write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_res_company__static_sale_terms
msgid "Legal Terms on Quotation"
msgstr "Mentions légales figurant sur les devis"
#. module: sale_usability
#: model:ir.model.fields,help:sale_usability.field_product_product__service_type
#: model:ir.model.fields,help:sale_usability.field_product_template__service_type
msgid ""
"Manually set quantities on order: Invoice based on the manually entered quantity, without creating an analytic account.\n"
"Timesheets on contract: Invoice based on the tracked hours on the related timesheet.\n"
"Create a task and track hours: Create a task on the sales order validation and track the work hours."
msgstr ""
"Définition manuelle des quantités sur la commande : facture selon les quantités saisies manuellement, sans création de compte analytique.\n"
" Feuilles de temps sur les contrats : facture selon les heures passées en fonction de la feuille de temps liée.\n"
" Créer une tâche et suivre les heures : crée une tâche à validation de la commande et effectue un suivi du temps passé."
#. module: sale_usability
#: model_terms:ir.ui.view,arch_db:sale_usability.view_sales_order_filter
msgid "Missing Attachment"
msgstr "Pièce jointe manquante"
#. module: sale_usability
#: model:ir.model,name:sale_usability.model_sale_invoice_discount_all_lines
msgid "None"
msgstr "Aucune"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__date_order
msgid "Order Date"
msgstr "Date de la commande"
#. module: sale_usability
#: model:ir.model.fields,help:sale_usability.field_product_product__invoice_policy
#: model:ir.model.fields,help:sale_usability.field_product_template__invoice_policy
msgid ""
"Ordered Quantity: Invoice quantities ordered by the customer.\n"
"Delivered Quantity: Invoice quantities delivered to the customer."
msgstr ""
"Quantité commandée : facture les quantités commandées par le client.\n"
"Quantité livrée : facture les quantités livrées au client."
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__payment_term_id
msgid "Payment Terms"
msgstr "Conditions de paiement"
#. module: sale_usability
#: model:ir.actions.act_window,name:sale_usability.product_pricelist_item_action
#: model:ir.ui.menu,name:sale_usability.product_pricelist_item_menu
msgid "Price Rules"
msgstr "Règles des listes de prix"
#. module: sale_usability
#: model_terms:ir.ui.view,arch_db:sale_usability.view_order_form
msgid "Print"
msgstr "Imprimer"
#. module: sale_usability
#: model:ir.model,name:sale_usability.model_product_template
msgid "Product"
msgstr "Produit"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order_line__product_barcode
msgid "Product Barcode"
msgstr "Code barre du produit"
#. module: sale_usability
#: model:ir.ui.menu,name:sale_usability.product_category_sale_menu
msgid "Product Categories"
msgstr "Catégories de produit"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_product_product__expense_policy
#: model:ir.model.fields,field_description:sale_usability.field_product_template__expense_policy
msgid "Re-Invoice Expenses"
msgstr "Re-facturer les notes de frais"
#. module: sale_usability
#: model:ir.model,name:sale_usability.model_sale_order
msgid "Sales Order"
msgstr "Bon de commande"
#. module: sale_usability
#: model:ir.model,name:sale_usability.model_sale_order_line
#: model:ir.model.fields,field_description:sale_usability.field_product_product__sale_line_warn
#: model:ir.model.fields,field_description:sale_usability.field_product_template__sale_line_warn
msgid "Sales Order Line"
msgstr "Ligne de commande"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_res_partner__sale_warn
#: model:ir.model.fields,field_description:sale_usability.field_res_users__sale_warn
msgid "Sales Warnings"
msgstr "Avertissements de vente"
#. module: sale_usability
#: model:ir.model.fields,help:sale_usability.field_product_product__sale_line_warn
#: model:ir.model.fields,help:sale_usability.field_product_template__sale_line_warn
#: model:ir.model.fields,help:sale_usability.field_res_partner__sale_warn
#: model:ir.model.fields,help:sale_usability.field_res_users__sale_warn
msgid ""
"Selecting the \"Warning\" option will notify user with the message, "
"Selecting \"Blocking Message\" will throw an exception with the message and "
"block the flow. The Message has to be written in the next field."
msgstr ""
"Sélectionner l'option 'Avertissement' affichera le message à l'utilisateur. "
"Sélectionner 'Message Bloquant' lancera une exception avec le message et "
"bloquera le flux. Le message doit être écrit dans le champ suivant."
#. module: sale_usability
#: model_terms:ir.ui.view,arch_db:sale_usability.view_order_form
msgid "Send Order Acknowledgement"
msgstr "Envoyer une confirmation de commande"
#. module: sale_usability
#: model_terms:ir.ui.view,arch_db:sale_usability.view_sales_order_filter
msgid "State"
msgstr "État"
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_sale_order__amount_tax
msgid "Taxes"
msgstr ""
#. module: sale_usability
#: model:ir.model.fields,field_description:sale_usability.field_product_product__service_type
#: model:ir.model.fields,field_description:sale_usability.field_product_template__service_type
msgid "Track Service"
msgstr "Suivre le service"

View File

@@ -0,0 +1,5 @@
from . import sale_order
from . import account_move
from . import product_template
from . import res_partner
from . import res_company

View File

@@ -0,0 +1,52 @@
# Copyright 2015-2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from collections import OrderedDict
class AccountMove(models.Model):
_inherit = 'account.move'
def py3o_lines_layout_groupby_order(self, subtotal=True):
# This method is an alternative to the method py3o_lines_layout()
# defined above: you just have to change the call in the invoice
# ODT template
self.ensure_one()
res1 = OrderedDict()
# {categ(1): {'lines': [l1, l2], 'subtotal': 23.32}}
soo = self.env['sale.order']
for line in self.invoice_line_ids:
order = not line.display_type and line.sale_line_ids and\
line.sale_line_ids[0].order_id or soo
if order in res1:
res1[order]['lines'].append(line)
res1[order]['subtotal'] += line.price_subtotal
else:
res1[order] = {
'lines': [line],
'subtotal': line.price_subtotal}
# from pprint import pprint
# pprint(res1)
res2 = []
if len(res1) == 1 and not list(res1)[0]:
# No order at all
for line in list(res1.values())[0]['lines']:
res2.append({'line': line})
else:
for order, ldict in res1.items():
res2.append({'categ': order})
for line in ldict['lines']:
res2.append({'line': line})
if subtotal:
res2.append({'subtotal': ldict['subtotal']})
# res2:
# [
# {'categ': categ(1)},
# {'line': invoice_line(2)},
# {'line': invoice_line(3)},
# {'subtotal': 8932.23},
# ]
# pprint(res2)
return res2

View File

@@ -0,0 +1,15 @@
# Copyright 2017-2022 Akretion France
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
service_type = fields.Selection(tracking=True)
expense_policy = fields.Selection(tracking=True)
invoice_policy = fields.Selection(tracking=True)
sale_line_warn = fields.Selection(tracking=True)
expense_policy = fields.Selection(tracking=True)

View File

@@ -0,0 +1,13 @@
# Copyright 2021-2022 Akretion France (https://akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
# Similar to the field static_invoice_terms in account_usability
static_sale_terms = fields.Text(
translate=True, string="Legal Terms on Quotation")

View File

@@ -0,0 +1,11 @@
# Copyright 2017-2022 Akretion France (https://akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
sale_warn = fields.Selection(tracking=True)

View File

@@ -0,0 +1,135 @@
# Copyright (C) 2015-2020 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.tools import float_is_zero
class SaleOrder(models.Model):
_inherit = 'sale.order'
date_order = fields.Datetime(tracking=True)
client_order_ref = fields.Char(tracking=True)
# for partner_id, the 'sale' module sets track_visibility='always'
amount_tax = fields.Monetary(tracking=True)
partner_shipping_id = fields.Many2one(tracking=True)
partner_invoice_id = fields.Many2one(tracking=True)
payment_term_id = fields.Many2one(tracking=True)
fiscal_position_id = fields.Many2one(tracking=True)
# for reports
has_discount = fields.Boolean(compute='_compute_has_discount')
has_attachment = fields.Boolean(
compute='_compute_has_attachment',
search='_search_has_attachment')
@api.depends('order_line.discount')
def _compute_has_discount(self):
prec = self.env['decimal.precision'].precision_get('Discount')
for order in self:
has_discount = False
for line in order.order_line:
if not line.display_type and not float_is_zero(
line.discount, precision_digits=prec):
has_discount = True
break
order.has_discount = has_discount
def _compute_has_attachment(self):
iao = self.env['ir.attachment']
for order in self:
if iao.search_count([
('res_model', '=', 'sale.order'),
('res_id', '=', order.id),
('type', '=', 'binary'),
('company_id', '=', order.company_id.id)]):
order.has_attachment = True
else:
order.has_attachment = False
def _search_has_attachment(self, operator, value):
att_order_ids = {}
if operator == '=':
search_res = self.env['ir.attachment'].search_read([
('res_model', '=', 'sale.order'),
('type', '=', 'binary'),
('res_id', '!=', False)], ['res_id'])
for att in search_res:
att_order_ids[att['res_id']] = True
res = [('id', value and 'in' or 'not in', list(att_order_ids))]
return res
# for report
def py3o_lines_layout(self):
self.ensure_one()
res = []
has_sections = False
subtotal = 0.0
for line in self.order_line:
if line.display_type == 'line_section':
# insert line
if has_sections:
res.append({'subtotal': subtotal})
subtotal = 0.0 # reset counter
has_sections = True
elif not line.display_type:
subtotal += line.price_subtotal
res.append({'line': line})
if has_sections: # insert last subtotal line
res.append({'subtotal': subtotal})
# res:
# [
# {'line': sale_order_line(1) with display_type=='line_section'},
# {'line': sale_order_line(2) without display_type},
# {'line': sale_order_line(3) without display_type},
# {'line': sale_order_line(4) with display_type=='line_note'},
# {'subtotal': 8932.23},
# ]
return res
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
# for optional display in tree view
product_barcode = fields.Char(
related='product_id.barcode', string="Product Barcode")
# @api.onchange('product_uom', 'product_uom_qty')
# def product_uom_change(self):
# When the user has manually set a custom price
# he is often upset when Odoo changes it when he changes the qty
# So we add a warning in which we recall the old price.
# res = {}
# old_price = self.price_unit
# super().product_uom_change()
# new_price = self.price_unit
# prec = self.env['decimal.precision'].precision_get('Product Price')
# if float_compare(old_price, new_price, precision_digits=prec):
# pricelist = self.order_id.pricelist_id
# res['warning'] = {
# 'title': _('Price updated'),
# 'message': _(
# "Due to the update of the ordered quantity on line '%s', "
# "the price has been updated according to pricelist '%s'.\n"
# "Old price: %s\n"
# "New price: %s") % (
# self.name,
# pricelist.display_name,
# formatLang(
# self.env, old_price, currency_obj=pricelist.currency_id),
# formatLang(
# self.env, new_price, currency_obj=pricelist.currency_id))
# }
# return res
def _get_sale_order_line_multiline_description_sale(self):
# This is useful when you want to have the product code in a dedicated
# column in your sale order report
# The same ir.config_parameter is used in sale_usability,
# purchase_usability and account_usability
no_product_code_param = self.env['ir.config_parameter'].sudo().get_param(
'usability.line_name_no_product_code')
if no_product_code_param and no_product_code_param == 'True':
self = self.with_context(display_default_code=False)
return super()._get_sale_order_line_multiline_description_sale()

View File

@@ -0,0 +1 @@
Alexis de Lattre <alexis.delattre@akretion.com>

View File

@@ -0,0 +1,15 @@
This modules adds the following functions:
* Display amount untaxed in tree view
* Methods for py3o sale reports
* Add tracking on partner warning fields
* Add tracking on product fields
* Add tracking on Sale Order fields
* Add menu for Pricelist Items
* Add `has_discount` field on Sale Order
* Move client_order_ref from the second tab to the top
* Protect Cancel button with a confirmation pop-up
* Remove Sale Orders from Quotations menu
* Add Group By Customer on Sales order search view
* Add sum=1 on several quantity fields
* Add Product Category Menu entry

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,429 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Sale Usability</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="sale-usability">
<h1 class="title">Sale Usability</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/sale_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<p>This modules adds the following functions:</p>
<ul class="simple">
<li>Display amount untaxed in tree view</li>
<li>Add sale_ids and sale_count on Invoice</li>
<li>Methods for py3o sale reports</li>
<li>Add tracking on partner warning fields</li>
<li>Add tracking on product fields</li>
<li>Add tracking on Sale Order fields</li>
<li>Add menu for Pricelist Items</li>
<li>Add <cite>has_discount</cite> field on Sale Order</li>
<li>Restore drill-through on sale and invoice reports</li>
<li>Move client_order_ref from the second tab to the top</li>
<li>Protect Cancel button with a confirmation pop-up</li>
<li>Remove Sale Orders from Quotations menu</li>
<li>Add Group By Customer on Sales order search view</li>
<li>Add sum=1 on several quantity fields</li>
<li>Add Product Category Menu entry</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/akretion/odoo-usability/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/akretion/odoo-usability/issues/new?body=module:%20sale_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<p>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/sale_usability">akretion/odoo-usability</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="name">sale_usability.account.move.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/form//field[@name='analytic_distribution']" position="after">
<field name="sale_line_ids" widget="many2many_tags" attrs="{'invisible': [('sale_line_ids', '=', [])]}"/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- Add a 'Product Category' menu entry under Sales > Configuration > Products,
similar to what we have in Stock > Configuration > Products
because we need this menu entry even if the 'stock' module is not installed -->
<menuitem id="product_category_sale_menu" action="product.product_category_action_form"
parent="sale.prod_config_main" sequence="5"/>
</odoo>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- This is in the sale_usability module instead of the product_usability module
because the parent menu entry is in the sale module -->
<record id="product_pricelist_item_action" model="ir.actions.act_window">
<field name="name">Price Rules</field>
<field name="res_model">product.pricelist.item</field>
<field name="view_mode">tree,form</field>
<field name="context">{'product_pricelist_item_main_view': True}</field>
</record>
<!-- This menu entry is very useful for mass export/import of prices -->
<menuitem id="product_pricelist_item_menu"
parent="sale.product_menu_catalog"
action="product_pricelist_item_action"
groups="product.group_sale_pricelist"
sequence="50"/>
</odoo>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021-2022 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_company_form" model="ir.ui.view">
<field name="name">sale_usability.res.company.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="account_usability_akretion.view_company_form"/>
<field name="arch" type="xml">
<group name="static_invoice_terms" position="after">
<group name="static_sale_terms" string="Quotation Legal Terms">
<field name="static_sale_terms" nolabel="1" colspan="2"/>
</group>
</group>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="res_partner_view_team" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="sales_team.res_partner_view_team" />
<field name="arch" type="xml">
<!-- team_id should be visible in no developper mode -->
<field name="team_id" groups="base.group_no_one" position="attributes">
<attribute name="groups"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">usability.sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="fiscal_position_id" position="attributes">
<attribute name="widget">selection</attribute>
</field>
<field name="partner_shipping_id" position="attributes">
<attribute name="context" operation="update">{"show_address": 1}</attribute>
</field>
<button name="action_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this sale order?</attribute>
</button>
<!-- client_order_ref is an important field, so we should put it in the top like in v8, not hidden in the second tab -->
<field name="date_order" position="after">
<field name="client_order_ref" position="move"/>
</field>
<button name="action_quotation_send" states="sent,sale" position="after">
<button name="%(sale.action_report_saleorder)d" type="action" string="Print" states="draft,sent,sale,done"/>
</button>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="after">
<field name="product_barcode" optional="hide"/>
</xpath>
<button name="action_quotation_send" attrs="{'invisible': ['|', ('state', '=', 'draft'), ('invoice_count','&gt;=',1)]}" position="before">
<button name="action_quotation_send" type="object" string="Send Order Acknowledgement" attrs="{'invisible': ['|', ('state', 'not in', ('sale', 'done')), ('invoice_count','&gt;=',1)]}"/>
</button>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="attributes">
<attribute name="sum">1</attribute>
</xpath>
<!-- it doesn't work... I don't know why ! -->
<xpath expr="//field[@name='order_line']/tree/field[@name='qty_delivered']" position="attributes">
<attribute name="sum">1</attribute>
</xpath>
<!-- it doesn't work... I don't know why ! -->
<xpath expr="//field[@name='order_line']/tree/field[@name='qty_invoiced']" position="attributes">
<attribute name="sum">1</attribute>
</xpath>
</field>
</record>
<record id="view_quotation_tree" model="ir.ui.view">
<field name="name">usability.sale.quotation.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml">
<field name="amount_untaxed" position="attributes">
<attribute name="optional">show</attribute>
</field>
<field name="partner_id" position="after">
<field name="client_order_ref" optional="hide"/>
</field>
</field>
</record>
<record id="view_order_tree" model="ir.ui.view">
<field name="name">usability.sale.order.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml">
<field name="amount_untaxed" position="attributes">
<attribute name="optional">show</attribute>
</field>
<field name="state" position="attributes">
<attribute name="invisible">0</attribute>
<attribute name="optional">hide</attribute>
<attribute name="widget">badge</attribute>
<attribute name="decoration-success">state == 'done'</attribute>
<attribute name="decoration-info">state == 'sale'</attribute>
</field>
<field name="partner_id" position="after">
<field name="client_order_ref" optional="show"/>
</field>
</field>
</record>
<record id="view_sales_order_filter" model="ir.ui.view">
<field name="name">usability.sale.order.search</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="arch" type="xml">
<filter name="order_month" position="after">
<filter string="State" name="state_groupby" context="{'group_by': 'state'}"/>
</filter>
<filter name="activities_upcoming_all" position="after">
<separator/>
<filter name="no_attachment" string="Missing Attachment" domain="[('has_attachment', '=', False)]"/>
</filter>
</field>
</record>
<!-- Restore the behavior of Odoo v8:
https://github.com/odoo/odoo/commit/c1e5ab9b1331c3cb7dc2232bf78952bdb40ad939 -->
<record id="sale.action_quotations" model="ir.actions.act_window">
<field name="domain">[('state', 'in', ('draft', 'sent', 'cancel'))]</field>
</record>
<record id="sale.action_quotations_with_onboarding" model="ir.actions.act_window">
<field name="domain">[('state', 'in', ('draft', 'sent', 'cancel'))]</field>
</record>
<record id="view_sales_order_line_filter" model="ir.ui.view">
<field name="name">usability.sale.order.line.search</field>
<field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_sales_order_line_filter"/>
<field name="arch" type="xml">
<filter name="product" position="before">
<filter string="Customer" name="partner_groupby" context="{'group_by': 'order_partner_id'}"/>
</filter>
</field>
</record>
<record id="view_order_line_tree" model="ir.ui.view">
<field name="name">usability.sale.order.line.tree</field>
<field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_order_line_tree"/>
<field name="arch" type="xml">
<field name="product_uom_qty" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="qty_delivered" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="qty_invoiced" position="attributes">
<attribute name="sum">1</attribute>
</field>
<field name="qty_to_invoice" position="attributes">
<attribute name="sum">1</attribute>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018-2022 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="sale_report_view_tree" model="ir.ui.view">
<field name="name">usability.sale.report.tree</field>
<field name="model">sale.report</field>
<field name="inherit_id" ref="sale.sale_report_view_tree"/>
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="product_id" optional="show"/>
<field name="product_uom_qty" sum="1" optional="show"/>
<field name="qty_delivered" sum="1" optional="hide"/>
<field name="qty_to_invoice" sum="1" optional="hide"/>
<field name="product_uom" groups="uom.group_uom" optional="show"/>
</field>
</field>
</record>
<record id="sale.action_order_report_all" model="ir.actions.act_window">
<!-- native order is graph,pivot -->
<field name="view_mode">pivot,graph</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
from . import sale_invoice_discount_all_lines

View File

@@ -0,0 +1,13 @@
# Copyright 2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class SaleInvoiceDiscountAllLines(models.TransientModel):
_name = 'sale.invoice.discount.all.lines'
_description = 'None'
# Remove because this feature is now mostly native
# TODO 04/07/2024 remove later to avoid ORM bug: it crashes when reloading module
# KeyError: 'sale.invoice.discount.all.lines'