Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
4
account_invoice_refund_reason/wizard/__init__.py
Normal file
4
account_invoice_refund_reason/wizard/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Copyright (C) 2019 Open Source Integrators
|
||||
# Copyright (C) 2019 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import account_move_reversal
|
||||
@@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2019 Open Source Integrators
|
||||
# Copyright (C) 2019 Serpent Consulting Services Pvt. Ltd.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountMoveReversal(models.TransientModel):
|
||||
_inherit = "account.move.reversal"
|
||||
|
||||
reason_id = fields.Many2one("account.move.refund.reason", string="Refund Reason")
|
||||
reason = fields.Char(
|
||||
compute="_compute_reason", precompute=True, store=True, readonly=False
|
||||
)
|
||||
|
||||
@api.depends("reason_id")
|
||||
def _compute_reason(self):
|
||||
for record in self:
|
||||
if record.reason_id:
|
||||
record.reason = record.reason_id.name
|
||||
|
||||
def reverse_moves(self, is_modify=False):
|
||||
"""Overriden to set the reason_id fields in the new created refunds"""
|
||||
res = super().reverse_moves(is_modify=is_modify)
|
||||
self.move_ids.reversal_move_ids.filtered(lambda x: not x.reason_id).write(
|
||||
{"reason_id": self.reason_id.id}
|
||||
)
|
||||
return res
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_account_move_reversal" model="ir.ui.view">
|
||||
<field name="name">view.account.move.reversal.form</field>
|
||||
<field name="model">account.move.reversal</field>
|
||||
<field name="inherit_id" ref="account.view_account_move_reversal" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='reason']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
<attribute name="required">0</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='date']" position="before">
|
||||
<field name="reason_id" required="1" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user