-
-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Description | ||
=========== | ||
|
||
This module allows you to define a list of reasons to create a credit note from an invoice and report on them. | ||
|
||
Configuration | ||
============= | ||
Go to Accounting > Configuration > Management > Refund Reasons | ||
Create the different reasons you want to provide users | ||
|
||
Usage | ||
===== | ||
|
||
Go to Accounting > Customers > Invoices (or Accounting > Vendors > Bills) | ||
Select an open invoice (or bill) | ||
Click on the "Add Credit Note" | ||
Select the reason and create the credit note | ||
|
||
Credits | ||
======= | ||
|
||
* Open Source Integrators <http://www.opensourceintegrators.com> | ||
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com> | ||
|
||
Contributors | ||
============ | ||
|
||
* Open Source Integrators <http://www.opensourceintegrators.com> | ||
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 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 models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 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). | ||
|
||
{ | ||
'name': 'Account Invoice Refund Reason', | ||
'version': '12.0.1.0.0', | ||
"summary": "Account Invoice Refund Reason.", | ||
'category': 'Accounting', | ||
'author': "Open Source Integrators, " | ||
"Odoo Community Association (OCA), ", | ||
"Serpent CS, " | ||
'website': 'https://github.com/OCA/account-invoicing.git', | ||
'data': ['security/ir.model.access.csv', | ||
'data/account.invoice.refund.reason.csv', | ||
'views/account_invoice_view.xml', | ||
'views/account_invoice_refund_reason_view.xml', | ||
'wizard/account_invoice_refund_view.xml'], | ||
'depends': ['account'], | ||
'license': 'AGPL-3', | ||
'development_status': 'Beta', | ||
'maintainers': ['max3903'] | ||
} |
8 changes: 8 additions & 0 deletions
8
account_invoice_refund_reason/data/account.invoice.refund.reason.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
id,name | ||
refund_reason_cancellation,Cancellation | ||
refund_reason_noref,Invoice without reference | ||
refund_reason_error,Lease and/or Minimum Charge Error | ||
refund_reason_agreement,Commercial and/or Collection Agreement | ||
refund_reason_difference,Price Difference | ||
refund_reason_correction,Data Correction | ||
refund_reason_others,Others |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 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_invoice_refund_reason | ||
from . import account_invoice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 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 fields, models | ||
|
||
|
||
class AccountInvoice(models.Model): | ||
_inherit = 'account.invoice' | ||
|
||
reason_id = fields.Many2one('account.invoice.refund.reason', | ||
string="Reason") |
12 changes: 12 additions & 0 deletions
12
account_invoice_refund_reason/models/account_invoice_refund_reason.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 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 fields, models | ||
|
||
|
||
class AccountInvoiceRefundReason(models.Model): | ||
_name = 'account.invoice.refund.reason' | ||
_description = 'Account Invoice refund Reasons' | ||
|
||
name = fields.Char('Name', required=True, translate=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_account_invoice_refund_reason_user,access_account_invoice_refund_reason_user,model_account_invoice_refund_reason,account.group_account_invoice,1,0,0,0 | ||
access_account_invoice_refund_reason_manager,access_account_invoice_refund_reason_manager,model_account_invoice_refund_reason,account.group_account_manager,1,1,1,1 |
39 changes: 39 additions & 0 deletions
39
account_invoice_refund_reason/views/account_invoice_refund_reason_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<odoo> | ||
<record id="view_account_invoice_refund_reason" model="ir.ui.view"> | ||
<field name="name">account.invoice.refund.reason.form</field> | ||
<field name="model">account.invoice.refund.reason</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<sheet> | ||
<group> | ||
<field name="name"/> | ||
</group> | ||
</sheet> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="view_account_invoice_refund_reason_tree" model="ir.ui.view"> | ||
<field name="name">account.invoice.refund.reason.tree</field> | ||
<field name="model">account.invoice.refund.reason</field> | ||
<field name="arch" type="xml"> | ||
<tree> | ||
<field name="name"/> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="refund_reason_action" model="ir.actions.act_window"> | ||
<field name="name">Refund Reasons</field> | ||
<field name="res_model">account.invoice.refund.reason</field> | ||
<field name="view_type">form</field> | ||
<field name="view_mode">tree,form</field> | ||
</record> | ||
|
||
<menuitem | ||
id="refund_reasons_menu" | ||
name="Refund Reasons" | ||
parent="account.account_management_menu" | ||
action="refund_reason_action" | ||
groups="base.group_user"/> | ||
</odoo> |
29 changes: 29 additions & 0 deletions
29
account_invoice_refund_reason/views/account_invoice_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<odoo> | ||
<record id="extended_view_account_invoice" model="ir.ui.view"> | ||
<field name="name">extended.account.invoice.form</field> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.invoice_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='reference']" position="after"> | ||
<field name="reason_id" attrs="{'invisible': [('reason_id', '=', False)]}" readonly="1"/> | ||
</xpath> | ||
<xpath expr="//page[@name='other_info']/group/group[1]/field[@name='name']" position="attributes"> | ||
<attribute name="attrs">{'invisible': [('reason_id','!=', False)]}</attribute> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record id="extended_view_account_invoice_supplier_form" model="ir.ui.view"> | ||
<field name="name">extended.account.invoice.supplier.form</field> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//page[@name='other_info']/group/group[1]/field[@name='name']" position="attributes"> | ||
<attribute name="attrs">{'invisible': [('reason_id','!=', False)]}</attribute> | ||
</xpath> | ||
<xpath expr="//field[@name='date']" position="after"> | ||
<field name="reason_id" attrs="{'invisible': [('reason_id', '=', False)]}" readonly="1"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# 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_invoice_refund |
30 changes: 30 additions & 0 deletions
30
account_invoice_refund_reason/wizard/account_invoice_refund.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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 AccountInvoiceRefund(models.TransientModel): | ||
_inherit = 'account.invoice.refund' | ||
|
||
reason_id = fields.Many2one('account.invoice.refund.reason', | ||
string="Reason") | ||
|
||
@api.onchange('reason_id') | ||
def _onchange_reason_id(self): | ||
if self.reason_id: | ||
self.description = self.reason_id.name | ||
|
||
@api.multi | ||
def invoice_refund(self): | ||
res = super(AccountInvoiceRefund, self).invoice_refund() | ||
data_refund = self.read(['filter_refund'])[0]['filter_refund'] | ||
if data_refund == 'modify': | ||
inv_id = res.get('res_id') | ||
else: | ||
inv_id = res.get('domain')[1][2][0] | ||
if inv_id: | ||
invoice = self.env['account.invoice'].browse(inv_id) | ||
invoice.reason_id = self.reason_id | ||
return res |
16 changes: 16 additions & 0 deletions
16
account_invoice_refund_reason/wizard/account_invoice_refund_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<odoo> | ||
<record id="extended_view_account_invoice_refund" model="ir.ui.view"> | ||
<field name="name">extended.account.invoice.refund.form</field> | ||
<field name="model">account.invoice.refund</field> | ||
<field name="inherit_id" ref="account.view_account_invoice_refund"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='description']" position="attributes"> | ||
<attribute name="invisible">1</attribute> | ||
<attribute name="required">0</attribute> | ||
</xpath> | ||
<xpath expr="//group[3]" position="inside"> | ||
<field name="reason_id" required="1"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |