From eb86b2a0ebb42b826339942ac66adbd686619074 Mon Sep 17 00:00:00 2001 From: Andrey Solodovnikov Date: Tue, 3 Oct 2023 18:05:16 +0300 Subject: [PATCH] [FIX] stock_pull_list: fix pre-commit --- stock_pull_list/models/__init__.py | 2 +- stock_pull_list/models/stock_picking.py | 17 +++++++++++------ stock_pull_list/views/stock_picking_views.xml | 13 ++++++++----- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/stock_pull_list/models/__init__.py b/stock_pull_list/models/__init__.py index f08450ee3721..ae4c27227f18 100644 --- a/stock_pull_list/models/__init__.py +++ b/stock_pull_list/models/__init__.py @@ -1 +1 @@ -from . import stock_picking \ No newline at end of file +from . import stock_picking diff --git a/stock_pull_list/models/stock_picking.py b/stock_pull_list/models/stock_picking.py index 6d7f30f5df7a..422aea89d4e3 100644 --- a/stock_pull_list/models/stock_picking.py +++ b/stock_pull_list/models/stock_picking.py @@ -1,4 +1,4 @@ -from odoo import models, fields +from odoo import _, fields, models from odoo.exceptions import Warning @@ -10,16 +10,21 @@ def action_create_pull_list(self): source_location = self[0].location_id for record in self: if source_location != record.location_id: - raise Warning('Choose transfers with same source location') + raise Warning(_("Choose transfers with same source location")) if not record.picking_type_id.allow_server_action: - raise Warning(f'Operation type of {record.name} transfer did not handle server action') - if record.state != 'waiting': + raise Warning( + f"Operation type of {record.name} transfer did not handle server action" + ) + if record.state != "waiting": raise Warning(f'Transfer {record.name} must be in "Waiting" state') - pull_wizard = self.env['stock.pull.list.wizard'].create({'location_id': source_location.id}) + pull_wizard = self.env["stock.pull.list.wizard"].create( + {"location_id": source_location.id} + ) res = pull_wizard.action_prepare() return res + class StockPickingType(models.Model): _inherit = "stock.picking.type" - allow_server_action = fields.Boolean(string="Allow pull list server action") \ No newline at end of file + allow_server_action = fields.Boolean(string="Allow pull list server action") diff --git a/stock_pull_list/views/stock_picking_views.xml b/stock_pull_list/views/stock_picking_views.xml index 42d71c46e97d..8ee0299c1be2 100644 --- a/stock_pull_list/views/stock_picking_views.xml +++ b/stock_pull_list/views/stock_picking_views.xml @@ -1,7 +1,7 @@ Generate Pull List - + code @@ -12,11 +12,14 @@ view.picking.type.form stock.picking.type - + - - + + - \ No newline at end of file +