Criptomart/red-supermercados-coop#5 add purchase_invoice_subtotal_taxes
This commit is contained in:
parent
9daf707f40
commit
18f98defeb
7 changed files with 199 additions and 0 deletions
66
purchase_invoice_subtotal_taxes/README.md
Normal file
66
purchase_invoice_subtotal_taxes/README.md
Normal 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
|
||||
0
purchase_invoice_subtotal_taxes/__init__.py
Normal file
0
purchase_invoice_subtotal_taxes/__init__.py
Normal file
16
purchase_invoice_subtotal_taxes/__manifest__.py
Normal file
16
purchase_invoice_subtotal_taxes/__manifest__.py
Normal 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,
|
||||
}
|
||||
28
purchase_invoice_subtotal_taxes/i18n/es.po
Normal file
28
purchase_invoice_subtotal_taxes/i18n/es.po
Normal 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.)"
|
||||
|
|
@ -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 ""
|
||||
31
purchase_invoice_subtotal_taxes/views/account_move_view.xml
Normal file
31
purchase_invoice_subtotal_taxes/views/account_move_view.xml
Normal 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>
|
||||
|
|
@ -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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue