mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[12.0][ADD]stock_inventory_valuation_report
This commit is contained in:
committed by
Alessandro Uffreduzzi
parent
e21f90f2ff
commit
e82a14bed6
82
stock_inventory_valuation_report/README.rst
Normal file
82
stock_inventory_valuation_report/README.rst
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
================================
|
||||||
|
Stock Inventory Valuation Report
|
||||||
|
================================
|
||||||
|
|
||||||
|
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! 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-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github
|
||||||
|
:target: https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_inventory_valuation_report
|
||||||
|
:alt: OCA/stock-logistics-reporting
|
||||||
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
|
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-12-0/stock-logistics-reporting-12-0-stock_inventory_valuation_report
|
||||||
|
:alt: Translate me on Weblate
|
||||||
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
|
:target: https://runbot.odoo-community.org/runbot/151/12.0
|
||||||
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
|
Stock Inventory Valuation Report is the report that display value of all products in internal location.
|
||||||
|
|
||||||
|
**Table of contents**
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
To use this module, you need to:
|
||||||
|
|
||||||
|
#. Go to Inventory > Reporting > Inventory Valuation.
|
||||||
|
#. Select Compute (Current Inventory or At a Specific Date).
|
||||||
|
#. Choose Retrieve the inventory valuation or View report or Export PDF or Export XLSX or Cancel.
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/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/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_inventory_valuation_report%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
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
* Ecosoft
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
|
||||||
|
|
||||||
|
Maintainers
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
|
.. image:: https://odoo-community.org/logo.png
|
||||||
|
:alt: Odoo Community Association
|
||||||
|
:target: https://odoo-community.org
|
||||||
|
|
||||||
|
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
|
mission is to support the collaborative development of Odoo features and
|
||||||
|
promote its widespread use.
|
||||||
|
|
||||||
|
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_inventory_valuation_report>`_ project on GitHub.
|
||||||
|
|
||||||
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
5
stock_inventory_valuation_report/__init__.py
Normal file
5
stock_inventory_valuation_report/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from . import wizard
|
||||||
|
from . import reports
|
||||||
23
stock_inventory_valuation_report/__manifest__.py
Normal file
23
stock_inventory_valuation_report/__manifest__.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Stock Inventory Valuation Report',
|
||||||
|
'summary': 'Add report button on Inventory Valuation.',
|
||||||
|
'version': '12.0.1.0.0',
|
||||||
|
'category': 'Warehouse',
|
||||||
|
'website': 'https://github.com/OCA/stock-logistics-reporting',
|
||||||
|
'author': 'Ecosoft,Odoo Community Association (OCA)',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'depends': [
|
||||||
|
'stock_account',
|
||||||
|
'report_xlsx_helper',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'data/paper_format.xml',
|
||||||
|
'data/report_data.xml',
|
||||||
|
'reports/stock_inventory_valuation_report.xml',
|
||||||
|
'wizard/stock_quantity_history_view.xml',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
}
|
||||||
19
stock_inventory_valuation_report/data/paper_format.xml
Normal file
19
stock_inventory_valuation_report/data/paper_format.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="paperformat_inventory_valuation_report" model="report.paperformat">
|
||||||
|
<field name="name">Inventory Valuation Report A4</field>
|
||||||
|
<field name="default" eval="True"/>
|
||||||
|
<field name="format">A4</field>
|
||||||
|
<field name="page_height">0</field>
|
||||||
|
<field name="page_width">0</field>
|
||||||
|
<field name="orientation">Portrait</field>
|
||||||
|
<field name="margin_top">28</field>
|
||||||
|
<field name="margin_bottom">28</field>
|
||||||
|
<field name="margin_left">7</field>
|
||||||
|
<field name="margin_right">7</field>
|
||||||
|
<field name="header_line" eval="False"/>
|
||||||
|
<field name="header_spacing">24</field>
|
||||||
|
<field name="dpi">90</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
26
stock_inventory_valuation_report/data/report_data.xml
Normal file
26
stock_inventory_valuation_report/data/report_data.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="action_stock_inventory_valuation_report_html" model="ir.actions.client">
|
||||||
|
<field name="name">Inventory Valuation Report</field>
|
||||||
|
<field name="tag">stock_inventory_valuation_report_backend</field>
|
||||||
|
<field name="context" eval="{'active_model': 'report.stock.inventory.valuation.report'}" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<report string="Stock Inventory Valuation Report PDF"
|
||||||
|
id="action_stock_inventory_valuation_report_pdf"
|
||||||
|
model="report.stock.inventory.valuation.report"
|
||||||
|
name="stock_inventory_valuation_report.report_stock_inventory_valuation_report_pdf"
|
||||||
|
file="stock_inventory_valuation_report.report_stock_inventory_valuation_report_pdf"
|
||||||
|
report_type="qweb-pdf"
|
||||||
|
print_report_name="'Inventory Valuation Report - [%s]' % object.date"
|
||||||
|
paperformat="stock_inventory_valuation_report.paperformat_inventory_valuation_report"/>
|
||||||
|
|
||||||
|
<report string="Stock Inventory Valuation Report XLSX"
|
||||||
|
id="action_stock_inventory_valuation_report_xlsx"
|
||||||
|
model="report.stock.inventory.valuation.report"
|
||||||
|
name="s_i_v_r.report_stock_inventory_valuation_report_xlsx"
|
||||||
|
file="Inventory Valuation Report"
|
||||||
|
report_type="xlsx"
|
||||||
|
attachment_use="False"/>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * stock_inventory_valuation_report
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 12.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \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_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_buttons
|
||||||
|
msgid "<span class=\"fa fa-download\"/>Export"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_buttons
|
||||||
|
msgid "<span class=\"fa fa-print\"/>Print"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__company_id
|
||||||
|
msgid "Company"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__compute_at_date
|
||||||
|
msgid "Compute At Date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header
|
||||||
|
msgid "Cost"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__cost_currency_id
|
||||||
|
msgid "Cost Currency"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__cost_method
|
||||||
|
msgid "Cost Method"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__create_uid
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__create_uid
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__create_uid
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__create_date
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__create_date
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__create_date
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__currency_id
|
||||||
|
msgid "Currency"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__date
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_report_filters
|
||||||
|
msgid "Date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__display_name
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__display_name
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__display_name
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header
|
||||||
|
msgid "Display Name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.view_stock_quantity_history_inherit
|
||||||
|
msgid "Export PDF"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.view_stock_quantity_history_inherit
|
||||||
|
msgid "Export XLSX"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__id
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__id
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__id
|
||||||
|
msgid "ID"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.actions.client,name:stock_inventory_valuation_report.action_stock_inventory_valuation_report_html
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_report_base
|
||||||
|
msgid "Inventory Valuation Report"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx____last_update
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report____last_update
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view____last_update
|
||||||
|
msgid "Last Modified on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__write_uid
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__write_uid
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__write_uid
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx__write_date
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__write_date
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__write_date
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_report_filters
|
||||||
|
msgid "Partner"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__qty_at_date
|
||||||
|
msgid "Qty At Date"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header
|
||||||
|
msgid "Quantity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__results
|
||||||
|
msgid "Results"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__standard_price
|
||||||
|
msgid "Standard Price"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model,name:stock_inventory_valuation_report.model_report_stock_inventory_valuation_report
|
||||||
|
msgid "Stock Inventory Valuation Report"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.actions.report,name:stock_inventory_valuation_report.action_stock_inventory_valuation_report_pdf
|
||||||
|
msgid "Stock Inventory Valuation Report PDF"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.actions.report,name:stock_inventory_valuation_report.action_stock_inventory_valuation_report_xlsx
|
||||||
|
msgid "Stock Inventory Valuation Report XLSX"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model,name:stock_inventory_valuation_report.model_stock_inventory_valuation_view
|
||||||
|
msgid "Stock Inventory Valuation View"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model,name:stock_inventory_valuation_report.model_stock_quantity_history
|
||||||
|
msgid "Stock Quantity History"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__stock_value
|
||||||
|
msgid "Stock Value"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_report_filters
|
||||||
|
msgid "Tax ID"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,field_description:stock_inventory_valuation_report.field_stock_inventory_valuation_view__uom_id
|
||||||
|
msgid "Uom"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model.fields,help:stock_inventory_valuation_report.field_report_stock_inventory_valuation_report__results
|
||||||
|
msgid "Use compute fields, so there is nothing store in database"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header
|
||||||
|
msgid "Value"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.view_stock_quantity_history_inherit
|
||||||
|
msgid "View report"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_inventory_valuation_report
|
||||||
|
#: model:ir.model,name:stock_inventory_valuation_report.model_report_s_i_v_r_report_stock_inventory_valuation_report_xlsx
|
||||||
|
msgid "report.s_i_v_r.report_stock_inventory_valuation_report_xlsx"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
1
stock_inventory_valuation_report/readme/CONTRIBUTORS.rst
Normal file
1
stock_inventory_valuation_report/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
|
||||||
1
stock_inventory_valuation_report/readme/DESCRIPTION.rst
Normal file
1
stock_inventory_valuation_report/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Stock Inventory Valuation Report is the report that display value of all products in internal location.
|
||||||
5
stock_inventory_valuation_report/readme/USAGE.rst
Normal file
5
stock_inventory_valuation_report/readme/USAGE.rst
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
To use this module, you need to:
|
||||||
|
|
||||||
|
#. Go to Inventory > Reporting > Inventory Valuation.
|
||||||
|
#. Select Compute (Current Inventory or At a Specific Date).
|
||||||
|
#. Choose Retrieve the inventory valuation or View report or Export PDF or Export XLSX or Cancel.
|
||||||
5
stock_inventory_valuation_report/reports/__init__.py
Normal file
5
stock_inventory_valuation_report/reports/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from . import stock_inventory_valuation_report
|
||||||
|
from . import stock_inventory_valuation_report_xlsx
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class StockInventoryValuationView(models.TransientModel):
|
||||||
|
_name = 'stock.inventory.valuation.view'
|
||||||
|
_description = 'Stock Inventory Valuation View'
|
||||||
|
|
||||||
|
display_name = fields.Char()
|
||||||
|
qty_at_date = fields.Float()
|
||||||
|
uom_id = fields.Many2one(
|
||||||
|
comodel_name='uom.uom',
|
||||||
|
)
|
||||||
|
currency_id = fields.Many2one(
|
||||||
|
comodel_name='res.currency',
|
||||||
|
)
|
||||||
|
cost_currency_id = fields.Many2one(
|
||||||
|
comodel_name='res.currency',
|
||||||
|
)
|
||||||
|
standard_price = fields.Float()
|
||||||
|
stock_value = fields.Float()
|
||||||
|
cost_method = fields.Char()
|
||||||
|
|
||||||
|
|
||||||
|
class StockInventoryValuationReport(models.TransientModel):
|
||||||
|
_name = 'report.stock.inventory.valuation.report'
|
||||||
|
_description = 'Stock Inventory Valuation Report'
|
||||||
|
|
||||||
|
# Filters fields, used for data computation
|
||||||
|
company_id = fields.Many2one(
|
||||||
|
comodel_name='res.company',
|
||||||
|
)
|
||||||
|
compute_at_date = fields.Integer()
|
||||||
|
date = fields.Datetime()
|
||||||
|
|
||||||
|
# Data fields, used to browse report data
|
||||||
|
results = fields.Many2many(
|
||||||
|
comodel_name='stock.inventory.valuation.view',
|
||||||
|
compute='_compute_results',
|
||||||
|
help='Use compute fields, so there is nothing store in database',
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _compute_results(self):
|
||||||
|
self.ensure_one()
|
||||||
|
if not self.compute_at_date:
|
||||||
|
self.date = fields.Datetime.now()
|
||||||
|
products = self.env['product.product'].\
|
||||||
|
search([('type', '=', 'product'), ('qty_available', '!=', 0)]).\
|
||||||
|
with_context(dict(to_date=self.date, company_owned=True,
|
||||||
|
create=False, edit=False))
|
||||||
|
ReportLine = self.env['stock.inventory.valuation.view']
|
||||||
|
for product in products:
|
||||||
|
line = {
|
||||||
|
'display_name': product.display_name,
|
||||||
|
'qty_at_date': product.qty_at_date,
|
||||||
|
'uom_id': product.uom_id,
|
||||||
|
'currency_id': product.currency_id,
|
||||||
|
'cost_currency_id': product.cost_currency_id,
|
||||||
|
'standard_price': product.standard_price,
|
||||||
|
'stock_value': product.stock_value,
|
||||||
|
'cost_method': product.cost_method,
|
||||||
|
}
|
||||||
|
if product.qty_at_date != 0:
|
||||||
|
self.results += ReportLine.new(line)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def print_report(self, report_type='qweb'):
|
||||||
|
self.ensure_one()
|
||||||
|
action = report_type == 'xlsx' and self.env.ref(
|
||||||
|
'stock_inventory_valuation_report.'
|
||||||
|
'action_stock_inventory_valuation_report_xlsx') or \
|
||||||
|
self.env.ref('stock_inventory_valuation_report.'
|
||||||
|
'action_stock_inventory_valuation_report_pdf')
|
||||||
|
return action.report_action(self, config=False)
|
||||||
|
|
||||||
|
def _get_html(self):
|
||||||
|
result = {}
|
||||||
|
rcontext = {}
|
||||||
|
report = self.browse(self._context.get('active_id'))
|
||||||
|
if report:
|
||||||
|
rcontext['o'] = report
|
||||||
|
result['html'] = self.env.ref(
|
||||||
|
'stock_inventory_valuation_report.'
|
||||||
|
'report_stock_inventory_valuation_report_html').render(
|
||||||
|
rcontext)
|
||||||
|
return result
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def get_html(self, given_context=None):
|
||||||
|
return self.with_context(given_context)._get_html()
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
<odoo>
|
||||||
|
|
||||||
|
<template id="assets_backend" name="stock_inventory_valuation_report assets" inherit_id="web.assets_backend">
|
||||||
|
<xpath expr="." position="inside">
|
||||||
|
<link href="/stock_inventory_valuation_report/static/src/css/report.css" rel="stylesheet"/>
|
||||||
|
<script type="text/javascript" src="/stock_inventory_valuation_report/static/src/js/stock_inventory_valuation_report_backend.js"/>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="stock_inventory_valuation_report.internal_layout">
|
||||||
|
<div class="article">
|
||||||
|
<link href="/stock_inventory_valuation_report/static/src/css/report.css" rel="stylesheet"/>
|
||||||
|
<t t-raw="0"/>
|
||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6 custom_footer">
|
||||||
|
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 text-right custom_footer">
|
||||||
|
<span class="page"/>/<span class="topage"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="report_buttons">
|
||||||
|
<div class="button_row">
|
||||||
|
<button class="o_stock_inventory_valuation_report_print btn btn-sm oe_button"><span class="fa fa-print"/>Print</button>
|
||||||
|
<button class="o_stock_inventory_valuation_report_export btn btn-sm oe_button"><span class="fa fa-download"/>Export</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="report_stock_inventory_valuation_report_html">
|
||||||
|
<div class="o_stock_inventory_valuation_report_page">
|
||||||
|
<t t-call="stock_inventory_valuation_report.report_buttons"/>
|
||||||
|
<t t-call="stock_inventory_valuation_report.report_stock_inventory_valuation_report_base"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="stock_inventory_valuation_report.report_stock_inventory_valuation_report_pdf">
|
||||||
|
<t t-call="web.html_container">
|
||||||
|
<t t-foreach="docs" t-as="o">
|
||||||
|
<t t-call="stock_inventory_valuation_report.internal_layout">
|
||||||
|
<t t-call="stock_inventory_valuation_report.report_stock_inventory_valuation_report_base"/>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="stock_inventory_valuation_report.report_stock_inventory_valuation_report_base">
|
||||||
|
<div class="page">
|
||||||
|
<div class="row">
|
||||||
|
<t t-set="title">Inventory Valuation Report</t>
|
||||||
|
<h4 class="mt0" t-esc="title" style="text-align: center;"/>
|
||||||
|
</div>
|
||||||
|
<!-- Display filters -->
|
||||||
|
<t t-call="stock_inventory_valuation_report.report_stock_inventory_valuation_report_filters"/>
|
||||||
|
<!-- Display stock card table -->
|
||||||
|
<div class="act_as_table data_table mt4" style="width: 100%;">
|
||||||
|
<!-- Display header line-->
|
||||||
|
<t t-call="stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header"/>
|
||||||
|
<!-- Display each lines -->
|
||||||
|
<t t-set="n" t-value="1"/>
|
||||||
|
<t t-set="total" t-value="0.00"/>
|
||||||
|
<t t-foreach="o.results" t-as="line">
|
||||||
|
<t t-call="stock_inventory_valuation_report.report_stock_inventory_valuation_lines"/>
|
||||||
|
<t t-set="n" t-value="n+1"/>
|
||||||
|
<t t-set="total" t-value="total+line.stock_value"/>
|
||||||
|
</t>
|
||||||
|
</div>
|
||||||
|
<!-- Display total lines -->
|
||||||
|
<t t-call="stock_inventory_valuation_report.report_stock_inventory_valuation_total_lines"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="stock_inventory_valuation_report.report_stock_inventory_valuation_report_filters">
|
||||||
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
|
<div class="act_as_row labels">
|
||||||
|
<div class="act_as_cell">Date</div>
|
||||||
|
<div class="act_as_cell">Partner</div>
|
||||||
|
<div class="act_as_cell">Tax ID</div>
|
||||||
|
</div>
|
||||||
|
<div class="act_as_row">
|
||||||
|
<div class="act_as_cell">
|
||||||
|
<span t-esc="o.date.strftime('%Y-%m-%d')"/>
|
||||||
|
</div>
|
||||||
|
<div class="act_as_cell">
|
||||||
|
<span t-field='o.company_id.name'/>
|
||||||
|
</div>
|
||||||
|
<div class="act_as_cell">
|
||||||
|
<span t-field='o.company_id.vat'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="stock_inventory_valuation_report.report_stock_inventory_valuation_lines_header">
|
||||||
|
<div class="act_as_thead">
|
||||||
|
<div class="act_as_row labels">
|
||||||
|
<div class="act_as_cell">#</div>
|
||||||
|
<div class="act_as_cell">Display Name</div>
|
||||||
|
<div class="act_as_cell">Quantity</div>
|
||||||
|
<div class="act_as_cell">Cost</div>
|
||||||
|
<div class="act_as_cell">Value</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="stock_inventory_valuation_report.report_stock_inventory_valuation_lines">
|
||||||
|
<div class="act_as_row lines">
|
||||||
|
<div class="act_as_cell left">
|
||||||
|
<t t-esc="n"/>
|
||||||
|
</div>
|
||||||
|
<div class="act_as_cell left">
|
||||||
|
<t t-esc="line.display_name"/>
|
||||||
|
</div>
|
||||||
|
<div class="act_as_cell right">
|
||||||
|
<t t-esc="'{0:,.3f}'.format(line.qty_at_date)"/>
|
||||||
|
</div>
|
||||||
|
<div class="act_as_cell amount">
|
||||||
|
<t t-esc="line.standard_price" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
||||||
|
</div>
|
||||||
|
<div class="act_as_cell amount">
|
||||||
|
<t t-esc="line.stock_value" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="stock_inventory_valuation_report.report_stock_inventory_valuation_total_lines">
|
||||||
|
<div class="act_as_table data_table mt0" style="width: 100%;">
|
||||||
|
<div class="total_row">
|
||||||
|
<t t-esc="total" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
import logging
|
||||||
|
from odoo import models
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class ReportStockInventoryValuationReportXlsx(models.TransientModel):
|
||||||
|
_name = 'report.s_i_v_r.report_stock_inventory_valuation_report_xlsx'
|
||||||
|
_inherit = 'report.report_xlsx.abstract'
|
||||||
|
|
||||||
|
def _get_ws_params(self, wb, data, objects):
|
||||||
|
|
||||||
|
stock_inventory_valuation_template = {
|
||||||
|
'1_number': {
|
||||||
|
'header': {
|
||||||
|
'value': '#',
|
||||||
|
},
|
||||||
|
'data': {
|
||||||
|
'value': self._render('n'),
|
||||||
|
},
|
||||||
|
'width': 12,
|
||||||
|
},
|
||||||
|
'2_display_name': {
|
||||||
|
'header': {
|
||||||
|
'value': 'Display Name',
|
||||||
|
},
|
||||||
|
'data': {
|
||||||
|
'value': self._render('display_name'),
|
||||||
|
},
|
||||||
|
'width': 36,
|
||||||
|
},
|
||||||
|
'3_qty_at_date': {
|
||||||
|
'header': {
|
||||||
|
'value': 'Quantity',
|
||||||
|
},
|
||||||
|
'data': {
|
||||||
|
'value': self._render('qty_at_date'),
|
||||||
|
'format': self.format_tcell_amount_conditional_right,
|
||||||
|
},
|
||||||
|
'width': 18,
|
||||||
|
},
|
||||||
|
'4_standard_price': {
|
||||||
|
'header': {
|
||||||
|
'value': 'Cost',
|
||||||
|
},
|
||||||
|
'data': {
|
||||||
|
'value': self._render('standard_price'),
|
||||||
|
'format': self.format_tcell_amount_conditional_right,
|
||||||
|
},
|
||||||
|
'width': 18,
|
||||||
|
},
|
||||||
|
'5_stock_value': {
|
||||||
|
'header': {
|
||||||
|
'value': 'Value',
|
||||||
|
},
|
||||||
|
'data': {
|
||||||
|
'value': self._render('stock_value'),
|
||||||
|
'format': self.format_tcell_amount_conditional_right,
|
||||||
|
},
|
||||||
|
'width': 18,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
ws_params = {
|
||||||
|
'ws_name': 'Inventory Valuation Report',
|
||||||
|
'generate_ws_method': '_inventory_valuation_report',
|
||||||
|
'title': 'Inventory Valuation Report',
|
||||||
|
'wanted_list': [k for k in sorted(
|
||||||
|
stock_inventory_valuation_template.keys())],
|
||||||
|
'col_specs': stock_inventory_valuation_template,
|
||||||
|
}
|
||||||
|
return [ws_params]
|
||||||
|
|
||||||
|
def _inventory_valuation_report(self, wb, ws, ws_params, data, objects):
|
||||||
|
|
||||||
|
ws.set_portrait()
|
||||||
|
ws.fit_to_pages(1, 0)
|
||||||
|
ws.set_header(self.xls_headers['standard'])
|
||||||
|
ws.set_footer(self.xls_footers['standard'])
|
||||||
|
|
||||||
|
self._set_column_width(ws, ws_params)
|
||||||
|
|
||||||
|
row_pos = 0
|
||||||
|
row_pos = self._write_ws_title(ws, row_pos, ws_params, True)
|
||||||
|
|
||||||
|
for o in objects:
|
||||||
|
ws.write_row(
|
||||||
|
row_pos, 0, ['Date', 'Partner', 'Tax ID'],
|
||||||
|
self.format_theader_blue_center)
|
||||||
|
ws.write_row(
|
||||||
|
row_pos+1, 0, [o.date or ''], self.format_tcell_date_center)
|
||||||
|
ws.write_row(
|
||||||
|
row_pos+1, 1,
|
||||||
|
[o.company_id.name or '', o.company_id.vat or ''],
|
||||||
|
self.format_tcell_center)
|
||||||
|
|
||||||
|
row_pos += 3
|
||||||
|
row_pos = self._write_line(
|
||||||
|
ws, row_pos, ws_params, col_specs_section='header',
|
||||||
|
default_format=self.format_theader_blue_center)
|
||||||
|
ws.freeze_panes(row_pos, 0)
|
||||||
|
|
||||||
|
total = 0.00
|
||||||
|
for line in o.results:
|
||||||
|
row_pos = self._write_line(
|
||||||
|
ws, row_pos, ws_params, col_specs_section='data',
|
||||||
|
render_space={
|
||||||
|
'n': row_pos-5,
|
||||||
|
'display_name': line.display_name or '',
|
||||||
|
'qty_at_date': line.qty_at_date or 0.000,
|
||||||
|
'standard_price': line.standard_price or 0.00,
|
||||||
|
'stock_value': line.stock_value or 0.00,
|
||||||
|
},
|
||||||
|
default_format=self.format_tcell_left)
|
||||||
|
total += line.stock_value
|
||||||
|
|
||||||
|
ws.write(row_pos, 4, total, self.format_theader_blue_amount_right)
|
||||||
BIN
stock_inventory_valuation_report/static/description/icon.png
Normal file
BIN
stock_inventory_valuation_report/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
429
stock_inventory_valuation_report/static/description/index.html
Normal file
429
stock_inventory_valuation_report/static/description/index.html
Normal file
@@ -0,0 +1,429 @@
|
|||||||
|
<?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>Stock Inventory Valuation Report</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="stock-inventory-valuation-report">
|
||||||
|
<h1 class="title">Stock Inventory Valuation Report</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/OCA/stock-logistics-reporting/tree/12.0/stock_inventory_valuation_report"><img alt="OCA/stock-logistics-reporting" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-reporting-12-0/stock-logistics-reporting-12-0-stock_inventory_valuation_report"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/151/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
|
<p>Stock Inventory Valuation Report is the report that display value of all products in internal location.</p>
|
||||||
|
<p><strong>Table of contents</strong></p>
|
||||||
|
<div class="contents local topic" id="contents">
|
||||||
|
<ul class="simple">
|
||||||
|
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
|
||||||
|
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
|
||||||
|
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
|
||||||
|
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
|
||||||
|
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
|
||||||
|
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="usage">
|
||||||
|
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
|
||||||
|
<p>To use this module, you need to:</p>
|
||||||
|
<ol class="arabic simple">
|
||||||
|
<li>Go to Inventory > Reporting > Inventory Valuation.</li>
|
||||||
|
<li>Select Compute (Current Inventory or At a Specific Date).</li>
|
||||||
|
<li>Choose Retrieve the inventory valuation or View report or Export PDF or Export XLSX or Cancel.</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="bug-tracker">
|
||||||
|
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
|
||||||
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/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/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_inventory_valuation_report%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="#id3">Credits</a></h1>
|
||||||
|
<div class="section" id="authors">
|
||||||
|
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Ecosoft</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="contributors">
|
||||||
|
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Pimolnat Suntian <<a class="reference external" href="mailto:pimolnats@ecosoft.co.th">pimolnats@ecosoft.co.th</a>></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="maintainers">
|
||||||
|
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
|
||||||
|
<p>This module is maintained by the OCA.</p>
|
||||||
|
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||||
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
|
mission is to support the collaborative development of Odoo features and
|
||||||
|
promote its widespread use.</p>
|
||||||
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_inventory_valuation_report">OCA/stock-logistics-reporting</a> project on GitHub.</p>
|
||||||
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
73
stock_inventory_valuation_report/static/src/css/report.css
Normal file
73
stock_inventory_valuation_report/static/src/css/report.css
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
.act_as_table {
|
||||||
|
display: table !important;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.act_as_row {
|
||||||
|
display: table-row !important;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
.act_as_cell {
|
||||||
|
display: table-cell !important;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
.act_as_thead {
|
||||||
|
display: table-header-group !important;
|
||||||
|
}
|
||||||
|
.data_table {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
.act_as_row.labels {
|
||||||
|
background-color: #F0F0F0 !important;
|
||||||
|
}
|
||||||
|
.data_table, .total_row, .act_as_row {
|
||||||
|
border-left: 0px;
|
||||||
|
border-right: 0px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 10px;
|
||||||
|
padding-right: 3px;
|
||||||
|
padding-left: 3px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
.data_table .act_as_cell{
|
||||||
|
border: 1px solid lightGrey;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.data_table .act_as_cell {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
.data_table .act_as_row.labels {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.data_table .total_row {
|
||||||
|
background-color:#F0F0F0 !important;
|
||||||
|
border-left: 1px solid lightGrey;
|
||||||
|
border-right: 1px solid lightGrey;
|
||||||
|
border-bottom: 1px solid lightGrey;
|
||||||
|
text-align: right;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.act_as_cell.amount {
|
||||||
|
word-wrap: normal;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.act_as_cell.left {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.act_as_cell.right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.custom_footer {
|
||||||
|
font-size: 7px !important;
|
||||||
|
}
|
||||||
|
.button_row {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
.o_stock_inventory_valuation_report_page {
|
||||||
|
padding-top: 10px;
|
||||||
|
width: 90%;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
font-family: Helvetica, Arial;
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
odoo.define('stock_inventory_valuation_report.stock_inventory_valuation_report_backend', function (require) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var core = require('web.core');
|
||||||
|
var Widget = require('web.Widget');
|
||||||
|
var ControlPanelMixin = require('web.ControlPanelMixin');
|
||||||
|
var ReportWidget = require('web.Widget');
|
||||||
|
|
||||||
|
|
||||||
|
var report_backend = Widget.extend(ControlPanelMixin, {
|
||||||
|
// Stores all the parameters of the action.
|
||||||
|
events: {
|
||||||
|
'click .o_stock_inventory_valuation_report_print': 'print',
|
||||||
|
'click .o_stock_inventory_valuation_report_export': 'export',
|
||||||
|
},
|
||||||
|
init: function (parent, action) {
|
||||||
|
this.actionManager = parent;
|
||||||
|
this.given_context = {};
|
||||||
|
this.odoo_context = action.context;
|
||||||
|
this.controller_url = action.context.url;
|
||||||
|
if (action.context.context) {
|
||||||
|
this.given_context = action.context.context;
|
||||||
|
}
|
||||||
|
this.given_context.active_id = action.context.active_id ||
|
||||||
|
action.params.active_id;
|
||||||
|
this.given_context.model = action.context.active_model || false;
|
||||||
|
this.given_context.ttype = action.context.ttype || false;
|
||||||
|
return this._super.apply(this, arguments);
|
||||||
|
},
|
||||||
|
willStart: function () {
|
||||||
|
return $.when(this.get_html());
|
||||||
|
},
|
||||||
|
set_html: function () {
|
||||||
|
var self = this;
|
||||||
|
var def = $.when();
|
||||||
|
if (!this.report_widget) {
|
||||||
|
this.report_widget = new ReportWidget(this, this.given_context);
|
||||||
|
def = this.report_widget.appendTo(this.$el);
|
||||||
|
}
|
||||||
|
def.then(function () {
|
||||||
|
self.report_widget.$el.html(self.html);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
start: function () {
|
||||||
|
this.set_html();
|
||||||
|
return this._super();
|
||||||
|
},
|
||||||
|
// Fetches the html and is previous report.context if any,
|
||||||
|
// else create it
|
||||||
|
get_html: function () {
|
||||||
|
var self = this;
|
||||||
|
var defs = [];
|
||||||
|
return this._rpc({
|
||||||
|
model: this.given_context.model,
|
||||||
|
method: 'get_html',
|
||||||
|
args: [self.given_context],
|
||||||
|
context: self.odoo_context,
|
||||||
|
})
|
||||||
|
.then(function (result) {
|
||||||
|
self.html = result.html;
|
||||||
|
defs.push(self.update_cp());
|
||||||
|
return $.when.apply($, defs);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// Updates the control panel and render the elements that have yet
|
||||||
|
// to be rendered
|
||||||
|
update_cp: function () {
|
||||||
|
if (this.$buttons) {
|
||||||
|
var status = {
|
||||||
|
breadcrumbs: this.actionManager.get_breadcrumbs(),
|
||||||
|
cp_content: {$buttons: this.$buttons},
|
||||||
|
};
|
||||||
|
return this.update_control_panel(status);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
do_show: function () {
|
||||||
|
this._super();
|
||||||
|
this.update_cp();
|
||||||
|
},
|
||||||
|
print: function () {
|
||||||
|
var self = this;
|
||||||
|
this._rpc({
|
||||||
|
model: this.given_context.model,
|
||||||
|
method: 'print_report',
|
||||||
|
args: [this.given_context.active_id, 'qweb-pdf'],
|
||||||
|
context: self.odoo_context,
|
||||||
|
}).then(function (result) {
|
||||||
|
self.do_action(result);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
export: function () {
|
||||||
|
var self = this;
|
||||||
|
this._rpc({
|
||||||
|
model: this.given_context.model,
|
||||||
|
method: 'print_report',
|
||||||
|
args: [this.given_context.active_id, 'xlsx'],
|
||||||
|
context: self.odoo_context,
|
||||||
|
}).then(function (result) {
|
||||||
|
self.do_action(result);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
canBeRemoved: function () {
|
||||||
|
return $.when();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
core.action_registry.add(
|
||||||
|
"stock_inventory_valuation_report_backend",
|
||||||
|
report_backend
|
||||||
|
);
|
||||||
|
return report_backend;
|
||||||
|
});
|
||||||
4
stock_inventory_valuation_report/tests/__init__.py
Normal file
4
stock_inventory_valuation_report/tests/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from . import test_stock_inventory_valuation_report
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import datetime
|
||||||
|
from odoo.tests import common
|
||||||
|
from odoo.tools import test_reports
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class TestStockInventoryValuation(common.TransactionCase):
|
||||||
|
|
||||||
|
def setUp(cls):
|
||||||
|
super(TestStockInventoryValuation, cls).setUp()
|
||||||
|
|
||||||
|
cls.model = cls._getReportModel()
|
||||||
|
|
||||||
|
cls.qweb_report_name = cls._getQwebReportName()
|
||||||
|
cls.xlsx_report_name = cls._getXlsxReportName()
|
||||||
|
cls.xlsx_action_name = cls._getXlsxReportActionName()
|
||||||
|
|
||||||
|
cls.report_title = cls._getReportTitle()
|
||||||
|
|
||||||
|
cls.base_filters = cls._getBaseFilters()
|
||||||
|
|
||||||
|
cls.report = cls.model.create(cls.base_filters)
|
||||||
|
cls.report._compute_results()
|
||||||
|
|
||||||
|
def test_html(self):
|
||||||
|
test_reports.try_report(self.env.cr, self.env.uid,
|
||||||
|
self.qweb_report_name,
|
||||||
|
[self.report.id],
|
||||||
|
report_type='qweb-html')
|
||||||
|
|
||||||
|
def test_qweb(self):
|
||||||
|
test_reports.try_report(self.env.cr, self.env.uid,
|
||||||
|
self.qweb_report_name,
|
||||||
|
[self.report.id],
|
||||||
|
report_type='qweb-pdf')
|
||||||
|
|
||||||
|
def test_xlsx(self):
|
||||||
|
test_reports.try_report(self.env.cr, self.env.uid,
|
||||||
|
self.xlsx_report_name,
|
||||||
|
[self.report.id],
|
||||||
|
report_type='xlsx')
|
||||||
|
|
||||||
|
def test_print(self):
|
||||||
|
self.report.print_report('qweb')
|
||||||
|
self.report.print_report('xlsx')
|
||||||
|
|
||||||
|
def _getReportModel(self):
|
||||||
|
return self.env['report.stock.inventory.valuation.report']
|
||||||
|
|
||||||
|
def _getQwebReportName(self):
|
||||||
|
return 'stock_inventory_valuation_report.'\
|
||||||
|
'report_stock_inventory_valuation_report_pdf'
|
||||||
|
|
||||||
|
def _getXlsxReportName(self):
|
||||||
|
return 's_i_v_r.report_stock_inventory_valuation_report_xlsx'
|
||||||
|
|
||||||
|
def _getXlsxReportActionName(self):
|
||||||
|
return 'stock_inventory_valuation_report.'\
|
||||||
|
'action_stock_inventory_valuation_report_xlsx'
|
||||||
|
|
||||||
|
def _getReportTitle(self):
|
||||||
|
return 'Inventory Valuation Report'
|
||||||
|
|
||||||
|
def _getBaseFilters(self):
|
||||||
|
return {
|
||||||
|
'company_id': self.env.user.company_id.id,
|
||||||
|
'compute_at_date': 0,
|
||||||
|
'date': datetime.datetime.now(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestStockInventoryValuationReport(common.TransactionCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestStockInventoryValuationReport, self).setUp()
|
||||||
|
self.company_id = self.env.ref('base.main_company')
|
||||||
|
self.compute_at_date = 0
|
||||||
|
self.date = datetime.datetime.now()
|
||||||
|
|
||||||
|
def test_get_report_html(self):
|
||||||
|
report = self.env['report.stock.inventory.valuation.report'].create({
|
||||||
|
'company_id': self.company_id.id,
|
||||||
|
'compute_at_date': self.compute_at_date,
|
||||||
|
'date': self.date,
|
||||||
|
})
|
||||||
|
report._compute_results()
|
||||||
|
report.get_html(given_context={
|
||||||
|
'active_id': report.id
|
||||||
|
})
|
||||||
|
|
||||||
|
def test_wizard(self):
|
||||||
|
wizard = self.env['stock.quantity.history'].create({
|
||||||
|
'compute_at_date': 0,
|
||||||
|
'date': datetime.datetime.now(),
|
||||||
|
})
|
||||||
|
wizard._export('qweb-pdf')
|
||||||
|
wizard.button_export_html()
|
||||||
|
wizard.button_export_pdf()
|
||||||
|
wizard.button_export_xlsx()
|
||||||
4
stock_inventory_valuation_report/wizard/__init__.py
Normal file
4
stock_inventory_valuation_report/wizard/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from . import stock_quantity_history
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import api, models
|
||||||
|
from odoo.tools.safe_eval import safe_eval
|
||||||
|
from odoo.tools import pycompat
|
||||||
|
|
||||||
|
|
||||||
|
class StockQuantityHistory(models.TransientModel):
|
||||||
|
_inherit = 'stock.quantity.history'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def button_export_html(self):
|
||||||
|
self.ensure_one()
|
||||||
|
action = self.env.ref(
|
||||||
|
'stock_inventory_valuation_report.'
|
||||||
|
'action_stock_inventory_valuation_report_html')
|
||||||
|
vals = action.read()[0]
|
||||||
|
context1 = vals.get('context', {})
|
||||||
|
if isinstance(context1, pycompat.string_types):
|
||||||
|
context1 = safe_eval(context1)
|
||||||
|
model = self.env['report.stock.inventory.valuation.report']
|
||||||
|
report = model.create(self._prepare_stock_inventory_valuation_report())
|
||||||
|
context1['active_id'] = report.id
|
||||||
|
context1['active_ids'] = report.ids
|
||||||
|
vals['context'] = context1
|
||||||
|
return vals
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def button_export_pdf(self):
|
||||||
|
self.ensure_one()
|
||||||
|
report_type = 'qweb-pdf'
|
||||||
|
return self._export(report_type)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def button_export_xlsx(self):
|
||||||
|
self.ensure_one()
|
||||||
|
report_type = 'xlsx'
|
||||||
|
return self._export(report_type)
|
||||||
|
|
||||||
|
def _prepare_stock_inventory_valuation_report(self):
|
||||||
|
self.ensure_one()
|
||||||
|
return {
|
||||||
|
'company_id': self.env.user.company_id.id,
|
||||||
|
'compute_at_date': self.compute_at_date,
|
||||||
|
'date': self.date,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _export(self, report_type):
|
||||||
|
model = self.env['report.stock.inventory.valuation.report']
|
||||||
|
report = model.create(self._prepare_stock_inventory_valuation_report())
|
||||||
|
return report.print_report(report_type)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="view_stock_quantity_history_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">view_stock_quantity_history_inherit</field>
|
||||||
|
<field name="model">stock.quantity.history</field>
|
||||||
|
<field name="inherit_id" ref="stock_account.view_stock_quantity_history"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//button[@name='open_table']" position="after">
|
||||||
|
<button name="button_export_html" string="View report" type="object"/>
|
||||||
|
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
||||||
|
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user