[16.0] add purchase_report_received_amount
This commit is contained in:
parent
bf02699b61
commit
d9a0eeb878
7 changed files with 193 additions and 0 deletions
47
purchase_report_received_amount/README.rst
Normal file
47
purchase_report_received_amount/README.rst
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
================================
|
||||||
|
Purchase Report Received Amount
|
||||||
|
================================
|
||||||
|
|
||||||
|
This module adds two new measures to the Purchase Report (purchase.report):
|
||||||
|
|
||||||
|
* **Received Amount**: The monetary value of received quantities with discounts applied
|
||||||
|
* **Received Amount (Undiscounted)**: The monetary value of received quantities without discounts
|
||||||
|
|
||||||
|
Features
|
||||||
|
========
|
||||||
|
|
||||||
|
* Adds ``price_received`` field: Amount of received quantity with discount applied
|
||||||
|
* Adds ``price_received_undiscounted`` field: Amount of received quantity without discount
|
||||||
|
* Both fields are converted to company currency for multi-currency support
|
||||||
|
* Compatible with unit of measure conversions
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
Install the module from the Odoo Apps menu.
|
||||||
|
|
||||||
|
This module depends on:
|
||||||
|
* ``purchase``
|
||||||
|
* ``purchase_discount`` (OCA)
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
=============
|
||||||
|
|
||||||
|
No configuration needed. After installation, the new measures will be available
|
||||||
|
in the Purchase Analysis report.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
1. Go to Purchase > Reporting > Purchase Analysis
|
||||||
|
2. Click on "Measures" button
|
||||||
|
3. Select "Received Amount" or "Received Amount (Undiscounted)"
|
||||||
|
4. The pivot/graph view will display the values
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
* Criptomart
|
||||||
1
purchase_report_received_amount/__init__.py
Normal file
1
purchase_report_received_amount/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
from . import report
|
||||||
13
purchase_report_received_amount/__manifest__.py
Normal file
13
purchase_report_received_amount/__manifest__.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "Purchase Report Received Amount",
|
||||||
|
"version": "16.0.1.0.0",
|
||||||
|
"depends": ["purchase", "purchase_discount"],
|
||||||
|
"author": "Criptomart",
|
||||||
|
"category": "Purchases",
|
||||||
|
"summary": "Add received amount measures to purchase report",
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"data": [],
|
||||||
|
"installable": True,
|
||||||
|
"application": False,
|
||||||
|
"auto_install": False,
|
||||||
|
}
|
||||||
48
purchase_report_received_amount/i18n/es.po
Normal file
48
purchase_report_received_amount/i18n/es.po
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * purchase_report_received_amount
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 16.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2026-03-09 16:04+0000\n"
|
||||||
|
"PO-Revision-Date: 2026-03-09 17:07+0100\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: es\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Generator: Poedit 3.8\n"
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,help:purchase_report_received_amount.field_purchase_report__price_received
|
||||||
|
msgid "Amount of received quantity (with discount applied)"
|
||||||
|
msgstr "Precio total recibido (con descuentos aplicados)"
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,help:purchase_report_received_amount.field_purchase_report__price_received_undiscounted
|
||||||
|
msgid "Amount of received quantity without discount"
|
||||||
|
msgstr "Precio total recibido (sin descuentos aplicados)"
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model,name:purchase_report_received_amount.model_purchase_report
|
||||||
|
msgid "Purchase Report"
|
||||||
|
msgstr "Informe de compra"
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,field_description:purchase_report_received_amount.field_purchase_report__price_received
|
||||||
|
msgid "Received Amount"
|
||||||
|
msgstr "Precio total recibido"
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,field_description:purchase_report_received_amount.field_purchase_report__price_received_undiscounted
|
||||||
|
msgid "Received Amount (Undiscounted)"
|
||||||
|
msgstr "Precio total recibido sin descuentos"
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,field_description:purchase_report_received_amount.field_purchase_report__smart_search
|
||||||
|
msgid "Smart Search"
|
||||||
|
msgstr "Búsqueda inteligente"
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * purchase_report_received_amount
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 16.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2026-03-09 16:03+0000\n"
|
||||||
|
"PO-Revision-Date: 2026-03-09 16: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: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,help:purchase_report_received_amount.field_purchase_report__price_received
|
||||||
|
msgid "Amount of received quantity (with discount applied)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,help:purchase_report_received_amount.field_purchase_report__price_received_undiscounted
|
||||||
|
msgid "Amount of received quantity without discount"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model,name:purchase_report_received_amount.model_purchase_report
|
||||||
|
msgid "Purchase Report"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,field_description:purchase_report_received_amount.field_purchase_report__price_received
|
||||||
|
msgid "Received Amount"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,field_description:purchase_report_received_amount.field_purchase_report__price_received_undiscounted
|
||||||
|
msgid "Received Amount (Undiscounted)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: purchase_report_received_amount
|
||||||
|
#: model:ir.model.fields,field_description:purchase_report_received_amount.field_purchase_report__smart_search
|
||||||
|
msgid "Smart Search"
|
||||||
|
msgstr ""
|
||||||
1
purchase_report_received_amount/report/__init__.py
Normal file
1
purchase_report_received_amount/report/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
from . import purchase_report
|
||||||
37
purchase_report_received_amount/report/purchase_report.py
Normal file
37
purchase_report_received_amount/report/purchase_report.py
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Copyright 2024 Criptomart
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseReport(models.Model):
|
||||||
|
_inherit = "purchase.report"
|
||||||
|
|
||||||
|
price_received = fields.Float(
|
||||||
|
string="Received Amount",
|
||||||
|
readonly=True,
|
||||||
|
help="Amount of received quantity (with discount applied)",
|
||||||
|
)
|
||||||
|
price_received_undiscounted = fields.Float(
|
||||||
|
string="Received Amount (Undiscounted)",
|
||||||
|
readonly=True,
|
||||||
|
help="Amount of received quantity without discount",
|
||||||
|
)
|
||||||
|
|
||||||
|
def _select(self):
|
||||||
|
res = super()._select()
|
||||||
|
# Add received amount with discount (uses the already discounted price from purchase_discount)
|
||||||
|
res += """,
|
||||||
|
sum(
|
||||||
|
l.qty_received / line_uom.factor * product_uom.factor
|
||||||
|
* (1.0 - COALESCE(l.discount, 0.0) / 100.0) * l.price_unit
|
||||||
|
/ COALESCE(po.currency_rate, 1.0)
|
||||||
|
)::decimal(16,2) * currency_table.rate as price_received"""
|
||||||
|
# Add received amount without discount
|
||||||
|
res += """,
|
||||||
|
sum(
|
||||||
|
l.qty_received / line_uom.factor * product_uom.factor
|
||||||
|
* l.price_unit
|
||||||
|
/ COALESCE(po.currency_rate, 1.0)
|
||||||
|
)::decimal(16,2) * currency_table.rate as price_received_undiscounted"""
|
||||||
|
return res
|
||||||
Loading…
Add table
Add a link
Reference in a new issue