Compare commits

...

3 commits

16 changed files with 370 additions and 1 deletions

View file

@ -0,0 +1,66 @@
# Purchase Invoice Subtotal with Taxes
## Description
This module adds two optional columns to purchase orders and invoices to display the subtotal both with and without taxes, regardless of the tax configuration in Odoo.
### Problem
By default, Odoo only shows one subtotal column in purchase orders and invoices based on the tax configuration:
- If taxes are configured as "included in price", it shows the total with taxes
- If taxes are configured as "excluded from price", it shows the total without taxes
However, in some cases, users need to see **both** values at the same time for comparison or reporting purposes.
### Solution
This module adds two new optional columns:
- **Subtotal (No Tax)**: Always shows the line subtotal without taxes included
- **Subtotal (Tax Incl.)**: Always shows the line subtotal with taxes included
These columns are available in:
- Purchase order lines
- Invoice lines (customer and vendor invoices)
Both columns are hidden by default (optional="hide") and can be shown by users as needed using the column visibility controls.
## Installation
1. Install the module from the Apps menu
2. No additional configuration is required
## Usage
After installation:
1. Go to a purchase order or invoice
2. In the lines view, click on the column selector (≡ icon)
3. Enable "Subtotal (No Tax)" and/or "Subtotal (Tax Incl.)" columns
4. Both values will be displayed regardless of your tax configuration
## Technical Details
The module creates two computed fields on:
- `purchase.order.line`: `price_subtotal_no_tax` and `price_subtotal_with_tax`
- `account.move.line`: `price_subtotal_no_tax` and `price_subtotal_with_tax`
These fields are based on the existing `price_subtotal` (without tax) and `price_total` (with tax) fields, ensuring consistency with Odoo's core calculations.
## Bug Tracker
Bugs are tracked on [GitHub Issues](https://github.com/OCA/account-invoicing/issues).
## Credits
### Contributors
* Criptomart
### Maintainers
This module is maintained by the OCA.
## Compatibility
- Odoo 16.0
- purchase
- account

View file

@ -0,0 +1,16 @@
# Copyright 2025 Criptomart
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Purchase Invoice Subtotal with Taxes",
"version": "16.0.1.0.0",
"summary": "Show both subtotal with and without taxes as optional columns",
"license": "AGPL-3",
"author": "Criptomart, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"depends": ["purchase", "account"],
"data": [
"views/purchase_order_view.xml",
"views/account_move_view.xml",
],
"installable": True,
}

View file

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoice_subtotal_taxes
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-04 16:53+0000\n"
"PO-Revision-Date: 2025-12-04 16:53+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: purchase_invoice_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.purchase_order_form_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.view_move_form_subtotal_taxes
msgid "Subtotal (No Tax)"
msgstr "Subtotal (Sin Imp.)"
#. module: purchase_invoice_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.purchase_order_form_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.view_move_form_subtotal_taxes
msgid "Subtotal (Tax Incl.)"
msgstr "Subtotal (Con Imp.)"

View file

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_invoice_subtotal_taxes
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-04 16:53+0000\n"
"PO-Revision-Date: 2025-12-04 16:53+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: purchase_invoice_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.purchase_order_form_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.view_move_form_subtotal_taxes
msgid "Subtotal (No Tax)"
msgstr ""
#. module: purchase_invoice_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.purchase_order_form_subtotal_taxes
#: model_terms:ir.ui.view,arch_db:purchase_invoice_subtotal_taxes.view_move_form_subtotal_taxes
msgid "Subtotal (Tax Incl.)"
msgstr ""

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Make both price_subtotal and price_total always visible as optional columns -->
<record id="view_move_form_subtotal_taxes" model="ir.ui.view">
<field name="name">account.move.form.subtotal.taxes</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<!-- Remove group restriction from price_subtotal -->
<xpath
expr="//field[@name='invoice_line_ids']//tree//field[@name='price_subtotal']"
position="attributes"
>
<attribute name="groups"></attribute>
<attribute name="optional">show</attribute>
<attribute name="string">Subtotal (No Tax)</attribute>
</xpath>
<!-- Remove group restriction from price_total -->
<xpath
expr="//field[@name='invoice_line_ids']//tree//field[@name='price_total']"
position="attributes"
>
<attribute name="groups"></attribute>
<attribute name="optional">show</attribute>
<attribute name="string">Subtotal (Tax Incl.)</attribute>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Make price_total visible as optional column in purchase order lines -->
<record id="purchase_order_form_subtotal_taxes" model="ir.ui.view">
<field name="name">purchase.order.form.subtotal.taxes</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="arch" type="xml">
<!-- Make price_total (Subtotal with tax) visible and optional -->
<xpath
expr="//field[@name='order_line']//tree//field[@name='price_total']"
position="attributes"
>
<attribute name="invisible">0</attribute>
<attribute name="optional">hide</attribute>
<attribute name="string">Subtotal (Tax Incl.)</attribute>
</xpath>
<!-- Make price_subtotal (Subtotal without tax) optional -->
<xpath
expr="//field[@name='order_line']//tree//field[@name='price_subtotal']"
position="attributes"
>
<attribute name="optional">show</attribute>
<attribute name="string">Subtotal (No Tax)</attribute>
</xpath>
</field>
</record>
</odoo>

