[IMP] account_sale_stock_report_non_billed: Allow to select moves threshold in wizard.

pull/896/head
sergio-teruel 2022-09-26 21:07:53 +02:00 committed by Pedro M. Baeza
parent 30508ddf12
commit d32dfa0662
5 changed files with 28 additions and 12 deletions

View File

@ -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"

View File

@ -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 <sergio.teruel@tecnativa.com>\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"

View File

@ -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

View File

@ -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(

View File

@ -8,6 +8,7 @@
<form string="Non Billed Stock Moves">
<sheet>
<group>
<field name="stock_move_non_billed_threshold" />
<field name="date_check" />
</group>
<footer>