From d32dfa06628b5f0ef2330f6e7c4c38008ae09e87 Mon Sep 17 00:00:00 2001 From: sergio-teruel Date: Mon, 26 Sep 2022 21:07:53 +0200 Subject: [PATCH] [IMP] account_sale_stock_report_non_billed: Allow to select moves threshold in wizard. --- .../i18n/account_sale_stock_report_non_billed.pot | 9 +++++++-- account_sale_stock_report_non_billed/i18n/es.po | 13 +++++++++---- .../models/stock_move.py | 4 +++- .../account_sale_stock_report_non_billed_wiz.py | 13 ++++++++----- ...count_sale_stock_report_non_billed_wiz_views.xml | 1 + 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/account_sale_stock_report_non_billed/i18n/account_sale_stock_report_non_billed.pot b/account_sale_stock_report_non_billed/i18n/account_sale_stock_report_non_billed.pot index 833ce252..96cfb114 100644 --- a/account_sale_stock_report_non_billed/i18n/account_sale_stock_report_non_billed.pot +++ b/account_sale_stock_report_non_billed/i18n/account_sale_stock_report_non_billed.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-26 09:37+0000\n" -"PO-Revision-Date: 2022-09-26 09:37+0000\n" +"POT-Creation-Date: 2022-09-26 19:03+0000\n" +"PO-Revision-Date: 2022-09-26 19:03+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -146,6 +146,11 @@ msgstr "" msgid "Stock Move" msgstr "" +#. module: account_sale_stock_report_non_billed +#: model:ir.model.fields,field_description:account_sale_stock_report_non_billed.field_account_sale_stock_report_non_billed_wiz__stock_move_non_billed_threshold +msgid "Stock Move Non Billed Threshold" +msgstr "" + #. module: account_sale_stock_report_non_billed #: model_terms:ir.ui.view,arch_db:account_sale_stock_report_non_billed.view_move_pivot_no_invoiced msgid "Stock Moves Analysis" diff --git a/account_sale_stock_report_non_billed/i18n/es.po b/account_sale_stock_report_non_billed/i18n/es.po index 62d275de..a36ee91c 100644 --- a/account_sale_stock_report_non_billed/i18n/es.po +++ b/account_sale_stock_report_non_billed/i18n/es.po @@ -6,16 +6,16 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-09-26 09:37+0000\n" -"PO-Revision-Date: 2022-09-26 11:38+0200\n" -"Last-Translator: \n" +"POT-Creation-Date: 2022-09-26 19:03+0000\n" +"PO-Revision-Date: 2022-09-26 21:04+0200\n" +"Last-Translator: Sergio Teruel \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 2.3\n" +"X-Generator: Poedit 3.0.1\n" #. module: account_sale_stock_report_non_billed #: model:ir.model.fields,field_description:account_sale_stock_report_non_billed.field_stock_move__price_not_invoiced @@ -150,6 +150,11 @@ msgstr "Ctd. a facturar" msgid "Stock Move" msgstr "Movimiento de stock" +#. module: account_sale_stock_report_non_billed +#: model:ir.model.fields,field_description:account_sale_stock_report_non_billed.field_account_sale_stock_report_non_billed_wiz__stock_move_non_billed_threshold +msgid "Stock Move Non Billed Threshold" +msgstr "Fecha umbral movimientos no facturados" + #. module: account_sale_stock_report_non_billed #: model_terms:ir.ui.view,arch_db:account_sale_stock_report_non_billed.view_move_pivot_no_invoiced msgid "Stock Moves Analysis" diff --git a/account_sale_stock_report_non_billed/models/stock_move.py b/account_sale_stock_report_non_billed/models/stock_move.py index 9d3f3c8a..518b5ad0 100644 --- a/account_sale_stock_report_non_billed/models/stock_move.py +++ b/account_sale_stock_report_non_billed/models/stock_move.py @@ -11,14 +11,16 @@ class StockMove(models.Model): string="Qty. to invoice", compute="_compute_not_invoiced_values", digits="Product Unit of Measure", + compute_sudo=True, ) price_not_invoiced = fields.Float( string="Amount to invoice", compute="_compute_not_invoiced_values", digits="Product Price", + compute_sudo=True, ) currency_id = fields.Many2one( - comodel_name="res.currency", compute="_compute_currency_id" + comodel_name="res.currency", compute="_compute_currency_id", compute_sudo=True ) date_done = fields.Date( string="Effective Date", compute="_compute_date_done", store=True diff --git a/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz.py b/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz.py index 00478c81..84d6ad17 100644 --- a/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz.py +++ b/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz.py @@ -9,6 +9,12 @@ class AccountSaleStockReportNonBilledWiz(models.TransientModel): _name = "account.sale.stock.report.non.billed.wiz" _description = "Wizard to open stock moves that have not been invoiced at that time" + def _default_stock_move_non_billed_threshold(self): + return self.env.company.stock_move_non_billed_threshold + + stock_move_non_billed_threshold = fields.Date( + default=lambda self: self._default_stock_move_non_billed_threshold() + ) date_check = fields.Date(string="Date", default=fields.Date.today) def _get_search_domain(self): @@ -54,7 +60,7 @@ class AccountSaleStockReportNonBilledWiz(models.TransientModel): dp = self.env["decimal.precision"].precision_get("Product Unit of Measure") # Get the moves after the threshold stock_moves = self.env["stock.move"].search( - [("date_done", ">=", self.env.company.stock_move_non_billed_threshold)] + [("date_done", ">=", self.stock_move_non_billed_threshold)] ) # Filter the moves with the domain stock_moves = stock_moves.filtered_domain(self._get_search_domain()) @@ -90,10 +96,7 @@ class AccountSaleStockReportNonBilledWiz(models.TransientModel): "view_mode": "tree,pivot", "search_view_id": search_view_id, "name": _("Non billed moves (%(from)s -> %(to)s)") - % { - "from": self.env.company.stock_move_non_billed_threshold, - "to": self.date_check, - }, + % {"from": self.stock_move_non_billed_threshold, "to": self.date_check}, "res_model": "stock.move", "domain": [("id", "in", final_stock_move_ids)], "context": dict( diff --git a/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz_views.xml b/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz_views.xml index ba295663..5d882277 100644 --- a/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz_views.xml +++ b/account_sale_stock_report_non_billed/wizard/account_sale_stock_report_non_billed_wiz_views.xml @@ -8,6 +8,7 @@
+