3 Commits

Author SHA1 Message Date
e04ab5b009 Sync config from odoo-elabore-ci:16.0
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 7m29s
2025-09-17 13:39:54 +00:00
a7c005c839 [IMP]sale_usability_misc:make opportunity_id visible for sale manager group instead of dev mode group 2025-07-23 17:29:58 +02:00
be44c3c5d4 [ADD]pw_sale_total_qty 2024-12-31 14:20:26 +01:00
31 changed files with 393 additions and 671 deletions

27
pw_sale_total_qty/LICENSE Normal file
View File

@@ -0,0 +1,27 @@
Odoo Proprietary License v1.0
This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).
You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).
It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.
The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
{
"name": "Sale Order Total Quantity",
'version': '16.0.1.0.1',
'author': 'Preway IT Solutions',
'category': 'Sales',
'depends': ['sale'],
'summary': 'This module helps you to show total qty, delivered qty, invoiced qty and remaining qty on sale order | Sale Order Total Quantity | Sale Total Qty | Total Quantity Of Sale Order Line',
'description': """
- Sale Order Total Quantity
""",
'data': [
"views/sale_order_view.xml",
],
'price': 3.0,
'currency': "EUR",
'application': True,
'installable': True,
"license": "LGPL-3",
"images":["static/description/Banner.png"],
}

View File

@@ -0,0 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pw_sale_total_qty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-31 13:03+0000\n"
"PO-Revision-Date: 2024-12-31 13:03+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: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_remaining_delivery
msgid "Pending Delivery Qty"
msgstr "Quantités à livrer"
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_remaining_invoice
msgid "Pending Invoice Qty"
msgstr "Quantités à facturer"
#. module: pw_sale_total_qty
#: model:ir.model,name:pw_sale_total_qty.model_sale_order
msgid "Sales Order"
msgstr "Bon de commande"
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_total_qty_delivered
msgid "Total Delivered Qty"
msgstr "Total quantités livrées"
#. module: pw_sale_total_qty
#: model_terms:ir.ui.view,arch_db:pw_sale_total_qty.view_order_form_inherit_pw_total_qty
msgid "Total Deliverted"
msgstr "Total quantités"
#. module: pw_sale_total_qty
#: model_terms:ir.ui.view,arch_db:pw_sale_total_qty.view_order_form_inherit_pw_total_qty
msgid "Total Demand"
msgstr " Total commandé"
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_total_product_uom_qty
msgid "Total Demand Qty"
msgstr " Total quantités commandées"
#. module: pw_sale_total_qty
#: model_terms:ir.ui.view,arch_db:pw_sale_total_qty.view_order_form_inherit_pw_total_qty
msgid "Total Invoiced"
msgstr "Total facturé"
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_total_qty_invoiced
msgid "Total Invoiced Qty"
msgstr "Total quantités facturées"

View File

