diff --git a/stock_exception/__init__.py b/stock_exception/__init__.py deleted file mode 100644 index c7120225..00000000 --- a/stock_exception/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from . import models -from . import wizard diff --git a/stock_exception/__manifest__.py b/stock_exception/__manifest__.py deleted file mode 100644 index 73e1535c..00000000 --- a/stock_exception/__manifest__.py +++ /dev/null @@ -1,28 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -{ - 'name': 'Stock Exception Rule', - 'version': '15.0.1.0.0', - 'author': 'Hibou Corp.', - 'license': 'OPL-1', - 'category': 'Generic Modules', - 'summary': 'Custom exceptions on delivery orders', - 'description': """ -Custom exceptions on delivery orders -""", - 'website': 'https://hibou.io/', - 'depends': [ - 'base_exception_user', - 'stock', - ], - 'data': [ - 'security/ir.model.access.csv', - 'views/stock_views.xml', - 'wizard/stock_exception_confirm_views.xml', - ], - 'demo': [ - 'demo/stock_exception_demo.xml', - ], - 'installable': True, - 'auto_install': False, -} diff --git a/stock_exception/demo/stock_exception_demo.xml b/stock_exception/demo/stock_exception_demo.xml deleted file mode 100644 index 032968c5..00000000 --- a/stock_exception/demo/stock_exception_demo.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - No ZIP code on destination - No ZIP code on destination - 50 - stock.picking - if not picking.partner_id.zip: failed=True - - - - diff --git a/stock_exception/models/__init__.py b/stock_exception/models/__init__.py deleted file mode 100644 index 7297e4be..00000000 --- a/stock_exception/models/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from . import stock diff --git a/stock_exception/models/stock.py b/stock_exception/models/stock.py deleted file mode 100644 index 2f809b6c..00000000 --- a/stock_exception/models/stock.py +++ /dev/null @@ -1,45 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from odoo import api, models, fields - - -class ExceptionRule(models.Model): - _inherit = 'exception.rule' - - model = fields.Selection( - selection_add=[ - ('stock.picking', 'Transfer'), - ], - ondelete={ - 'stock.picking': 'cascade', - }, - ) - picking_ids = fields.Many2many( - 'stock.picking', - string="Transfers") - -class Picking(models.Model): - _inherit = ['stock.picking', 'base.exception'] - _name = 'stock.picking' - _order = 'main_exception_id asc, priority desc, date asc, id desc' - - @api.model - def _exception_rule_eval_context(self, rec): - res = super(Picking, self)._exception_rule_eval_context(rec) - res['picking'] = rec - return res - - @api.model - def _reverse_field(self): - return 'picking_ids' - - def button_validate(self): - self.ensure_one() - if self.detect_exceptions(): - return self._popup_exceptions() - return super().button_validate() - - @api.model - def _get_popup_action(self): - return self.env.ref('stock_exception.action_stock_exception_confirm') - diff --git a/stock_exception/security/ir.model.access.csv b/stock_exception/security/ir.model.access.csv deleted file mode 100644 index a1ecfa7a..00000000 --- a/stock_exception/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_stock_exception_confirm_user,stock.exception.confirm user,model_stock_exception_confirm,stock.group_stock_user,1,1,1,1 diff --git a/stock_exception/tests/__init__.py b/stock_exception/tests/__init__.py deleted file mode 100644 index 7589231c..00000000 --- a/stock_exception/tests/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from . import test_stock_exception diff --git a/stock_exception/tests/test_stock_exception.py b/stock_exception/tests/test_stock_exception.py deleted file mode 100644 index 93f5f96c..00000000 --- a/stock_exception/tests/test_stock_exception.py +++ /dev/null @@ -1,43 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from odoo.tests import common, Form - - -class TestStockException(common.TransactionCase): - - def setUp(self): - super().setUp() - self.env = self.env(context=dict(self.env.context, tracking_disable=True)) - - def test_delivery_order_exception(self): - exception = self.env.ref('stock_exception.excep_no_zip') - exception.active = True - partner = self.env.ref('base.res_partner_12') # Azure Interior - partner.zip = False - p = self.env.ref('product.product_product_6') - stock_location = self.env.ref('stock.stock_location_stock') - customer_location = self.env.ref('stock.stock_location_customers') - self.env['stock.quant']._update_available_quantity(p, stock_location, 100) - delivery_order = self.env['stock.picking'].create({ - 'partner_id': partner.id, - 'picking_type_id': self.ref('stock.picking_type_out'), - 'location_id': self.env.ref('stock.stock_location_stock').id, - 'location_dest_id': self.env.ref('stock.stock_location_customers').id, - 'move_line_ids': [(0, 0, {'product_id': p.id, - 'product_uom_id': p.uom_id.id, - 'qty_done': 3.0, - 'location_id': stock_location.id, - 'location_dest_id': customer_location.id})], - }) - - # validate delivery order - action = delivery_order.button_validate() - self.assertEqual(delivery_order.state, 'draft') - - # Simulation the opening of the wizard sale_exception_confirm and - # set ignore_exception to True - stock_exception_confirm = Form(self.env[action['res_model']].with_context(action['context'])).save() - stock_exception_confirm.ignore = True - stock_exception_confirm.action_confirm() - self.assertTrue(delivery_order.ignore_exception) - self.assertEqual(delivery_order.state, 'done') diff --git a/stock_exception/views/stock_views.xml b/stock_exception/views/stock_views.xml deleted file mode 100644 index 232dfafa..00000000 --- a/stock_exception/views/stock_views.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - Stock Exception Rules - exception.rule - tree,form - - [('model', '=', 'stock.picking')] - {'active_test': False, 'default_model' : 'stock.picking'} - - - - - - stock.picking.form.inherit.exception - stock.picking - - - - - - - - - - - - - stock.picking.tree.inherit.exception - stock.picking - - - - - - - - - - stock.picking.internal.search.inherit.exception - stock.picking - - - - - - - - - - diff --git a/stock_exception/wizard/__init__.py b/stock_exception/wizard/__init__.py deleted file mode 100644 index f2d4f882..00000000 --- a/stock_exception/wizard/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from . import stock_exception_confirm diff --git a/stock_exception/wizard/stock_exception_confirm.py b/stock_exception/wizard/stock_exception_confirm.py deleted file mode 100644 index 8b405ae7..00000000 --- a/stock_exception/wizard/stock_exception_confirm.py +++ /dev/null @@ -1,26 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from odoo import api, fields, models - - -class StockExceptionConfirm(models.TransientModel): - _name = 'stock.exception.confirm' - _inherit = ['exception.rule.confirm'] - _description = 'Stock Exception Confirm Wizard' - - related_model_id = fields.Many2one('stock.picking', 'Transfer') - - def action_confirm(self): - self.ensure_one() - if self.ignore: - self.related_model_id.ignore_exception = True - res = super().action_confirm() - if self.ignore: - return self.related_model_id.button_validate() - else: - return res - - def _action_ignore(self): - self.related_model_id.ignore_exception = True - super()._action_ignore() - return self.related_model_id.button_validate() diff --git a/stock_exception/wizard/stock_exception_confirm_views.xml b/stock_exception/wizard/stock_exception_confirm_views.xml deleted file mode 100644 index 0150c870..00000000 --- a/stock_exception/wizard/stock_exception_confirm_views.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Stock Exceptions Rules - stock.exception.confirm - - primary - - -