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="sequence">50</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="code">if not invoice.partner_id.phone: failed=True</field>
|
||||
<field name="active" eval="False"/>
|
||||
<field name="code">if journal_entry.move_type == 'out_customer' and not journal_entry.partner_id.phone: failed=True</field>
|
||||
<field name="active" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
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"?>
|
||||
<odoo>
|
||||
|
||||
<record id="action_invoice_test_tree" model="ir.actions.act_window">
|
||||
<field name="name">Invoice Exception Rules</field>
|
||||
<record id="action_account_move_test_tree" model="ir.actions.act_window">
|
||||
<field name="name">Journal Entry Exception Rules</field>
|
||||
<field name="res_model">exception.rule</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="base_exception.view_exception_rule_tree"/>
|
||||
@@ -11,8 +11,8 @@
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action="action_invoice_test_tree"
|
||||
id="menu_invoice_test"
|
||||
action="action_account_move_test_tree"
|
||||
id="menu_account_move_test"
|
||||
sequence="10"
|
||||
parent="account.menu_finance_configuration"
|
||||
groups="base_exception.group_exception_rule_manager"
|
||||
@@ -26,23 +26,22 @@
|
||||
<sheet position="before">
|
||||
<div class="alert alert-danger" role="alert" style="margin-bottom:0px;"
|
||||
attrs="{'invisible': [('exceptions_summary','=',False)]}">
|
||||
<p><strong>There are exceptions blocking the post of this Invoice:
|
||||
</strong></p>
|
||||
<p><strong>There are exceptions blocking the post of this Journal Entry:</strong></p>
|
||||
<field name="exceptions_summary"/>
|
||||
<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."
|
||||
groups="base_exception.group_exception_rule_manager"/>
|
||||
</div>
|
||||
</sheet>
|
||||
<xpath expr="//field[@name='origin']/.." position="inside">
|
||||
<xpath expr="//field[@name='journal_id']/.." position="after">
|
||||
<field name="ignore_exception" states="done" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_move_tree" model="ir.ui.view">
|
||||
<field name="name">saccount.move.tree.inherit.exception</field>
|
||||
<field name="model">saccount.move</field>
|
||||
<field name="name">account.move.tree.inherit.exception</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="state" position="after">
|
||||
@@ -53,7 +52,7 @@
|
||||
|
||||
<record id="view_account_invoice_filter" model="ir.ui.view">
|
||||
<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="arch" type="xml">
|
||||
<filter name="late" position="after">
|
||||
|
||||
@@ -1,25 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<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>
|
||||
from . import account_move_exception_confirm
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
'data': [
|
||||
'demo/stock_exception_demo.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'views/stock_views.xml',
|
||||
'wizard/stock_exception_confirm_views.xml',
|
||||
|
||||
Reference in New Issue
Block a user