← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~akretion-team/account-financial-tools/7-account-journal-sale-refund-link-cde into lp:account-financial-tools

 

Chafique DELLI has proposed merging lp:~akretion-team/account-financial-tools/7-account-journal-sale-refund-link-cde into lp:account-financial-tools.

Commit message:
add module 'account_journal_sale_refund_link'

Requested reviews:
  Akretion Team (akretion-team)

For more details, see:
https://code.launchpad.net/~akretion-team/account-financial-tools/7-account-journal-sale-refund-link-cde/+merge/223037

add module 'account_journal_sale_refund_link' who was in the branch 'lp:account-extra-addons' in the version 6.1 and i ported in the version 7.0
-- 
https://code.launchpad.net/~akretion-team/account-financial-tools/7-account-journal-sale-refund-link-cde/+merge/223037
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch lp:account-financial-tools.
=== added directory 'account_journal_sale_refund_link'
=== added file 'account_journal_sale_refund_link/__init__.py'
--- account_journal_sale_refund_link/__init__.py	1970-01-01 00:00:00 +0000
+++ account_journal_sale_refund_link/__init__.py	2014-06-13 08:50:24 +0000
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#
+#    account_journal_sale_refund_link for OpenERP
+#    Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#                  2014 Akretion Chafique DELLI <chafique.delli@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#################################################################################
+
+
+import account
+import account_invoice_refund

=== added file 'account_journal_sale_refund_link/__openerp__.py'
--- account_journal_sale_refund_link/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_journal_sale_refund_link/__openerp__.py	2014-06-13 08:50:24 +0000
@@ -0,0 +1,39 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#
+#    account_journal_sale_refund_link for OpenERP
+#    Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#                  2014 Akretion Chafique DELLI <chafique.delli@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#################################################################################
+
+
+{
+    'name': 'account_journal_sale_refund_link',
+    'version': '0.1',
+    'category': 'Generic Modules/Others',
+    'license': 'AGPL-3',
+    'description': """empty""",
+    'author': 'Akretion',
+    'website': 'http://www.akretion.com/',
+    'depends': ['account'],
+    'data': [
+           'account_view.xml',
+    ],
+    'demo': [],
+    'installable': True,
+    'active': False,
+}

=== added file 'account_journal_sale_refund_link/account.py'
--- account_journal_sale_refund_link/account.py	1970-01-01 00:00:00 +0000
+++ account_journal_sale_refund_link/account.py	2014-06-13 08:50:24 +0000
@@ -0,0 +1,34 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#
+#    account_journal_sale_refund_link for OpenERP
+#    Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#                  2014 Akretion Chafique DELLI <chafique.delli@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#################################################################################
+
+from openerp.osv import fields, orm
+
+
+class Account_journal(orm.Model):
+
+    _inherit = "account.journal"
+
+
+    _columns = {
+        'refund_journal_id':fields.many2one('account.journal', 'Refund Journal',
+                                            domain=[('type', '=', 'sale_refund')]),
+    }

=== added file 'account_journal_sale_refund_link/account_invoice_refund.py'
--- account_journal_sale_refund_link/account_invoice_refund.py	1970-01-01 00:00:00 +0000
+++ account_journal_sale_refund_link/account_invoice_refund.py	2014-06-13 08:50:24 +0000
@@ -0,0 +1,41 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#
+#    account_journal_sale_refund_link for OpenERP
+#    Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#                  2014 Akretion Chafique DELLI <chafique.delli@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#################################################################################
+
+from openerp.osv import orm
+
+
+class Account_invoice_refund(orm.TransientModel):
+
+    _inherit = "account.invoice.refund"
+
+    def _get_journal(self, cr, uid, context=None):
+        invoice_id = context.get('invoice_ids', [context['active_id']])[0]
+        invoice = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
+        refund_journal_id = invoice.journal_id.refund_journal_id
+        if refund_journal_id:
+            return refund_journal_id.id
+        else:
+            return super(Account_invoice_refund, self)._get_journal(cr, uid, context)
+
+    _defaults = {
+    'journal_id': _get_journal,
+    }

=== added file 'account_journal_sale_refund_link/account_view.xml'
--- account_journal_sale_refund_link/account_view.xml	1970-01-01 00:00:00 +0000
+++ account_journal_sale_refund_link/account_view.xml	2014-06-13 08:50:24 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<openerp>
+    <data>
+
+        <record id="account_journal_sale_refund_link_account_journal_view_form" model="ir.ui.view">
+            <field name="model">account.journal</field>
+            <field name="inherit_id" ref="account.view_account_journal_form" />
+            <field eval="16" name="priority"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <data>
+                    <field name="type" position="after">
+                        <field name="refund_journal_id" attrs="{'invisible' : [('type', '!=', 'sale')]}"/>
+                    </field>
+                </data>
+            </field>
+        </record>
+
+    </data>
+</openerp>


Follow ups