diff --git a/account_exception/__init__.py b/account_exception/__init__.py
index e69de29b..9b429614 100644
--- a/account_exception/__init__.py
+++ b/account_exception/__init__.py
@@ -0,0 +1,2 @@
+from . import models
+from . import wizard
diff --git a/account_exception/__manifest__.py b/account_exception/__manifest__.py
new file mode 100644
index 00000000..b3350d0b
--- /dev/null
+++ b/account_exception/__manifest__.py
@@ -0,0 +1,29 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+{
+ 'name': 'Journal Entry Exception Rule',
+ 'version': '15.0.1.0.0',
+ 'author': 'Hibou Corp.',
+ 'license': 'OPL-1',
+ 'category': 'Generic Modules',
+ 'summary': 'Custom exceptions on Journal Entries',
+ 'description': """
+Custom exceptions on journal entries
+""",
+ 'website': 'https://hibou.io/',
+ 'depends': [
+ 'base_exception_user',
+ 'account',
+ ],
+ 'data': [
+ # 'demo/account_exception_demo.xml',
+ 'security/ir.model.access.csv',
+ 'views/account_move_views.xml',
+ 'wizard/account_move_exception_confirm_views.xml',
+ ],
+ 'demo': [
+ 'demo/account_exception_demo.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
diff --git a/account_exception/demo/account_exception_demo.xml b/account_exception/demo/account_exception_demo.xml
index 285e1c47..0664ab15 100644
--- a/account_exception/demo/account_exception_demo.xml
+++ b/account_exception/demo/account_exception_demo.xml
@@ -6,8 +6,8 @@
No phone number on customer
50
account.move
- if not invoice.partner_id.phone: failed=True
-
+ if journal_entry.move_type == 'out_customer' and not journal_entry.partner_id.phone: failed=True
+
diff --git a/account_exception/models/account_move.py b/account_exception/models/account_move.py
index 76be6858..66c1efe8 100644
--- a/account_exception/models/account_move.py
+++ b/account_exception/models/account_move.py
@@ -8,15 +8,15 @@ class ExceptionRule(models.Model):
model = fields.Selection(
selection_add=[
- ('account.move', 'Invoice'),
+ ('account.move', 'Journal Entry'),
],
ondelete={
'account.move': 'cascade',
},
)
- invoice_ids = fields.Many2many(
+ journal_entry_ids = fields.Many2many(
'account.move',
- string="Invoices")
+ string="Journal Entries")
class AccountMove(models.Model):
_inherit = ['account.move', 'base.exception']
@@ -26,12 +26,12 @@ class AccountMove(models.Model):
@api.model
def _exception_rule_eval_context(self, rec):
res = super(AccountMove, self)._exception_rule_eval_context(rec)
- res['invoice'] = rec
+ res['journal_entry'] = rec
return res
@api.model
def _reverse_field(self):
- return 'invoice_ids'
+ return 'journal_entry_ids'
def action_post(self):
self.ensure_one()
@@ -41,5 +41,5 @@ class AccountMove(models.Model):
# TODO
@api.model
def _get_popup_action(self):
- return self.env.ref('stock_exception.action_stock_exception_confirm')
+ return self.env.ref('account_exception.action_account_move_exception_confirm')
diff --git a/account_exception/security/ir.model.access.csv b/account_exception/security/ir.model.access.csv
new file mode 100644
index 00000000..d95c3447
--- /dev/null
+++ b/account_exception/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+account_exception.access_account_move_exception_confirm,access_account_move_exception_confirm,account_exception.model_account_move_exception_confirm,base.group_user,1,1,1,1
\ No newline at end of file
diff --git a/account_exception/views/account_move_views.xml b/account_exception/views/account_move_views.xml
index 8da66d6e..9ff38109 100644
--- a/account_exception/views/account_move_views.xml
+++ b/account_exception/views/account_move_views.xml
@@ -1,8 +1,8 @@
-
- Invoice Exception Rules
+
+ Journal Entry Exception Rules
exception.rule
tree,form
@@ -11,8 +11,8 @@
- saccount.move.tree.inherit.exception
- saccount.move
+ account.move.tree.inherit.exception
+ account.move
@@ -53,7 +52,7 @@
account.invoice.select.inherit.exception
- saccount.move
+ account.move
diff --git a/account_exception/wizard/__init__.py b/account_exception/wizard/__init__.py
index 5a31424a..3eaeda76 100644
--- a/account_exception/wizard/__init__.py
+++ b/account_exception/wizard/__init__.py
@@ -1,25 +1 @@
-
-
-
-
- Stock Exceptions Rules
- stock.exception.confirm
-
- primary
-
-
-
-
-
-
-
-
- Blocked due to exceptions
- ir.actions.act_window
- invoice.exception.confirm
- form
-
- new
-
-
-
+from . import account_move_exception_confirm
diff --git a/account_exception/wizard/account_move_exception_confirm.py b/account_exception/wizard/account_move_exception_confirm.py
index 6586ceec..3ef20ac2 100644
--- a/account_exception/wizard/account_move_exception_confirm.py
+++ b/account_exception/wizard/account_move_exception_confirm.py
@@ -3,12 +3,12 @@
from odoo import api, fields, models
-class InvoiceExceptionConfirm(models.TransientModel):
- _name = 'invoice.exception.confirm'
+class AccountMoveExceptionConfirm(models.TransientModel):
+ _name = 'account.move.exception.confirm'
_inherit = ['exception.rule.confirm']
- _description = 'Invoice Exception Confirm Wizard'
+ _description = 'Journal Entry Exception Confirm Wizard'
- related_model_id = fields.Many2one('account.move', 'Invoice')
+ related_model_id = fields.Many2one('account.move', 'Journal Entry')
def action_confirm(self):
self.ensure_one()
diff --git a/account_exception/wizard/account_move_exception_confirm_views.xml b/account_exception/wizard/account_move_exception_confirm_views.xml
index e69de29b..57abf88c 100644
--- a/account_exception/wizard/account_move_exception_confirm_views.xml
+++ b/account_exception/wizard/account_move_exception_confirm_views.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ Stock Exceptions Rules
+ account.move.exception.confirm
+
+ primary
+
+
+
+
+
+
+
+
+ Blocked due to exceptions
+ ir.actions.act_window
+ account.move.exception.confirm
+ form
+
+ new
+
+
+
diff --git a/stock_exception/__manifest__.py b/stock_exception/__manifest__.py
index 73e1535c..2897c20e 100644
--- a/stock_exception/__manifest__.py
+++ b/stock_exception/__manifest__.py
@@ -16,6 +16,7 @@ Custom exceptions on delivery orders
'stock',
],
'data': [
+ 'demo/stock_exception_demo.xml',
'security/ir.model.access.csv',
'views/stock_views.xml',
'wizard/stock_exception_confirm_views.xml',