Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
Merge a4b77b4 into 909ef5e
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Oct 18, 2018
2 parents 909ef5e + a4b77b4 commit f15f85e
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 95 deletions.
30 changes: 30 additions & 0 deletions account_move_change_number/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

============================
Account - Move Change Number
============================

That module allows special user to rename account move.

Usefull if the account move doesn't have the good numeration.
(for exemple if you change account move sequence)

Technical informations
----------------------

* change account move name with next sequence
* add in the field 'narration' the old name

Contributors
------------

* Sylvain LE GAL (https://twitter.com/legalsylvain)

Funders
-------

The development of this module has been financially supported by:

* GRAP, Groupement Régional Alimentaire de Proximité (http://www.grap.coop)
4 changes: 2 additions & 2 deletions account_move_change_number/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- encoding: utf-8 -*-
from . import model
# coding: utf-8
from . import models
62 changes: 12 additions & 50 deletions account_move_change_number/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,23 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account - Move Change Number Module for Odoo
# Copyright (C) 2013-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# 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/>.
#
##############################################################################
# coding: utf-8
# Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Account - Move Change Number',
'version': '1.0',
'version': '8.0.1.0.0',
'category': 'Accounting',
'description': """
Allow special user to rename account move
=========================================
Features
--------
* Allow special user to rename account move ;
Usefull if the account move doesn't have the good numeration.
(for exemple if you change account move sequence) ;
Technical informations
----------------------
* change account move name with next sequence ;
* add in the field 'narration' the old name ;
Copyright, Author and Licence
-----------------------------
* Copyright : 2014, Groupement Régional Alimentaire de Proximité;
* Author
* Sylvain LE GAL (https://twitter.com/legalsylvain);
* Licence : AGPL-3 (http://www.gnu.org/licenses/)
""",
'summary': "Allow special user to rename account move",
'author': 'GRAP',
'website': 'http://www.grap.coop',
'license': 'AGPL-3',
'depends': [
'account',
'account_cancel',
],
'data': [
'security/res_groups.yml',
'views/account_move_view.xml',
'security/res_groups.xml',
'views/view_account_move.xml',
],
'demo': [
'demo/res_groups.xml',
],
}
17 changes: 17 additions & 0 deletions account_move_change_number/demo/res_groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2015 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<openerp><data>

<record id="account.group_account_manager" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>

<record id="res_group_account_move_change_number_manager" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>

</data></openerp>
15 changes: 15 additions & 0 deletions account_move_change_number/security/res_groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->

<openerp><data>

<record id="res_group_account_move_change_number_manager" model="res.groups">
<field name="name">Account Move - Change Number</field>
<field name="category_id" ref="base.module_category_usability" />
</record>

</data></openerp>
26 changes: 0 additions & 26 deletions account_move_change_number/security/res_groups.yml

This file was deleted.

Binary file removed account_move_change_number/static/src/img/icon.png
Binary file not shown.
2 changes: 2 additions & 0 deletions account_move_change_number/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# coding: utf-8
from . import test_module
31 changes: 31 additions & 0 deletions account_move_change_number/tests/test_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# coding: utf-8
# Copyright (C) 2018 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp.tests.common import TransactionCase


class TestModule(TransactionCase):

def setUp(self):
super(TestModule, self).setUp()
self.invoice = self.env.ref('account.invoice_1')
self.move = self.invoice.move_id

def test_01_rename_move(self):
# Allow cancelling entries
self.move.journal_id.update_posted = True

# Get sequence
sequence = self.move.journal_id.sequence_id

next_name = ("%s%s") % (
self.move.name[:-sequence.padding],
str(sequence.number_next_actual).zfill(sequence.padding))

self.move.rename_account_move_change_number()

self.assertEqual(
self.move.name, next_name,
"Rename of accounting entry failed.")
17 changes: 0 additions & 17 deletions account_move_change_number/views/account_move_view.xml

This file was deleted.

22 changes: 22 additions & 0 deletions account_move_change_number/views/view_account_move.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
@author Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->

<openerp><data>

<record id="view_account_move_form" model="ir.ui.view">
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<button name="button_cancel" position="after">
<button name="rename_account_move_change_number"
string="Rename Account Move (change Number)" type="object" states="posted"
groups="account_move_change_number.res_group_account_move_change_number_manager" confirm="Are you sure you want to rename this entry ?"/>
</button>
</field>
</record>

</data></openerp>

0 comments on commit f15f85e

Please sign in to comment.