diff --git a/beesdoo_inventory/README.rst b/beesdoo_inventory/README.rst index 9787c052b..7f6e9daa6 100644 --- a/beesdoo_inventory/README.rst +++ b/beesdoo_inventory/README.rst @@ -19,7 +19,7 @@ Beesdoo Inventory |badge1| |badge2| |badge3| -Adds a responsible, a max shipping date and a button to copy quantity to stock pickings. +Restrict selectable products to those sold as main supplier by the picking partner. **Table of contents** diff --git a/beesdoo_inventory/__init__.py b/beesdoo_inventory/__init__.py index 0650744f6..e69de29bb 100644 --- a/beesdoo_inventory/__init__.py +++ b/beesdoo_inventory/__init__.py @@ -1 +0,0 @@ -from . import models diff --git a/beesdoo_inventory/__manifest__.py b/beesdoo_inventory/__manifest__.py index 0bdb9ec2b..9fa6c5279 100644 --- a/beesdoo_inventory/__manifest__.py +++ b/beesdoo_inventory/__manifest__.py @@ -6,14 +6,18 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Beesdoo Inventory", - "summary": """ - Adds a responsible, a max shipping date and a button to copy quantity to - stock pickings.""", + "summary": "Restrict selectable products to those" + " sold as main supplier by the picking partner.", "author": "Beescoop - Cellule IT, Coop IT Easy SC", "website": "https://github.com/beescoop/Obeesdoo", "category": "Inventory", - "version": "12.0.1.0.1", - "depends": ["delivery", "beesdoo_base", "beesdoo_product"], + "version": "12.0.3.0.1", + "depends": [ + "stock", + "beesdoo_product", # for field main_seller_id + "stock_picking_responsible", + "stock_move_line_auto_fill", + ], "data": ["views/stock.xml"], "installable": True, "license": "AGPL-3", diff --git a/beesdoo_inventory/migrations/12.0.3.0.1/post-migration.py b/beesdoo_inventory/migrations/12.0.3.0.1/post-migration.py new file mode 100644 index 000000000..087fe985b --- /dev/null +++ b/beesdoo_inventory/migrations/12.0.3.0.1/post-migration.py @@ -0,0 +1,25 @@ +import logging + +from odoo import SUPERUSER_ID +from odoo.api import Environment + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + # remove all users from group "Manage Packages" sometimes + # translated as "Gérer les emplacements multiples + # et les entrepôts" + _logger.info( + "removing all users from groups 'Manage Packages'," + " 'Manage Multiple Stock Locations'" + " and 'Manage Different Stock Owners'" + ) + with Environment.manage(): + env = Environment(cr, SUPERUSER_ID, {}) + group_tracking_lot = env.ref("stock.group_tracking_lot") + group_stock_multi_locations = env.ref("stock.group_stock_multi_locations") + group_tracking_owner = env.ref("stock.group_tracking_owner") + group_tracking_lot.users = [(5, 0, 0)] + group_stock_multi_locations.users = [(5, 0, 0)] + group_tracking_owner.users = [(5, 0, 0)] diff --git a/beesdoo_inventory/models/__init__.py b/beesdoo_inventory/models/__init__.py deleted file mode 100644 index 12bab770a..000000000 --- a/beesdoo_inventory/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import stock diff --git a/beesdoo_inventory/models/stock.py b/beesdoo_inventory/models/stock.py deleted file mode 100644 index ec26594a9..000000000 --- a/beesdoo_inventory/models/stock.py +++ /dev/null @@ -1,58 +0,0 @@ -from odoo import api, fields, models - - -class StockPicking(models.Model): - _inherit = "stock.picking" - - max_shipping_date = fields.Datetime("End Shipping Date") - responsible = fields.Many2one( - "res.partner", - string="Responsible", - default=lambda self: self.env.user.partner_id.id, - ) - - @api.multi - def _add_follower(self): - for picking in self: - if picking.responsible: - types = self.env["mail.message.subtype"].search( - [ - "|", - ("res_model", "=", "stock.picking"), - ("name", "=", "Discussions"), - ] - ) - if not self.env["mail.followers"].search( - [ - ("res_id", "=", picking.id), - ("res_model", "=", "stock.picking"), - ("partner_id", "=", picking.responsible.id), - ] - ): - self.env["mail.followers"].create( - { - "res_model": "stock.picking", - "res_id": picking.id, - "partner_id": picking.responsible.id, - "subtype_ids": [(6, 0, types.ids)], - } - ) - - @api.multi - def write(self, values): - res = super(StockPicking, self).write(values) - self._add_follower() - return res - - @api.model - def create(self, values): - picking = super(StockPicking, self).create(values) - picking._add_follower() - return picking - - @api.multi - def copy_qty(self): - self.ensure_one() - for move_line in self.move_line_ids: - move_line.qty_done = move_line.product_qty - return True diff --git a/beesdoo_inventory/readme/DESCRIPTION.rst b/beesdoo_inventory/readme/DESCRIPTION.rst index 9cd53971c..6e6e2f28b 100644 --- a/beesdoo_inventory/readme/DESCRIPTION.rst +++ b/beesdoo_inventory/readme/DESCRIPTION.rst @@ -1 +1 @@ -Adds a responsible, a max shipping date and a button to copy quantity to stock pickings. +Restrict selectable products to those sold as main supplier by the picking partner. diff --git a/beesdoo_inventory/static/description/index.html b/beesdoo_inventory/static/description/index.html index 1addad515..c3e324265 100644 --- a/beesdoo_inventory/static/description/index.html +++ b/beesdoo_inventory/static/description/index.html @@ -368,7 +368,7 @@
Adds a responsible, a max shipping date and a button to copy quantity to stock pickings.
+Restrict selectable products to those sold as main supplier by the picking partner.
Table of contents