@@ -0,0 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pw_sale_total_qty
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-31 13:03+0000\n"
"PO-Revision-Date: 2024-12-31 13:03+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: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_remaining_delivery
msgid "Pending Delivery Qty"
msgstr ""
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_remaining_invoice
msgid "Pending Invoice Qty"
msgstr ""
#. module: pw_sale_total_qty
#: model:ir.model,name:pw_sale_total_qty.model_sale_order
msgid "Sales Order"
msgstr ""
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_total_qty_delivered
msgid "Total Delivered Qty"
msgstr ""
#. module: pw_sale_total_qty
#: model_terms:ir.ui.view,arch_db:pw_sale_total_qty.view_order_form_inherit_pw_total_qty
msgid "Total Deliverted"
msgstr ""
#. module: pw_sale_total_qty
#: model_terms:ir.ui.view,arch_db:pw_sale_total_qty.view_order_form_inherit_pw_total_qty
msgid "Total Demand"
msgstr ""
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_total_product_uom_qty
msgid "Total Demand Qty"
msgstr ""
#. module: pw_sale_total_qty
#: model_terms:ir.ui.view,arch_db:pw_sale_total_qty.view_order_form_inherit_pw_total_qty
msgid "Total Invoiced"
msgstr ""
#. module: pw_sale_total_qty
#: model:ir.model.fields,field_description:pw_sale_total_qty.field_sale_order__pw_total_qty_invoiced
msgid "Total Invoiced Qty"
msgstr ""

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import sale_order

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.exceptions import UserError, ValidationError
class SaleOrder(models.Model):
_inherit = 'sale.order'
pw_total_product_uom_qty = fields.Float(string="Total Demand Qty", compute='_compute_pw_total_product_uom_qty')
pw_total_qty_delivered = fields.Float(string="Total Delivered Qty", compute='_compute_pw_total_qty_delivered')
pw_total_qty_invoiced = fields.Float(string="Total Invoiced Qty", compute='_compute_pw_total_qty_invoiced')
pw_remaining_delivery = fields.Float(string="Pending Delivery Qty", compute="_compute_pw_remaining_delivery")
pw_remaining_invoice = fields.Float(string="Pending Invoice Qty", compute="_compute_pw_remaining_invoice")
@api.depends('order_line.product_uom_qty')
def _compute_pw_total_product_uom_qty(self):
for order in self:
order.pw_total_product_uom_qty = sum(order.order_line.mapped('product_uom_qty'))
@api.depends('order_line.qty_delivered')
def _compute_pw_total_qty_delivered(self):
for order in self:
order.pw_total_qty_delivered = sum(order.order_line.mapped('qty_delivered'))
@api.depends('order_line.qty_invoiced')
def _compute_pw_total_qty_invoiced(self):
for order in self:
order.pw_total_qty_invoiced = sum(order.order_line.mapped('qty_invoiced'))
@api.depends('order_line.product_uom_qty', 'order_line.qty_delivered')
def _compute_pw_remaining_delivery(self):
for order in self:
delivery_qty = sum(order.order_line.filtered(lambda x: x.product_id.type != 'service').mapped('product_uom_qty'))
delivered_qty = sum(order.order_line.mapped('qty_delivered'))
order.pw_remaining_delivery = delivery_qty - delivered_qty
@api.depends('pw_total_product_uom_qty', 'pw_total_qty_invoiced')
def _compute_pw_remaining_invoice(self):
for order in self:
order.pw_remaining_invoice = order.pw_total_product_uom_qty - order.pw_total_qty_invoiced

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@@ -0,0 +1,45 @@
<section class="oe_container oe_dark" style="overflow: hidden;
background: #cddae8;
border-radius: 15px;">
<div class="mt32 mb32">
<div class="col-md-12">
<h2 class="oe_slogan" style="font-family: Quicksand; font-size: 35px;"><b>Sale Order Total Quantity</b></h2>
<h3 class="oe_slogn" style="font-family: Quicksand; text-align: center;">This module helps you to show total qty, delivered qty, invoiced qty and remaining qty on sale order
</h3>
</div>
</div>
</section>
<br/><br/>
<section class="oe_container">
<div class="alert" style="color: black;background-color: #cddae8;border-color: black;">
<i class="fa fa-hand-o-right"></i><b> App Features</b>
</div>
<ul class="list-unstyled mr32 ml32">
<li><i class="fa fa-check" style="color: #cddae8;"></i> Show Total Demand Qty, Delivered and Invoiced Quantity on Sale Order </li>
<li><i class="fa fa-check" style="color: #cddae8;"></i> Show Remaining Delivery and Invoice Quantity on Sale Order</li>
<li><i class="fa fa-check" style="color: #cddae8;"></i> Also compatible with community and enterprise</li>
</ul>
<div class="alert text-center mt32" style="background-color: #cddae8;border-color: black;">
<b>Sale Order Total Quantity</b>
</div>
<br/>Total Demand, Delivered, Invoiced, Pending Delivery and Pending Invoiced Quanatity on sale order. (Service product not count in pending delivery)<br/>
<img class="img-border img-responsive thumbnail mt32" src="sale1.png" style="width: 100%;">
</section>
<section class="oe_container" style="overflow: hidden;">
<div class="mt32 mb32">
<div class="col-md-12" style="text-align: center;">
<img src="pw_logo.png" style="width: 300px;" /><br>
</div><br>
<div class="oe_slogan text-center">
<h2 class="oe_slogan">
Contact US
</h2>
<p class="btn btn-success mt8" style="background-color: #2355a6; color: #FFFFFF !important;font-size:20px;"> Email : prewayit@gmail.com </p>
</div>
<div style="text-align: center;">
<p>Note: We give free support incase any bug or issue in our apps (Except data recovery).</p>
</div>
</div>
</section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_order_form_inherit_pw_total_qty" model="ir.ui.view">
<field name="name">sale.order.form.inherit.pw.total.qty</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='note']" position="before">
<group>
<field name="pw_total_product_uom_qty"/>
<field name="pw_total_qty_delivered"/>
<field name="pw_total_qty_invoiced"/>
<field name="pw_remaining_delivery"/>
<field name="pw_remaining_invoice"/>
</group>
</xpath>
<xpath expr="//field[@name='order_line']//tree//field[@name='product_uom_qty']" position="attributes">
<attribute name="sum">Total Demand</attribute>
</xpath>
<xpath expr="//field[@name='order_line']//tree//field[@name='qty_delivered']" position="attributes">
<attribute name="sum">Total Deliverted</attribute>
</xpath>
<xpath expr="//field[@name='order_line']//tree//field[@name='qty_invoiced']" position="attributes">
<attribute name="sum">Total Invoiced</attribute>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -1,42 +0,0 @@
# Sale - Disable Product Creation in Sale
Prevents users from creating new products directly from sale order lines.
## Description
By default, Odoo allows users to create new products on-the-fly when filling
in sale order lines via the *Product* field. This can lead to duplicate or
poorly configured products when the catalog should be managed centrally.
This module adds the `no_create` option to the `product_template_id` field in
the sale order line tree view, so users can only select existing products from
the catalog.
## Usage
Once installed, the *Create and edit…* and *Create* options are removed from
the product dropdown in sale order lines. Users must pick a product that
already exists in the product catalog.
No configuration is required.
## Installation
Install via the standard Odoo module installation procedure.
**Dependencies:** `base`, `sale`
## Credits
### Authors
- [Elabore](https://elabore.coop)
### Maintainer
This module is maintained by [Elabore](https://elabore.coop).
## License
This module is licensed under **AGPL-3**. See the [LICENSE](LICENSE) file for
full details.

View File

@@ -0,0 +1,50 @@
===============
sale_usability_misc
===============
Various improves for Sales app
Installation
============
Use Odoo normal module installation procedure to install
``sale_usability_misc``.
Description
===========
- Allow group sales administores to see date_order field event if not in developper mode
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/sale_usability_misc/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.
Credits
=======
Contributors
------------
* `Elabore <mailto:laetitia.dacosta@elabore.coop>`
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -3,7 +3,7 @@
{
"name": "sale_disable_product_creation_in_sale",
"version": "18.0.1.0.0",
"version": "16.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Elabore",

View File

@@ -6,7 +6,7 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/list//field[@name='product_template_id']" position="attributes">
<xpath expr="//field[@name='order_line']/tree//field[@name='product_template_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
</xpath>
</field>

View File

@@ -1,2 +0,0 @@
*.*~
*pyc

View File

@@ -1,110 +0,0 @@
# Sale Outstanding
![Production/Stable](https://img.shields.io/badge/maturity-Production%2FStable-green.png)
![License: AGPL-3](https://img.shields.io/badge/licence-AGPL--3-blue.png)
![GitHub](https://img.shields.io/badge/github-elabore--coop%2Fsale--tools-lightgray.png?logo=github)
This module computes and displays two financial indicators on sale orders:
- **Outstanding (Untaxed)**: total amount of order lines that have been delivered but not yet invoiced.
- **To Do (Untaxed)**: total amount of order lines that have not yet been fully delivered
(excluding services billed on order with the `ordered_timesheet` policy).
Both values are visible directly on the sale order form and in the list view
(columns hidden by default, toggleable via the column selector).
## Table of Contents
- [Description](#description)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Known Issues / Roadmap](#known-issues--roadmap)
- [Bug Tracker](#bug-tracker)
- [Credits](#credits)
## Description
This module extends the `sale.order` model with two computed, stored monetary fields.
### `sum_outstanding` — Outstanding (Untaxed)
Computed as the sum across all order lines of:
```
qty_to_invoice × price_unit
```
This amount represents what has been delivered to the customer but not yet invoiced.
### `sum_pending_work` — To Do (Untaxed)
Computed as the sum across all order lines of:
```
(ordered_qty delivered_qty) × price_unit
```
Services whose invoicing policy is `ordered_timesheet` are excluded from this calculation,
as they are invoiced upon order confirmation rather than upon delivery.
This amount represents work that still needs to be delivered and has not yet been invoiced.
### Display
- **Form view**: both fields appear in an `oe_subtotal_footer` group placed after the order
totals block.
- **List view**: both columns are added after `amount_tax`, hidden by default, with column
footer totals.
## Installation
This module depends on:
- `base` (Odoo core)
- `sale` (Odoo core)
Use the standard Odoo module installation procedure to install `sale_outstanding`.
## Configuration
No specific configuration is required. The fields are computed automatically.
To display the columns in the sale order list view, click the column selector icon
(top-right corner of the list) and enable **Outstanding (Untaxed)** and/or **To Do (Untaxed)**.
## Usage
1. Open a confirmed sale order for which deliveries have been (partially or fully) completed.
2. The **Outstanding (Untaxed)** field shows the amount delivered but not yet invoiced.
3. The **To Do (Untaxed)** field shows the amount of work not yet delivered.
4. In the sale order list view, enable the optional columns for a global overview of outstanding amounts.
## Known Issues / Roadmap
- Amounts are computed excluding taxes. A possible improvement would be to add tax-included variants.
- The filter on `service_policy == 'ordered_timesheet'` is hard-coded; a configurable setting
would allow more flexibility.
## Bug Tracker
Bugs are tracked on [our issue tracker](https://github.com/elabore-coop/sale-tools/issues).
If you encounter a problem, please check whether your issue has already been reported.
If you are the first to spot it, help us by providing detailed and actionable feedback.
## Credits
### Contributors
- Stéphan Sainléger \<stephan@sainleger.fr\>
### Funders
The development of this module has been financially supported by:
- [Elabore](https://elabore.coop)
- [Datactivist](https://datactivist.coop)
### Maintainer
This module is maintained by [Elabore](https://elabore.coop).

View File

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

View File

@@ -1,33 +0,0 @@
# Copyright 2022 Stéphan Sainléger (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "sale_outstanding",
"version": "18.0.1.0.0",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Stéphan Sainléger",
"license": "AGPL-3",
"category": "Tools",
"summary": "Calculates and displays the sale order outstanding and pending work.",
# any module necessary for this one to work correctly
"depends": [
"base",
"sale",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"views/sale_views.xml",
],
# only loaded in demonstration mode
"demo": [],
"test": ["tests/test_sale_outstanding.py"],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -1,62 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_outstanding
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-24 18:04+0000\n"
"PO-Revision-Date: 2022-11-24 18:04+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_outstanding
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: sale_outstanding
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__id
msgid "ID"
msgstr ""
#. module: sale_outstanding
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: sale_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_order_tree_inherit_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_quotation_tree_inherit_outstanding
msgid "Outstanding Total"
msgstr "Total en cours HT"
#. module: sale_outstanding
#: code:addons/sale_outstanding/models/sale.py:0
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__sum_outstanding
#, python-format
msgid "Outstanding Untaxed"
msgstr "En cours HT"
#. module: sale_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_order_tree_inherit_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_quotation_tree_inherit_outstanding
msgid "Pending work Total"
msgstr "Total Reste à produire HT"
#. module: sale_outstanding
#: model:ir.model,name:sale_outstanding.model_sale_order
msgid "Sales Order"
msgstr "Bon de commande"
#. module: sale_outstanding
#: code:addons/sale_outstanding/models/sale.py:0
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__sum_pending_work
#, python-format
msgid "To Do Untaxed"
msgstr "Reste à produire HT"

View File

@@ -1,62 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_outstanding
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-24 18:02+0000\n"
"PO-Revision-Date: 2022-11-24 18:02+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_outstanding
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__display_name
msgid "Display Name"
msgstr ""
#. module: sale_outstanding
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__id
msgid "ID"
msgstr ""
#. module: sale_outstanding
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order____last_update
msgid "Last Modified on"
msgstr ""
#. module: sale_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_order_tree_inherit_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_quotation_tree_inherit_outstanding
msgid "Outstanding Total"
msgstr ""
#. module: sale_outstanding
#: code:addons/sale_outstanding/models/sale.py:0
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__sum_outstanding
#, python-format
msgid "Outstanding Untaxed"
msgstr ""
#. module: sale_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_order_tree_inherit_outstanding
#: model_terms:ir.ui.view,arch_db:sale_outstanding.view_quotation_tree_inherit_outstanding
msgid "Pending work Total"
msgstr ""
#. module: sale_outstanding
#: model:ir.model,name:sale_outstanding.model_sale_order
msgid "Sales Order"
msgstr ""
#. module: sale_outstanding
#: code:addons/sale_outstanding/models/sale.py:0
#: model:ir.model.fields,field_description:sale_outstanding.field_sale_order__sum_pending_work
#, python-format
msgid "To Do Untaxed"
msgstr ""

View File

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

View File

@@ -1,29 +0,0 @@
from odoo import _, api, fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.depends("order_line.qty_delivered", "order_line.qty_invoiced", "order_line.qty_to_invoice", "order_line.price_unit")
def _compute_sum_outstanding(self):
for order in self:
lines_outstanding = order.order_line.mapped(lambda r:(r.qty_to_invoice * r.price_unit))
order["sum_outstanding"] = sum(lines_outstanding)
@api.depends("order_line.qty_delivered", "order_line.product_uom_qty", "order_line.price_unit")
def _compute_sum_pending_work(self):
for order in self:
lines_pending_work = order.order_line.mapped(
lambda r: (
(r.product_uom_qty - r.qty_delivered) * r.price_unit
if not r.product_id
or "service_policy" not in r.product_id.product_tmpl_id._fields
or r.product_id.product_tmpl_id.service_policy != "ordered_prepaid"
else 0
)
)
order["sum_pending_work"] = sum(lines_pending_work)
sum_outstanding = fields.Monetary(_("Outstanding Untaxed"), readonly=True, store=True, compute="_compute_sum_outstanding")
sum_pending_work = fields.Monetary(_("To Do Untaxed"), readonly=True, store=True, compute="_compute_sum_pending_work")

View File

@@ -1,4 +0,0 @@
# Copyright 2025 Stéphan Sainléger (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_sale_outstanding

View File

@@ -1,248 +0,0 @@
# Copyright 2025 Stéphan Sainléger (Elabore)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.fields import Command
from odoo.tests import tagged
from odoo.tests.common import TransactionCase
@tagged("post_install", "-at_install")
class TestSaleOutstanding(TransactionCase):
"""Tests for sum_outstanding and sum_pending_work computed fields."""
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.partner = cls.env["res.partner"].create({"name": "Test Customer"})
# Storable product — delivered on shipping (delivery policy)
cls.product_storable = cls.env["product.product"].create(
{
"name": "Storable Product",
"type": "consu",
"list_price": 100.0,
"invoice_policy": "delivery",
"taxes_id": [],
}
)
# Service product — invoiced on delivery (timesheet / manual delivery)
cls.product_service = cls.env["product.product"].create(
{
"name": "Service Product",
"type": "service",
"list_price": 50.0,
"invoice_policy": "delivery",
"service_policy": "delivered_timesheet",
"taxes_id": [],
}
)
# Service product with ordered_prepaid policy — must be excluded from pending work.
# service_policy is a computed field on product.template derived from
# invoice_policy + service_type. 'ordered_prepaid' = invoice_policy='order' +
# service_type='timesheet' (requires sale_project/sale_timesheet).
# We set the policy directly on the template when the field exists.
cls.product_service_ordered = cls.env["product.product"].create(
{
"name": "Service Ordered Prepaid",
"type": "service",
"list_price": 80.0,
"invoice_policy": "order",
"service_type": "timesheet",
"taxes_id": [],
}
)
# Force service_policy to 'ordered_prepaid' if the field is available
# (provided by sale_project / sale_timesheet).
if "service_policy" in cls.env["product.template"]._fields:
cls.product_service_ordered.product_tmpl_id.service_policy = "ordered_prepaid"
# -------------------------------------------------------------------------
# Helpers
# -------------------------------------------------------------------------
def _make_order(self, lines):
"""Create and confirm a sale order with the given line specs.
Each entry in *lines* is a dict with keys: product, qty, price_unit.
Returns the confirmed sale.order record.
"""
order = self.env["sale.order"].create(
{
"partner_id": self.partner.id,
"order_line": [
Command.create(
{
"product_id": spec["product"].id,
"product_uom_qty": spec["qty"],
"price_unit": spec["price_unit"],
}
)
for spec in lines
],
}
)
order.action_confirm()
return order
# -------------------------------------------------------------------------
# sum_outstanding
# -------------------------------------------------------------------------
def test_outstanding_zero_before_delivery(self):
"""sum_outstanding is 0 when nothing has been delivered yet."""
order = self._make_order(
[{"product": self.product_storable, "qty": 5.0, "price_unit": 100.0}]
)
self.assertEqual(
order.sum_outstanding,
0.0,
"No delivery done yet — outstanding should be 0.",
)
def test_outstanding_after_partial_delivery(self):
"""sum_outstanding equals delivered-but-not-invoiced amount after partial delivery."""
order = self._make_order(
[{"product": self.product_storable, "qty": 10.0, "price_unit": 100.0}]
)
line = order.order_line
# Simulate partial delivery: 4 units delivered
line.qty_delivered = 4.0
# qty_to_invoice == qty_delivered - qty_invoiced == 4 - 0 == 4
self.assertAlmostEqual(order.sum_outstanding, 4.0 * 100.0)
def test_outstanding_after_full_delivery(self):
"""sum_outstanding equals full order amount when all is delivered but not invoiced."""
order = self._make_order(
[{"product": self.product_storable, "qty": 5.0, "price_unit": 200.0}]
)
order.order_line.qty_delivered = 5.0
self.assertAlmostEqual(order.sum_outstanding, 5.0 * 200.0)
def test_outstanding_zero_after_invoice(self):
"""sum_outstanding drops to 0 once the delivered qty has been fully invoiced."""
order = self._make_order(
[{"product": self.product_storable, "qty": 3.0, "price_unit": 100.0}]
)
line = order.order_line
line.qty_delivered = 3.0
# Simulate invoicing by setting qty_invoiced directly (bypass actual invoice flow)
line.qty_invoiced = 3.0
# qty_to_invoice = max(0, qty_delivered - qty_invoiced) = 0
self.assertAlmostEqual(order.sum_outstanding, 0.0)
def test_outstanding_multi_line(self):
"""sum_outstanding sums across all lines correctly."""
order = self._make_order(
[
{"product": self.product_storable, "qty": 2.0, "price_unit": 100.0},
{"product": self.product_service, "qty": 3.0, "price_unit": 50.0},
]
)
lines = order.order_line
lines[0].qty_delivered = 2.0 # outstanding: 2 × 100 = 200
lines[1].qty_delivered = 1.0 # outstanding: 1 × 50 = 50
self.assertAlmostEqual(order.sum_outstanding, 200.0 + 50.0)
# -------------------------------------------------------------------------
# sum_pending_work
# -------------------------------------------------------------------------
def test_pending_work_equals_full_qty_before_delivery(self):
"""sum_pending_work equals full order amount when nothing has been delivered."""
order = self._make_order(
[{"product": self.product_storable, "qty": 5.0, "price_unit": 100.0}]
)
self.assertAlmostEqual(
order.sum_pending_work,
5.0 * 100.0,
msg="No delivery done — pending work should equal full order amount.",
)
def test_pending_work_decreases_with_delivery(self):
"""sum_pending_work decreases as deliveries are recorded."""
order = self._make_order(
[{"product": self.product_storable, "qty": 10.0, "price_unit": 100.0}]
)
order.order_line.qty_delivered = 7.0
# Remaining: (10 - 7) × 100 = 300
self.assertAlmostEqual(order.sum_pending_work, 3.0 * 100.0)
def test_pending_work_zero_after_full_delivery(self):
"""sum_pending_work is 0 once everything has been delivered."""
order = self._make_order(
[{"product": self.product_storable, "qty": 5.0, "price_unit": 100.0}]
)
order.order_line.qty_delivered = 5.0
self.assertAlmostEqual(order.sum_pending_work, 0.0)
def test_pending_work_excludes_ordered_prepaid_service(self):
"""Products with service_policy='ordered_prepaid' are excluded from pending work."""
if "service_policy" not in self.env["product.template"]._fields:
self.skipTest("service_policy field not available (sale_project not installed)")
order = self._make_order(
[
{"product": self.product_storable, "qty": 2.0, "price_unit": 100.0},
# This line must be ignored in the pending work computation
{
"product": self.product_service_ordered,
"qty": 5.0,
"price_unit": 80.0,
},
]
)
# Only the storable product counts: 2 × 100 = 200
self.assertAlmostEqual(
order.sum_pending_work,
2.0 * 100.0,
msg=(
"ordered_prepaid service should be excluded; "
"only storable product pending work should be counted."
),
)
def test_pending_work_includes_non_ordered_prepaid_service(self):
"""Services with a delivery-based policy ARE included in pending work."""
order = self._make_order(
[
{"product": self.product_storable, "qty": 2.0, "price_unit": 100.0},
{"product": self.product_service, "qty": 4.0, "price_unit": 50.0},
]
)
# Both lines count: 2×100 + 4×50 = 400
self.assertAlmostEqual(order.sum_pending_work, 200.0 + 200.0)
def test_pending_work_multi_line_partial_delivery(self):
"""sum_pending_work aggregates remaining work across multiple partially delivered lines."""
order = self._make_order(
[
{"product": self.product_storable, "qty": 10.0, "price_unit": 100.0},
{"product": self.product_service, "qty": 8.0, "price_unit": 50.0},
]
)
lines = order.order_line
lines[0].qty_delivered = 6.0 # remaining: (10-6) × 100 = 400
lines[1].qty_delivered = 2.0 # remaining: (8-2) × 50 = 300
self.assertAlmostEqual(order.sum_pending_work, 400.0 + 300.0)
# -------------------------------------------------------------------------
# Edge cases
# -------------------------------------------------------------------------
def test_empty_order_both_fields_zero(self):
"""Both fields are 0 on an order with no lines."""
order = self.env["sale.order"].create({"partner_id": self.partner.id})
self.assertEqual(order.sum_outstanding, 0.0)
self.assertEqual(order.sum_pending_work, 0.0)
def test_recompute_on_qty_change(self):
"""Fields recompute correctly when ordered quantity is updated."""
order = self._make_order(
[{"product": self.product_storable, "qty": 5.0, "price_unit": 100.0}]
)
self.assertAlmostEqual(order.sum_pending_work, 5.0 * 100.0)
order.order_line.product_uom_qty = 8.0
self.assertAlmostEqual(order.sum_pending_work, 8.0 * 100.0)

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_order_form_inherit_outstanding" model="ir.ui.view">
<field name="name">sale.order.view.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<group name="sale_total" position="after">
<group name="outstanding" class="oe_subtotal_footer">
<field name="sum_outstanding" />
<field name="sum_pending_work" />
</group>
</group>
</field>
</record>
<record id="view_order_tree_inherit_outstanding" model="ir.ui.view">
<field name="name">sale.order.list.outstanding</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.sale_order_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_tax']" position="after">
<field name="sum_outstanding" sum="Outstanding Total" optional="hide" />
<field name="sum_pending_work" sum="Pending work Total" optional="hide" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,45 +0,0 @@
# Sale - Usability Misc
Miscellaneous usability improvements for the Odoo Sales app.
## Description
This module adjusts field visibility on the sale order form so that key
information is accessible to **Sales Managers** without requiring developer
mode.
### Changes
| Field | Default visibility | New visibility |
|---|---|---|
| **Order Date** (`date_order`) | Developer mode only (`base.group_no_one`) | Sales Managers (`sales_team.group_sale_manager`) |
| **Opportunity** (`opportunity_id`) | Developer mode only (`base.group_no_one`) | Sales Managers (`sales_team.group_sale_manager`) |
## Usage
Once installed, users with the *Sales / Manager* role can see and edit the
**Order Date** and **Opportunity** fields directly on the sale order form,
without activating developer mode.
No configuration is required.
## Installation
Install via the standard Odoo module installation procedure.
**Dependencies:** `base`, `sale`, `sales_team`, `sale_crm`
## Credits
### Authors
- [Elabore](https://elabore.coop)
### Maintainer
This module is maintained by [Elabore](https://elabore.coop).
## License
This module is licensed under **AGPL-3**. See the [LICENSE](LICENSE) file for
full details.

View File

@@ -0,0 +1,50 @@
===============
sale_usability_misc
===============
Various improves for Sales app
Installation
============
Use Odoo normal module installation procedure to install
``sale_usability_misc``.
Description
===========
- Allow group sales administores to see date_order field event if not in developper mode
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/sale_usability_misc/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.
Credits
=======
Contributors
------------
* `Elabore <mailto:laetitia.dacosta@elabore.coop>`
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -3,7 +3,7 @@
{
"name": "sale_usability_misc",
"version": "18.0.1.0.0",
"version": "16.0.1.0.1",
"author": "Elabore",
"website": "https://elabore.coop",
"maintainer": "Elabore",