mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] account_exception: changes ready for gui
H11044
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
from . import models
|
||||||
|
from . import wizard
|
||||||
|
|||||||
29
account_exception/__manifest__.py
Normal file
29
account_exception/__manifest__.py
Normal file
@@ -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,
|
||||||
|
}
|
||||||
@@ -6,8 +6,8 @@
|
|||||||
<field name="description">No phone number on customer</field>
|
<field name="description">No phone number on customer</field>
|
||||||
<field name="sequence">50</field>
|
<field name="sequence">50</field>
|
||||||
<field name="model">account.move</field>
|
<field name="model">account.move</field>
|
||||||
<field name="code">if not invoice.partner_id.phone: failed=True</field>
|
<field name="code">if journal_entry.move_type == 'out_customer' and not journal_entry.partner_id.phone: failed=True</field>
|
||||||
<field name="active" eval="False"/>
|
<field name="active" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ class ExceptionRule(models.Model):
|
|||||||
|
|
||||||
model = fields.Selection(
|
model = fields.Selection(
|
||||||
selection_add=[
|
selection_add=[
|
||||||
('account.move', 'Invoice'),
|
('account.move', 'Journal Entry'),
|
||||||
],
|
],
|
||||||
ondelete={
|
ondelete={
|
||||||
'account.move': 'cascade',
|
'account.move': 'cascade',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
invoice_ids = fields.Many2many(
|
journal_entry_ids = fields.Many2many(
|
||||||
'account.move',
|
'account.move',
|
||||||
string="Invoices")
|
string="Journal Entries")
|
||||||
|
|
||||||
class AccountMove(models.Model):
|
class AccountMove(models.Model):
|
||||||
_inherit = ['account.move', 'base.exception']
|
_inherit = ['account.move', 'base.exception']
|
||||||
@@ -26,12 +26,12 @@ class AccountMove(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def _exception_rule_eval_context(self, rec):
|
def _exception_rule_eval_context(self, rec):
|
||||||
res = super(AccountMove, self)._exception_rule_eval_context(rec)
|
res = super(AccountMove, self)._exception_rule_eval_context(rec)
|
||||||
res['invoice'] = rec
|
res['journal_entry'] = rec
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _reverse_field(self):
|
def _reverse_field(self):
|
||||||
return 'invoice_ids'
|
return 'journal_entry_ids'
|
||||||
|
|
||||||
def action_post(self):
|
def action_post(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
@@ -41,5 +41,5 @@ class AccountMove(models.Model):
|
|||||||
# TODO
|
# TODO
|
||||||
@api.model
|
@api.model
|
||||||
def _get_popup_action(self):
|
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')
|
||||||
|
|
||||||
|
|||||||
2
account_exception/security/ir.model.access.csv
Normal file
2
account_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
|
||||||
|
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
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="action_invoice_test_tree" model="ir.actions.act_window">
|
<record id="action_account_move_test_tree" model="ir.actions.act_window">
|
||||||
<field name="name">Invoice Exception Rules</field>
|
<field name="name">Journal Entry Exception Rules</field>
|
||||||
<field name="res_model">exception.rule</field>
|
<field name="res_model">exception.rule</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="view_id" ref="base_exception.view_exception_rule_tree"/>
|
<field name="view_id" ref="base_exception.view_exception_rule_tree"/>
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
action="action_invoice_test_tree"
|
action="action_account_move_test_tree"
|
||||||
id="menu_invoice_test"
|
id="menu_account_move_test"
|
||||||
sequence="10"
|
sequence="10"
|
||||||
parent="account.menu_finance_configuration"
|
parent="account.menu_finance_configuration"
|
||||||
groups="base_exception.group_exception_rule_manager"
|
groups="base_exception.group_exception_rule_manager"
|
||||||
@@ -26,23 +26,22 @@
|
|||||||
<sheet position="before">
|
<sheet position="before">
|
||||||
<div class="alert alert-danger" role="alert" style="margin-bottom:0px;"
|
<div class="alert alert-danger" role="alert" style="margin-bottom:0px;"
|
||||||
attrs="{'invisible': [('exceptions_summary','=',False)]}">
|
attrs="{'invisible': [('exceptions_summary','=',False)]}">
|
||||||
<p><strong>There are exceptions blocking the post of this Invoice:
|
<p><strong>There are exceptions blocking the post of this Journal Entry:</strong></p>
|
||||||
</strong></p>
|
|
||||||
<field name="exceptions_summary"/>
|
<field name="exceptions_summary"/>
|
||||||
<button name="action_ignore_exceptions" type="object" class="btn-danger"
|
<button name="action_ignore_exceptions" type="object" class="btn-danger"
|
||||||
string="Ignore Exceptions" help="Click here to be able to post this Invoice regardless of the exceptions."
|
string="Ignore Exceptions" help="Click here to be able to post this Invoice regardless of the exceptions."
|
||||||
groups="base_exception.group_exception_rule_manager"/>
|
groups="base_exception.group_exception_rule_manager"/>
|
||||||
</div>
|
</div>
|
||||||
</sheet>
|
</sheet>
|
||||||
<xpath expr="//field[@name='origin']/.." position="inside">
|
<xpath expr="//field[@name='journal_id']/.." position="after">
|
||||||
<field name="ignore_exception" states="done" />
|
<field name="ignore_exception" states="done" />
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_move_tree" model="ir.ui.view">
|
<record id="view_move_tree" model="ir.ui.view">
|
||||||
<field name="name">saccount.move.tree.inherit.exception</field>
|
<field name="name">account.move.tree.inherit.exception</field>
|
||||||
<field name="model">saccount.move</field>
|
<field name="model">account.move</field>
|
||||||
<field name="inherit_id" ref="account.view_move_tree"/>
|
<field name="inherit_id" ref="account.view_move_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="state" position="after">
|
<field name="state" position="after">
|
||||||
@@ -53,7 +52,7 @@
|
|||||||
|
|
||||||
<record id="view_account_invoice_filter" model="ir.ui.view">
|
<record id="view_account_invoice_filter" model="ir.ui.view">
|
||||||
<field name="name">account.invoice.select.inherit.exception</field>
|
<field name="name">account.invoice.select.inherit.exception</field>
|
||||||
<field name="model">saccount.move</field>
|
<field name="model">account.move</field>
|
||||||
<field name="inherit_id" ref="account.view_account_invoice_filter" />
|
<field name="inherit_id" ref="account.view_account_invoice_filter" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<filter name="late" position="after">
|
<filter name="late" position="after">
|
||||||
|
|||||||
@@ -1,25 +1 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
from . import account_move_exception_confirm
|
||||||
<odoo>
|
|
||||||
|
|
||||||
<record id="view_stock_exception_confirm" model="ir.ui.view">
|
|
||||||
<field name="name">Stock Exceptions Rules</field>
|
|
||||||
<field name="model">stock.exception.confirm</field>
|
|
||||||
<field name="inherit_id" ref="base_exception.view_exception_rule_confirm"/>
|
|
||||||
<field name="mode">primary</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//footer" position="inside">
|
|
||||||
<button class="oe_link" special="cancel" string="Cancel"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="action_invoice_exception_confirm" model="ir.actions.act_window">
|
|
||||||
<field name="name">Blocked due to exceptions</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">invoice.exception.confirm</field>
|
|
||||||
<field name="view_mode">form</field>
|
|
||||||
<field name="view_id" ref="view_invoice_exception_confirm"/>
|
|
||||||
<field name="target">new</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class InvoiceExceptionConfirm(models.TransientModel):
|
class AccountMoveExceptionConfirm(models.TransientModel):
|
||||||
_name = 'invoice.exception.confirm'
|
_name = 'account.move.exception.confirm'
|
||||||
_inherit = ['exception.rule.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):
|
def action_confirm(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="view_account_move_exception_confirm" model="ir.ui.view">
|
||||||
|
<field name="name">Stock Exceptions Rules</field>
|
||||||
|
<field name="model">account.move.exception.confirm</field>
|
||||||
|
<field name="inherit_id" ref="base_exception.view_exception_rule_confirm"/>
|
||||||
|
<field name="mode">primary</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//footer" position="inside">
|
||||||
|
<button class="oe_link" special="cancel" string="Cancel"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_account_move_exception_confirm" model="ir.actions.act_window">
|
||||||
|
<field name="name">Blocked due to exceptions</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">account.move.exception.confirm</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="view_account_move_exception_confirm"/>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ Custom exceptions on delivery orders
|
|||||||
'stock',
|
'stock',
|
||||||
],
|
],
|
||||||
'data': [
|
'data': [
|
||||||
|
'demo/stock_exception_demo.xml',
|
||||||
'security/ir.model.access.csv',
|
'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',
|
||||||
|
|||||||
Reference in New Issue
Block a user