Skip to content

Commit

Permalink
[12.0] [ADD] Account payment return reason action type
Browse files Browse the repository at this point in the history
  • Loading branch information
qgroulard committed Feb 10, 2020
1 parent b84c214 commit 3dd3648
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
1 change: 1 addition & 0 deletions account_payment_return/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'data': [
'security/ir.model.access.csv',
'security/account_payment_return_security.xml',
'views/payment_return_reason_view.xml',
'views/payment_return_view.xml',
'views/account_journal_view.xml',
'data/ir_sequence_data.xml',
Expand Down
21 changes: 21 additions & 0 deletions account_payment_return/models/payment_return_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,33 @@
from odoo import api, fields, models


class PaymentReturnReasonActionType(models.Model):

_name = "payment.return.reason.action.type"
_description = "Payment Return Reason Action Types"
_order = "sequence, id"

name = fields.Char(required=True)
sequence = fields.Integer("Sequence", default=10)
active = fields.Boolean(default=True)
company_id = fields.Many2one(
"res.company",
"Company",
default=lambda self: self.env.user.company_id,
ondelete="cascade",
)


class PaymentReturnReason(models.Model):
_name = "payment.return.reason"
_description = 'Payment return reason'

code = fields.Char()
name = fields.Char(string='Reason', translate=True)
next_action_type_id = fields.Many2one(
comodel_name="payment.return.reason.action.type",
string="Next Action",
)

@api.model
def name_search(self, name, args=None, operator='ilike', limit=100):
Expand Down
1 change: 1 addition & 0 deletions account_payment_return/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_payment_return,payment.return,model_payment_return,account.group_account_invoice,1,1,1,1
access_payment_return_line,payment.return.line,model_payment_return_line,account.group_account_invoice,1,1,1,1
access_payment_return_reason,payment.return.reason,model_payment_return_reason,account.group_account_invoice,1,1,1,1
access_payment_return_reason_action_type,payment.return.reason.action.type,model_payment_return_reason_action_type,account.group_account_invoice,1,1,1,1
55 changes: 55 additions & 0 deletions account_payment_return/views/payment_return_reason_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>

<!-- Payment Return Reason Action Types -->
<record model="ir.ui.view" id="payment_return_reason_action_type_form_view">
<field name="name">payment.return.reason.action.type.form</field>
<field name="model">payment.return.reason.action.type</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"/>
</button>
</div>
<group>
<group>
<field name="name"/>
</group>
</group>
</sheet>
</form>
</field>
</record>


<record model="ir.ui.view" id="payment_return_reason_action_type_tree_view">
<field name="name">payment.return.reason.action.type.tree</field>
<field name="model">payment.return.reason.action.type</field>
<field name="arch" type="xml">
<tree>
<field name="sequence" widget="handle"/>
<field name="name"/>
</tree>
</field>
</record>

<record model="ir.actions.act_window" id="payment_return_reason_action_type_act_window">
<field name="name">Payment Return Reason Action Types</field>
<field name="res_model">payment.return.reason.action.type</field>
<field name="view_mode">tree,form</field>
</record>

<record model="ir.ui.menu" id="payment_return_reason_action_type_menu">
<field name="name">Payment Return Reason Action Types</field>
<field name="parent_id" ref="account.menu_finance_configuration"/>
<field name="action" ref="payment_return_reason_action_type_act_window"/>
<field name="sequence" eval="32"/>
</record>

</odoo>

0 comments on commit 3dd3648

Please sign in to comment.