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,63 @@
==================
Purchase 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/purchase_usability
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
This module adds the following functions:
- Track visibility on partner and product purchase warning
- Track visibility on Purchase Order warning
- Methods to help generate py3o purchase reports
- Use untaxed amount in name_get of purchase orders
- Protect Cancel button with a confirmation pop-up
- Misc. improvements to Purchase Order Line views
**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:%20purchase_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/purchase_usability>`_ project on GitHub.
You are welcome to contribute.

View File

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

View File

@@ -0,0 +1,20 @@
# 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': 'Purchase Usability',
'version': '16.0.1.0.0',
'category': 'Purchases',
'license': 'AGPL-3',
'summary': 'Usability improvements on purchase module',
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['purchase'],
'data': [
'views/purchase_order.xml',
'views/purchase_report.xml',
'views/account_move.xml',
],
'installable': False,
}

View File

@@ -0,0 +1,175 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-04 15:17+0000\n"
"PO-Revision-Date: 2024-07-04 15:17+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: purchase_usability
#: model_terms:ir.ui.view,arch_db:purchase_usability.purchase_order_form
msgid "Are you sure you want to cancel this purchase order?"
msgstr "Êtes-vous sûr de vouloir annuler cette commande fournisseur?"
#. module: purchase_usability
#: model_terms:ir.ui.view,arch_db:purchase_usability.view_purchase_order_filter
msgid "Billing Status"
msgstr "Statut de facturation"
#. module: purchase_usability
#: model:ir.model,name:purchase_usability.model_res_partner
msgid "Contact"
msgstr "Contact"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_product_product__purchase_method
#: model:ir.model.fields,field_description:purchase_usability.field_product_template__purchase_method
msgid "Control Policy"
msgstr "Politique de contrôle"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__currency_id
msgid "Currency"
msgstr "Devise"
#. module: purchase_usability
#: model_terms:ir.ui.view,arch_db:purchase_usability.view_move_form
msgid "Delete Lines Qty=0"
msgstr "Supprimer les lignes qté=0"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__delivery_partner_id
msgid "Delivery Partner"
msgstr "Partenaire de livraison"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__dest_address_id
msgid "Dropship Address"
msgstr "Adresse de livraison directe"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__fiscal_position_id
msgid "Fiscal Position"
msgstr "Position fiscale"
#. module: purchase_usability
#: model:ir.model.fields,help:purchase_usability.field_purchase_order_line__product_barcode
msgid "International Article Number used for product identification."
msgstr ""
"Numéro d'article international utilisé pour l'identification du produit."
#. module: purchase_usability
#: model:ir.model,name:purchase_usability.model_account_move
msgid "Journal Entry"
msgstr "Pièce comptable"
#. module: purchase_usability
#: model:ir.model.fields,help:purchase_usability.field_product_product__purchase_method
#: model:ir.model.fields,help:purchase_usability.field_product_template__purchase_method
msgid ""
"On ordered quantities: Control bills based on ordered quantities.\n"
"On received quantities: Control bills based on received quantities."
msgstr ""
"Sur les quantités commandées : génère les factures fournisseurs en se basant sur les "
"quantités commandées. \n"
"Sur les quantités reçues : génère les factures fournisseurs en se basant sur les quantités "
"reçues."
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__payment_term_id
msgid "Payment Terms"
msgstr "Conditions de paiement"
#. module: purchase_usability
#: model_terms:ir.ui.view,arch_db:purchase_usability.purchase_order_form
msgid "Print"
msgstr "Imprimer"
#. module: purchase_usability
#: model:ir.model,name:purchase_usability.model_product_template
msgid "Product"
msgstr "Produit"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order_line__product_barcode
msgid "Product Barcode"
msgstr "Code-barres du produit"
#. module: purchase_usability
#: model:ir.model,name:purchase_usability.model_purchase_order
#: model:ir.model.fields,field_description:purchase_usability.field_res_partner__purchase_warn
#: model:ir.model.fields,field_description:purchase_usability.field_res_users__purchase_warn
msgid "Purchase Order"
msgstr "Bon de commande"
#. module: purchase_usability
#: model:ir.model,name:purchase_usability.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Ligne de commande d'achat"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_product_product__purchase_line_warn
#: model:ir.model.fields,field_description:purchase_usability.field_product_template__purchase_line_warn
msgid "Purchase Order Line Warning"
msgstr "Avertissement ligne de commande d'achat"
#. module: purchase_usability
#: model:ir.model.fields,help:purchase_usability.field_purchase_order__dest_address_id
msgid ""
"Put an address if you want to deliver directly from the vendor to the "
"customer. Otherwise, keep empty to deliver to your own company."
msgstr ""
"Ajoutez une adresse si vous voulez que la livraison se fasse directement du fournisseur au "
"client. Sinon, laissez vide pour vous faire livrer à votre société."
#. module: purchase_usability
#: model:ir.model.fields,help:purchase_usability.field_purchase_order__partner_ref
msgid ""
"Reference of the sales order or bid sent by the vendor. It's used to do the "
"matching when you receive the products as this reference is usually written "
"on the delivery order sent by your vendor."
msgstr ""
"Référence de la commande client ou de l'offre envoyée par le fournisseur. Utilisé "
"principalement pour faire la correspondance lors de la réception des "
"marchandises, puisque cette référence est généralement écrite sur le bon de "
"livraison envoyé par votre fournisseur."
#. module: purchase_usability
#: model_terms:ir.ui.view,arch_db:purchase_usability.view_purchase_order_filter
msgid "Reference, Origin or Vendor Reference"
msgstr "Référence, origine ou référence fournisseur"
#. module: purchase_usability
#: model:ir.model.fields,help:purchase_usability.field_product_product__purchase_line_warn
#: model:ir.model.fields,help:purchase_usability.field_product_template__purchase_line_warn
#: model:ir.model.fields,help:purchase_usability.field_res_partner__purchase_warn
#: model:ir.model.fields,help:purchase_usability.field_res_users__purchase_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' notifiera l'utilisateur avec le "
"message. Sélectionner 'Message Bloquant' lancera une exception avec le "
"message et bloquera le flux. Le message doit être écrit dans le champ "
"ci-dessous."
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order_line__product_supplier_code
msgid "Vendor Product Code"
msgstr "Code produit du fournisseur"
#. module: purchase_usability
#: model:ir.model.fields,field_description:purchase_usability.field_purchase_order__partner_ref
msgid "Vendor Reference"
msgstr "Référence fournisseur"

View File

@@ -0,0 +1,4 @@
from . import purchase_order
from . import product_template
from . import res_partner
from . import account_move

View File

@@ -0,0 +1,21 @@
# Copyright 2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class AccountMove(models.Model):
_inherit = 'account.move'
def delete_lines_qty_zero(self):
# When a user pulls a PO from a supplier invoice, it creates
# all lines including lines that haven't been received. It can be time-consuming
# to delete all these lines with qty = 0
self.ensure_one()
lines = self.env['account.move.line'].search([
('move_id', '=', self.id),
('quantity', '=', 0),
('display_type', '=', False),
])
lines.unlink()

View File

@@ -0,0 +1,12 @@
# Copyright 2016-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'
purchase_method = fields.Selection(tracking=True)
purchase_line_warn = fields.Selection(tracking=True)

View File

@@ -0,0 +1,182 @@
# 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).
from odoo import api, fields, models
from odoo.tools.misc import format_amount
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
dest_address_id = fields.Many2one(tracking=True)
currency_id = fields.Many2one(tracking=True)
payment_term_id = fields.Many2one(tracking=True)
fiscal_position_id = fields.Many2one(tracking=True)
partner_ref = fields.Char(tracking=True)
# the field 'delivery_partner_id' is used in report
# the compute method of that field is inherited in purchase_stock_usability
delivery_partner_id = fields.Many2one(
'res.partner', compute='_compute_delivery_partner_id')
@api.depends('dest_address_id')
def _compute_delivery_partner_id(self):
for order in self:
order.delivery_partner_id = order.dest_address_id
# Re-write native name_get() to use amount_untaxed instead of amount_total
@api.depends('name', 'partner_ref', 'amount_untaxed')
def name_get(self):
result = []
for po in self:
name = po.name
if po.partner_ref:
name += ' (' + po.partner_ref + ')'
if self.env.context.get('show_total_amount') and po.amount_untaxed:
name += ': ' + format_amount(
self.env, po.amount_untaxed, po.currency_id)
result.append((po.id, name))
return result
# 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
else:
if 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 PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
# for optional display in tree view
product_barcode = fields.Char(
related='product_id.barcode', string="Product Barcode")
product_supplier_code = fields.Char(
compute='_compute_product_supplier_code', string='Vendor Product Code')
def _compute_product_supplier_code(self):
pso = self.env['product.supplierinfo']
for line in self:
code = False
if not line.display_type and line.product_id and line.order_id:
partner_id = line.order_id.partner_id.commercial_partner_id.id
if partner_id:
sinfo = pso.search_read([
('product_tmpl_id', '=', line.product_id.product_tmpl_id.id),
('product_id', 'in', (False, line.product_id.id)),
('partner_id', '=', partner_id),
('product_code', '!=', False),
('company_id', 'in', (False, line.order_id.company_id.id)),
], ['product_code'], limit=1, order='product_id')
# if I order by product_id, I get the null values at the end
if sinfo:
code = sinfo[0]['product_code']
line.product_supplier_code = code
def _get_product_purchase_description(self, product_lang):
# This is useful when you want to have the product code in a dedicated
# column in your purchase 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':
product_lang = product_lang.with_context(display_default_code=False)
return super()._get_product_purchase_description(product_lang)
@api.model
def _prepare_purchase_order_line(self, product, product_qty, product_uom, company_id, supplier, po):
# _prepare_purchase_order_line() doesn't use _get_product_purchase_description()
# because this method is @api.model and _get_product_purchase_description() has self._ensure_one()
# I tried to inject display_default_code in the context via super(xxx, self.with_context()),
# but it doesn't work. That's why I rewrite vals['name']
# The native proto uses "product_id", but it's in fact a product record set,
# that's why I use 'product' in the proto here
vals = super()._prepare_purchase_order_line(
product, product_qty, product_uom, company_id, supplier, po)
# START copy-paste from original code (I just modified product_id => product
partner = supplier.partner_id
uom_po_qty = product_uom._compute_quantity(product_qty, product.uom_po_id, rounding_method='HALF-UP')
today = fields.Date.today()
seller = product.with_company(company_id)._select_seller(
partner_id=partner,
quantity=uom_po_qty,
date=po.date_order and max(po.date_order.date(), today) or today,
uom_id=product.uom_po_id)
# END copy-paste from original code
product_lang = product.with_context(
lang=partner.lang,
partner_id=partner.id,
seller_id=seller.id
)
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':
product_lang = product_lang.with_context(display_default_code=False)
name = product_lang.display_name
if product_lang.description_purchase:
name += '\n' + product_lang.description_purchase
vals['name'] = name
return vals
# TODO see how we could restore this feature
# @api.onchange('product_qty', 'product_uom')
# def _onchange_quantity(self):
# When the user has manually set a price and/or planned_date
# he is often upset when Odoo changes it when he changes the qty
# So we add a warning...
# res = {}
# old_price = self.price_unit
# old_date_planned = self.date_planned
# super()._onchange_quantity()
# new_price = self.price_unit
# new_date_planned = self.date_planned
# prec = self.env['decimal.precision'].precision_get('Product Price')
# price_compare = float_compare(old_price, new_price, precision_digits=prec)
# if price_compare or old_date_planned != new_date_planned:
# res['warning'] = {
# 'title': _('Updates'),
# 'message': _(
# "Due to the update of the ordered quantity on line '%s', "
# "the following data has been updated using the supplier info "
# "of the product:"
# ) % self.name
# }
# if price_compare:
# res['warning']['message'] += _(
# "\nOld price: %s\nNew price: %s") % (
# format_amount(
# self.env, old_price, self.order_id.currency_id),
# format_amount(
# self.env, new_price, self.order_id.currency_id))
# if old_date_planned != new_date_planned:
# res['warning']['message'] += _(
# "\nOld delivery date: %s\nNew delivery date: %s") % (
# format_datetime(self.env, old_date_planned),
# format_datetime(self.env, new_date_planned),
# )
# return res

View File

@@ -0,0 +1,11 @@
# 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 ResPartner(models.Model):
_inherit = 'res.partner'
purchase_warn = fields.Selection(tracking=True)

View File

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

View File

@@ -0,0 +1,7 @@
This module adds the following functions:
- Track visibility on partner and product purchase warning
- Track visibility on Purchase Order warning
- Methods to help generate py3o purchase reports
- Use untaxed amount in name_get of purchase orders
- Protect Cancel button with a confirmation pop-up
- Misc. improvements to Purchase Order Line views

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,425 @@
<?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>Purchase 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="purchase-usability">
<h1 class="title">Purchase 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/purchase_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
<dt>This module adds the following functions:</dt>
<dd><ul class="first last simple">
<li>Track visibility on partner and product purchase warning</li>
<li>Track visibility on Purchase Order warning</li>
<li>Methods to help generate py3o purchase reports</li>
<li>Use untaxed amount in name_get of purchase orders</li>
<li>Protect Cancel button with a confirmation pop-up</li>
<li>Misc. improvements to Purchase Order Line views</li>
</ul>
</dd>
</dl>
<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:%20purchase_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>
<ul class="simple">
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</li>
</ul>
</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/purchase_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,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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).
-->
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="model">account.move</field>
<field name="inherit_id" ref="purchase.view_move_form_inherit_purchase"/>
<field name="arch" type="xml">
<button name="button_draft" position="after">
<button name="delete_lines_qty_zero" attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('move_type', '!=', 'in_invoice')]}" string="Delete Lines Qty=0" type="object"/>
</button>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014-2020 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="purchase_order_form" model="ir.ui.view">
<field name="name">usability.purchase.order.form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<button name="action_rfq_send" states="purchase" position="after">
<button name="%(purchase.action_report_purchase_order)d" states="purchase,done" string="Print" type="action"/>
</button>
<field name="fiscal_position_id" position="attributes">
<attribute name="widget">selection</attribute>
</field>
<button name="button_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this purchase order?</attribute>
</button>
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after">
<field name="product_supplier_code" optional="hide"/>
<field name="product_barcode" optional="hide"/>
</xpath>
</field>
</record>
<record id="purchase_order_tree" model="ir.ui.view">
<field name="name">usability.purchase.order.tree</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_tree"/>
<field name="arch" type="xml">
<!-- the 'origin' field can be very long ; it can list a lot of MO or OP!
I think limiting the size of the field would not be the best option,
because the info it carries can be interesting. So we just hide it by default -->
<field name="origin" position="attributes">
<attribute name="optional">hide</attribute>
</field>
</field>
</record>
<record id="view_purchase_order_filter" model="ir.ui.view">
<field name="name">usability.purchase.order.tree</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.view_purchase_order_filter"/>
<field name="arch" type="xml">
<group expand="0" position="inside">
<filter string="Billing Status" name="invoice_status_groupby" context="{'group_by': 'invoice_status'}"/>
</group>
<field name="name" position="attributes">
<attribute name="string">Reference, Origin or Vendor Reference</attribute>
<attribute name="filter_domain">['|', '|', '|', ('name', 'ilike', self), ('origin', 'ilike', self), ('partner_ref', 'ilike', self), ('partner_id', 'child_of', self)]</attribute>
</field>
</field>
</record>
<!-- Default measure should be Total without taxes instead of Total with taxes -->
<record id="purchase_order_pivot" model="ir.ui.view">
<field name="name">usability.purchase.order.pivot</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_pivot"/>
<field name="arch" type="xml">
<field name="amount_total" type="measure" position="replace">
<field name="amount_untaxed" type="measure"/>
</field>
</field>
</record>
<record id="purchase_order_graph" model="ir.ui.view">
<field name="name">usability.purchase.order.graph</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_graph"/>
<field name="arch" type="xml">
<field name="amount_total" type="measure" position="replace">
<field name="amount_untaxed" type="measure"/>
</field>
</field>
</record>
<record id="purchase_order_calendar" model="ir.ui.view">
<field name="name">usability.purchase.order.calendar</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_calendar"/>
<field name="arch" type="xml">
<field name="amount_total" position="replace">
<field name="amount_untaxed" widget="monetary"/>
</field>
</field>
</record>
<!-- Do not show cancelled quotations by default in "Requests for Quotation" -->
<record id="purchase.purchase_rfq" model="ir.actions.act_window">
<field name="context">{'search_default_draft': 1, 'quotation_only': True}</field>
<field name="domain">[('state', 'not in', ('purchase', 'done'))]</field>
</record>
<record id="purchase_order_line_tree" model="ir.ui.view">
<field name="name">usability.purchase.order.line.tree</field>
<field name="model">purchase.order.line</field>
<field name="inherit_id" ref="purchase.purchase_order_line_tree"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="name" position="move"/>
</field>
<field name="product_qty" position="after">
<field name="qty_received"/>
<field name="qty_invoiced"/>
</field>
<field name="product_uom" position="after">
<field name="price_unit" position="move"/>
</field>
<field name="date_planned" position="after">
<field name="state"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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).
-->
<odoo>
<record id="purchase.action_purchase_order_report_all" model="ir.actions.act_window">
<field name="view_mode">pivot,graph,tree</field> <!--- native order is graph,pivot. Switch order and add tree -->
</record>
</odoo>