View file

@ -110,4 +110,7 @@ class StockQuant(models.Model):
This may need review to ensure it doesn't conflict This may need review to ensure it doesn't conflict
with standard Odoo behavior. with standard Odoo behavior.
""" """
if self.product_tmpl_id.active:
_logger.debug("Preventing automatic unlinking of zero quants") _logger.debug("Preventing automatic unlinking of zero quants")
else:
super()._unlink_zero_quants()

View file

@ -0,0 +1,57 @@
# Stock Valuation Layer Category Groupby
## Description
This module allows grouping by product category in the stock valuation layer reports.
### Problem
By default, the `categ_id` field in `stock.valuation.layer` is a related field without storage (`store=False`). This means it cannot be used for grouping in reports and pivot views, even though it can be used for filtering and searching.
### Solution
This module makes the `categ_id` field stored (`store=True`) and indexed, which enables:
- Grouping by product category in list views
- Grouping by product category in pivot views
- Grouping by product category in graph views
- Better performance when filtering by category
## Installation
1. Install the module from the Apps menu
2. The field will be automatically populated for existing records
## Usage
After installation:
1. Go to Inventory > Reporting > Inventory Valuation
2. Switch to Pivot or Graph view
3. Click on "Measures" or group options
4. You will now see "Product Category" available for grouping
## Technical Details
The module extends `stock.valuation.layer` model and modifies the `categ_id` field to:
- `store=True`: Store the value in the database
- `index=True`: Add database index for better performance
The field remains a related field, so it will automatically update when the product category changes.
## Bug Tracker
Bugs are tracked on [GitHub Issues](https://github.com/OCA/stock-logistics-warehouse/issues).
## Credits
### Contributors
* Criptomart
### Maintainers
This module is maintained by the OCA.
## Compatibility
- Odoo 16.0
- stock_account

View file

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

View file

@ -0,0 +1,13 @@
# Copyright 2025 Criptomart
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Stock Valuation Layer Category Groupby",
"version": "16.0.1.0.0",
"summary": "Allow grouping by product category in stock valuation layer reports",
"license": "AGPL-3",
"author": "Criptomart",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"depends": ["stock_account"],
"data": ["views/stock_valuation_layer_views.xml"],
"installable": True,
}

View file

@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_valuation_layer_category_groupby
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-04 17:24+0000\n"
"PO-Revision-Date: 2025-12-04 17:24+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: stock_valuation_layer_category_groupby
#: model:ir.model.fields,field_description:stock_valuation_layer_category_groupby.field_stock_valuation_layer__categ_id
#: model_terms:ir.ui.view,arch_db:stock_valuation_layer_category_groupby.view_inventory_valuation_search_category
msgid "Product Category"
msgstr "Categoría de producto"
#. module: stock_valuation_layer_category_groupby
#: model:ir.model.fields,field_description:stock_valuation_layer_category_groupby.field_stock_valuation_layer__smart_search
msgid "Smart Search"
msgstr "Búsqueda inteligente"
#. module: stock_valuation_layer_category_groupby
#: model:ir.model,name:stock_valuation_layer_category_groupby.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr "Nivel de Valoración de Existencias"

View file

@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_valuation_layer_category_groupby
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-04 17:24+0000\n"
"PO-Revision-Date: 2025-12-04 17:24+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: stock_valuation_layer_category_groupby
#: model:ir.model.fields,field_description:stock_valuation_layer_category_groupby.field_stock_valuation_layer__categ_id
#: model_terms:ir.ui.view,arch_db:stock_valuation_layer_category_groupby.view_inventory_valuation_search_category
msgid "Product Category"
msgstr ""
#. module: stock_valuation_layer_category_groupby
#: model:ir.model.fields,field_description:stock_valuation_layer_category_groupby.field_stock_valuation_layer__smart_search
msgid "Smart Search"
msgstr ""
#. module: stock_valuation_layer_category_groupby
#: model:ir.model,name:stock_valuation_layer_category_groupby.model_stock_valuation_layer
msgid "Stock Valuation Layer"
msgstr ""

View file

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

View file

@ -0,0 +1,11 @@
# Copyright 2025 Criptomart
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class StockValuationLayer(models.Model):
_inherit = "stock.valuation.layer"
# Make categ_id stored to allow grouping in reports
categ_id = fields.Many2one(store=True, index=True)

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Add Product Category to group by options -->
<record id="view_inventory_valuation_search_category" model="ir.ui.view">
<field name="name">stock.valuation.layer.search.category</field>
<field name="model">stock.valuation.layer</field>
<field name="inherit_id" ref="stock_account.view_inventory_valuation_search" />
<field name="arch" type="xml">
<filter name="group_by_product_id" position="after">
<filter
string="Product Category"
name="group_by_categ_id"
context="{'group_by': 'categ_id'}"
/>
</filter>
</field>
</record>
</odoo>