mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[MIG] stock_exception: bump version, add security rules, add ondelete to selection field, and slightly refactor unit test
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Stock Exception Rule',
|
'name': 'Stock Exception Rule',
|
||||||
'version': '13.0.1.0.0',
|
'version': '14.0.1.0.0',
|
||||||
'author': 'Hibou Corp.',
|
'author': 'Hibou Corp.',
|
||||||
'license': 'OPL-1',
|
'license': 'OPL-1',
|
||||||
'category': 'Generic Modules',
|
'category': 'Generic Modules',
|
||||||
@@ -16,6 +16,7 @@ Custom exceptions on delivery orders
|
|||||||
'stock',
|
'stock',
|
||||||
],
|
],
|
||||||
'data': [
|
'data': [
|
||||||
|
'security/ir.model.access.csv',
|
||||||
'views/stock_views.xml',
|
'views/stock_views.xml',
|
||||||
'wizard/stock_exception_confirm_views.xml',
|
'wizard/stock_exception_confirm_views.xml',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ class ExceptionRule(models.Model):
|
|||||||
model = fields.Selection(
|
model = fields.Selection(
|
||||||
selection_add=[
|
selection_add=[
|
||||||
('stock.picking', 'Transfer'),
|
('stock.picking', 'Transfer'),
|
||||||
]
|
],
|
||||||
|
ondelete={
|
||||||
|
'stock.picking': 'cascade',
|
||||||
|
},
|
||||||
)
|
)
|
||||||
picking_ids = fields.Many2many(
|
picking_ids = fields.Many2many(
|
||||||
'stock.picking',
|
'stock.picking',
|
||||||
|
|||||||
2
stock_exception/security/ir.model.access.csv
Normal file
2
stock_exception/security/ir.model.access.csv
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
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
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||||
|
|
||||||
from odoo.tests import common
|
from odoo.tests import common, Form
|
||||||
|
|
||||||
|
|
||||||
class TestStockException(common.TransactionCase):
|
class TestStockException(common.TransactionCase):
|
||||||
@@ -31,17 +31,13 @@ class TestStockException(common.TransactionCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# validate delivery order
|
# validate delivery order
|
||||||
delivery_order.button_validate()
|
action = delivery_order.button_validate()
|
||||||
self.assertEqual(delivery_order.state, 'draft')
|
self.assertEqual(delivery_order.state, 'draft')
|
||||||
|
|
||||||
# Simulation the opening of the wizard sale_exception_confirm and
|
# Simulation the opening of the wizard sale_exception_confirm and
|
||||||
# set ignore_exception to True
|
# set ignore_exception to True
|
||||||
stock_exception_confirm = self.env['stock.exception.confirm'].with_context(
|
stock_exception_confirm = Form(self.env[action['res_model']].with_context(action['context'])).save()
|
||||||
{
|
stock_exception_confirm.ignore = True
|
||||||
'active_id': delivery_order.id,
|
|
||||||
'active_ids': [delivery_order.id],
|
|
||||||
'active_model': delivery_order._name
|
|
||||||
}).create({'ignore': True})
|
|
||||||
stock_exception_confirm.action_confirm()
|
stock_exception_confirm.action_confirm()
|
||||||
self.assertTrue(delivery_order.ignore_exception)
|
self.assertTrue(delivery_order.ignore_exception)
|
||||||
self.assertEqual(delivery_order.state, 'done')
|
self.assertEqual(delivery_order.state, 'done')
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from odoo import api, fields, models
|
|||||||
class StockExceptionConfirm(models.TransientModel):
|
class StockExceptionConfirm(models.TransientModel):
|
||||||
_name = 'stock.exception.confirm'
|
_name = 'stock.exception.confirm'
|
||||||
_inherit = ['exception.rule.confirm']
|
_inherit = ['exception.rule.confirm']
|
||||||
|
_description = 'Stock Exception Confirm Wizard'
|
||||||
|
|
||||||
related_model_id = fields.Many2one('stock.picking', 'Transfer')
|
related_model_id = fields.Many2one('stock.picking', 'Transfer')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user