diff --git a/stock_request_kanban/data/stock_request_sequence_data.xml b/stock_request_kanban/data/stock_request_sequence_data.xml index 33931ab67..d3ead8e74 100644 --- a/stock_request_kanban/data/stock_request_sequence_data.xml +++ b/stock_request_kanban/data/stock_request_sequence_data.xml @@ -10,5 +10,13 @@ + + Stock Inventory Kanban + stock.inventory.kanban + IKB + 5 + + + diff --git a/stock_request_kanban/i18n/stock_request_kanban.pot b/stock_request_kanban/i18n/stock_request_kanban.pot index ed4d03791..2c07d7cb3 100644 --- a/stock_request_kanban/i18n/stock_request_kanban.pot +++ b/stock_request_kanban/i18n/stock_request_kanban.pot @@ -19,14 +19,16 @@ msgid "Active" msgstr "" #. module: stock_request_kanban +#: model:ir.actions.act_window,name:stock_request_kanban.wizard_stock_inventory_kanban_action #: model:ir.actions.act_window,name:stock_request_kanban.wizard_stock_request_kanban_action #: model:ir.actions.act_window,name:stock_request_kanban.wizard_stock_request_order_kanban_action +#: model:ir.ui.view,arch_db:stock_request_kanban.wizard_stock_inventory_kanban_form #: model:ir.ui.view,arch_db:stock_request_kanban.wizard_stock_request_kanban_form msgid "Add Kanban" msgstr "" #. module: stock_request_kanban -#: code:addons/stock_request_kanban/wizard/wizard_stock_request_kanban_abstract.py:60 +#: code:addons/stock_request_kanban/wizard/wizard_stock_request_kanban.py:23 #, python-format msgid "Added kanban %s for product %s" msgstr "" @@ -37,11 +39,23 @@ msgid "Archived" msgstr "" #. module: stock_request_kanban -#: code:addons/stock_request_kanban/wizard/wizard_stock_request_kanban_abstract.py:49 +#: code:addons/stock_request_kanban/wizard/wizard_stock_request_kanban_abstract.py:29 #, python-format msgid "Barcode %s does not correspond to any Kanban. Try with another barcode or press Close to finish scanning." msgstr "" +#. module: stock_request_kanban +#: code:addons/stock_request_kanban/wizard/wizard_stock_inventory_kanban.py:34 +#, python-format +msgid "Barcode %s is already scanned" +msgstr "" + +#. module: stock_request_kanban +#: code:addons/stock_request_kanban/wizard/wizard_stock_inventory_kanban.py:28 +#, python-format +msgid "Barcode %s is not in the inventory" +msgstr "" + #. module: stock_request_kanban #: code:addons/stock_request_kanban/wizard/wizard_stock_request_order_kanban.py:23 #, python-format @@ -49,21 +63,43 @@ msgid "Barcode %s is on the order" msgstr "" #. module: stock_request_kanban -#: code:addons/stock_request_kanban/wizard/wizard_stock_request_kanban_abstract.py:39 +#: code:addons/stock_request_kanban/models/stock_request_kanban.py:33 #, python-format msgid "CRC is not valid" msgstr "" +#. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Cancel" +msgstr "" + +#. module: stock_request_kanban +#: selection:stock.inventory.kanban,state:0 +msgid "Cancelled" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.actions.act_window,help:stock_request_kanban.stock_inventory_kanban_action +msgid "Click to add a Stock Inventory Kanban." +msgstr "" + #. module: stock_request_kanban #: model:ir.actions.act_window,help:stock_request_kanban.stock_request_kanban_action msgid "Click to add a Stock Request Kanban." msgstr "" #. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +#: model:ir.ui.view,arch_db:stock_request_kanban.wizard_stock_inventory_kanban_form #: model:ir.ui.view,arch_db:stock_request_kanban.wizard_stock_request_kanban_form msgid "Close" msgstr "" +#. module: stock_request_kanban +#: selection:stock.inventory.kanban,state:0 +msgid "Closed" +msgstr "" + #. module: stock_request_kanban #: code:addons/stock_request_kanban/wizard/wizard_stock_request_order_kanban.py:32 #, python-format @@ -71,34 +107,57 @@ msgid "Company must be the same" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_create_uid #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban_create_uid +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_create_uid #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_create_uid #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_create_uid msgid "Created by" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_create_date #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban_create_date +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_create_date #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_create_date #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_create_date msgid "Created on" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_display_name #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban_display_name +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_display_name #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_abstract_display_name #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_display_name #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_display_name msgid "Display Name" msgstr "" +#. module: stock_request_kanban +#: selection:stock.inventory.kanban,state:0 +msgid "Draft" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Finish" +msgstr "" + +#. module: stock_request_kanban +#: selection:stock.inventory.kanban,state:0 +msgid "Finished" +msgstr "" + #. module: stock_request_kanban #: model:ir.ui.view,arch_db:stock_request_kanban.stock_request_kanban_search msgid "Group By" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_id #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban_id_5550 +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_abstract_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_id @@ -106,10 +165,34 @@ msgid "ID" msgstr "" #. module: stock_request_kanban +#: selection:stock.inventory.kanban,state:0 +msgid "In progress" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.ui.menu,name:stock_request_kanban.menu_wizard_stock_inventory_kanban +msgid "Inventory" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_inventory_kanban_id +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Inventory Kanban" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model,name:stock_request_kanban.model_stock_inventory_kanban +msgid "Inventory for Kanban" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_kanban_ids #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban_id +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_kanban_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_abstract_kanban_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_kanban_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_kanban_id +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form msgid "Kanban" msgstr "" @@ -119,7 +202,9 @@ msgid "Kanban cards" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban___last_update #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban___last_update +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban___last_update #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban___last_update #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_abstract___last_update #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban___last_update @@ -127,14 +212,18 @@ msgid "Last Modified on" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_write_uid #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban_write_uid +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_write_uid #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_write_uid #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_write_uid msgid "Last Updated by" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_write_date #: model:ir.model.fields,field_description:stock_request_kanban.field_stock_request_kanban_write_date +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_write_date #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_write_date #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_write_date msgid "Last Updated on" @@ -147,6 +236,7 @@ msgid "Lines only can be added on orders with draft state" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_location_ids #: model:ir.ui.view,arch_db:stock_request_kanban.stock_request_kanban_search msgid "Location" msgstr "" @@ -157,6 +247,26 @@ msgstr "" msgid "Location must be the same" msgstr "" +#. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Missing" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_missing_kanban_ids +msgid "Missing Kanban" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_count_missing_kanbans +msgid "Missing Kanbans" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_name +msgid "Name" +msgstr "" + #. module: stock_request_kanban #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_order_id msgid "Order" @@ -167,12 +277,22 @@ msgstr "" msgid "Print kanban" msgstr "" +#. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Print missing" +msgstr "" + #. module: stock_request_kanban #: code:addons/stock_request_kanban/wizard/wizard_stock_request_order_kanban.py:38 #, python-format msgid "Procurement group must be the same" msgstr "" +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_product_ids +msgid "Products" +msgstr "" + #. module: stock_request_kanban #: model:ir.ui.menu,name:stock_request_kanban.menu_wizard_stock_request_kanban msgid "Request from Kanban cards" @@ -180,10 +300,37 @@ msgstr "" #. module: stock_request_kanban #: model:ir.ui.view,arch_db:stock_request_kanban.stock_request_order_form +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form msgid "Scan" msgstr "" #. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Scanned" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_scanned_kanban_ids +msgid "Scanned Kanban" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Set to draft" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +msgid "Start" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_state +msgid "State" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_status #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_abstract_status #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_status #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_status @@ -191,15 +338,26 @@ msgid "Status" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_inventory_kanban_status_state #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_abstract_status_state #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_status_state #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_status_state msgid "Status State" msgstr "" +#. module: stock_request_kanban +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_form +#: model:ir.ui.view,arch_db:stock_request_kanban.view_stock_inventory_kanban_tree +msgid "Stock Inventories" +msgstr "" + +#. module: stock_request_kanban +#: model:ir.actions.act_window,name:stock_request_kanban.stock_inventory_kanban_action +msgid "Stock Inventory Kanbans" +msgstr "" + #. module: stock_request_kanban #: model:ir.model,name:stock_request_kanban.model_stock_request -#: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_abstract_stock_request_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_kanban_stock_request_id #: model:ir.model.fields,field_description:stock_request_kanban.field_wizard_stock_request_order_kanban_stock_request_id msgid "Stock Request" @@ -228,6 +386,7 @@ msgid "Stock Requests Kanban" msgstr "" #. module: stock_request_kanban +#: model:ir.model.fields,field_description:stock_request_kanban.field_stock_inventory_kanban_warehouse_ids #: model:ir.ui.view,arch_db:stock_request_kanban.stock_request_kanban_search msgid "Warehouse" msgstr "" @@ -238,6 +397,11 @@ msgstr "" msgid "Warehouse must be the same" msgstr "" +#. module: stock_request_kanban +#: model:ir.model,name:stock_request_kanban.model_wizard_stock_inventory_kanban +msgid "wizard.stock.inventory.kanban" +msgstr "" + #. module: stock_request_kanban #: model:ir.model,name:stock_request_kanban.model_wizard_stock_request_kanban msgid "wizard.stock.request.kanban" diff --git a/stock_request_kanban/models/stock_inventory_kanban.py b/stock_request_kanban/models/stock_inventory_kanban.py index e73a88b7d..3652af740 100644 --- a/stock_request_kanban/models/stock_inventory_kanban.py +++ b/stock_request_kanban/models/stock_inventory_kanban.py @@ -2,6 +2,7 @@ # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import api, models, fields +from odoo.osv import expression class StockInventoryKanban(models.Model): @@ -35,7 +36,7 @@ class StockInventoryKanban(models.Model): readonly=True, states={'draft': [('readonly', False)]}, ) product_ids = fields.Many2many( - 'product.product', string='Product', + 'product.product', string='Products', domain=[('type', 'in', ['product', 'consu'])], ondelete='cascade', readonly=True, states={'draft': [('readonly', False)]}, @@ -56,21 +57,34 @@ class StockInventoryKanban(models.Model): compute='_compute_missing_kanban' ) + count_missing_kanbans = fields.Integer( + 'Missing Kanbans', + readonly=True, + compute='_compute_missing_kanban', + ) + @api.depends('kanban_ids', 'scanned_kanban_ids') def _compute_missing_kanban(self): for rec in self: rec.missing_kanban_ids = rec.kanban_ids.filtered( lambda r: r.id not in rec.scanned_kanban_ids.ids ) + rec.count_missing_kanbans = len(rec.missing_kanban_ids) def _get_inventory_kanban_domain(self): domain = [] if self.warehouse_ids: - domain.append(('warehouse_id', 'in', self.warehouse_ids.ids)) + expression.AND(( + domain, [('warehouse_id', 'in', self.warehouse_ids.ids)] + )) if self.product_ids: - domain.append(('product_id', 'in', self.product_ids.ids)) + expression.AND(( + domain, [('product_id', 'in', self.product_ids.ids)] + )) if self.location_ids: - domain.append(('location_id', 'in', self.location_ids.ids)) + expression.AND(( + domain, [('location_id', 'in', self.location_ids.ids)] + )) return domain def _start_inventory_values(self): @@ -88,6 +102,13 @@ class StockInventoryKanban(models.Model): 'state': 'closed' } + @api.model + def create(self, vals): + if vals.get('name', '/') == '/': + vals['name'] = self.env['ir.sequence'].next_by_code( + 'stock.inventory.kanban') + return super().create(vals) + @api.multi def calculate_kanbans(self): for rec in self: diff --git a/stock_request_kanban/views/stock_inventory_kanban_views.xml b/stock_request_kanban/views/stock_inventory_kanban_views.xml index 850e5bee4..879134b44 100644 --- a/stock_request_kanban/views/stock_inventory_kanban_views.xml +++ b/stock_request_kanban/views/stock_inventory_kanban_views.xml @@ -7,6 +7,8 @@ + +