diff --git a/stock_inventory_valuation_report/README.rst b/stock_inventory_valuation_report/README.rst new file mode 100644 index 0000000..cce5a4c --- /dev/null +++ b/stock_inventory_valuation_report/README.rst @@ -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 `_. +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Ecosoft + +Contributors +~~~~~~~~~~~~ + +* Pimolnat Suntian + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_inventory_valuation_report/__init__.py b/stock_inventory_valuation_report/__init__.py new file mode 100644 index 0000000..2873ef6 --- /dev/null +++ b/stock_inventory_valuation_report/__init__.py @@ -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 diff --git a/stock_inventory_valuation_report/__manifest__.py b/stock_inventory_valuation_report/__manifest__.py new file mode 100644 index 0000000..77d4387 --- /dev/null +++ b/stock_inventory_valuation_report/__manifest__.py @@ -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, +} diff --git a/stock_inventory_valuation_report/data/paper_format.xml b/stock_inventory_valuation_report/data/paper_format.xml new file mode 100644 index 0000000..8b793eb --- /dev/null +++ b/stock_inventory_valuation_report/data/paper_format.xml @@ -0,0 +1,19 @@ + + + + Inventory Valuation Report A4 + + A4 + 0 + 0 + Portrait + 28 + 28 + 7 + 7 + + 24 + 90 + + + diff --git a/stock_inventory_valuation_report/data/report_data.xml b/stock_inventory_valuation_report/data/report_data.xml new file mode 100644 index 0000000..5300ff3 --- /dev/null +++ b/stock_inventory_valuation_report/data/report_data.xml @@ -0,0 +1,26 @@ + + + + Inventory Valuation Report + stock_inventory_valuation_report_backend + + + + + + + + diff --git a/stock_inventory_valuation_report/i18n/stock_inventory_valuation_report.pot b/stock_inventory_valuation_report/i18n/stock_inventory_valuation_report.pot new file mode 100644 index 0000000..5b8ac8a --- /dev/null +++ b/stock_inventory_valuation_report/i18n/stock_inventory_valuation_report.pot @@ -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 "Export" +msgstr "" + +#. module: stock_inventory_valuation_report +#: model_terms:ir.ui.view,arch_db:stock_inventory_valuation_report.report_buttons +msgid "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 "" + diff --git a/stock_inventory_valuation_report/readme/CONTRIBUTORS.rst b/stock_inventory_valuation_report/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..0ef1f84 --- /dev/null +++ b/stock_inventory_valuation_report/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Pimolnat Suntian diff --git a/stock_inventory_valuation_report/readme/DESCRIPTION.rst b/stock_inventory_valuation_report/readme/DESCRIPTION.rst new file mode 100644 index 0000000..e72b165 --- /dev/null +++ b/stock_inventory_valuation_report/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Stock Inventory Valuation Report is the report that display value of all products in internal location. diff --git a/stock_inventory_valuation_report/readme/USAGE.rst b/stock_inventory_valuation_report/readme/USAGE.rst new file mode 100644 index 0000000..dfa51ab --- /dev/null +++ b/stock_inventory_valuation_report/readme/USAGE.rst @@ -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. diff --git a/stock_inventory_valuation_report/reports/__init__.py b/stock_inventory_valuation_report/reports/__init__.py new file mode 100644 index 0000000..696cd68 --- /dev/null +++ b/stock_inventory_valuation_report/reports/__init__.py @@ -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 diff --git a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py new file mode 100644 index 0000000..26caecf --- /dev/null +++ b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.py @@ -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() diff --git a/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.xml b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.xml new file mode 100644 index 0000000..6f5fdb7 --- /dev/null +++ b/stock_inventory_valuation_report/reports/stock_inventory_valuation_report.xml @@ -0,0 +1,138 @@ + + +