From db5010eca180a84ef5cc7a2a93452a9d385e4932 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 3 Nov 2010 11:51:28 +0530 Subject: [PATCH 1/4] [ADD] account: Add groups on account_analytic_id bzr revid: psi@tinyerp.co.in-20101103062128-7g2nplcwzcw54kqb --- addons/account/account_move_line.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index ffea12170a2..32f7d1d496e 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -929,6 +929,9 @@ class account_move_line(osv.osv): elif field == 'date': attrs.append('on_change="onchange_date(date)"') + elif field == 'analytic_account_id': + attrs.append('''groups="analytic.group_analytic_accounting"''') + if field in ('amount_currency', 'currency_id'): attrs.append('on_change="onchange_currency(account_id, amount_currency, currency_id, date, journal_id)"') attrs.append('''attrs="{'readonly': [('state', '=', 'valid')]}"''') From 4dfe00adee073a3352d391bb07bf7aed77dc06fb Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 3 Nov 2010 13:47:13 +0530 Subject: [PATCH 2/4] [FIX] Account: account journals code and journal name should be unique lp bug: https://launchpad.net/bugs/669532 fixed bzr revid: mra@mra-laptop-20101103081713-p0hgynh02lr0v2wp --- addons/account/account.py | 13 +++++++++++++ addons/account/demo/account_minimal.xml | 14 +++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 507d1d392d9..90947a59ae4 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -614,9 +614,22 @@ class account_journal(osv.osv): 'user_id': lambda self,cr,uid,context: uid, 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } + _sql_constraints = [ + ('code_company_uniq', 'unique (code, company_id)', 'The code of the journal must be unique per company !'), + ('name_company_uniq', 'unique (name, company_id)', 'The name of the journal must be unique per company !'), + ] _order = 'code' + def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False): + journal = self.browse(cr, uid, id, context=context) + if not default: + default = {} + default = default.copy() + default['code'] = (journal['code'] or '') + '(copy)' + default['name'] = (journal['name'] or '') + '(copy)' + return super(account_journal, self).copy(cr, uid, id, default, context=context) + def write(self, cr, uid, ids, vals, context=None): if 'company_id' in vals: move_lines = self.pool.get('account.move.line').search(cr, uid, [('journal_id', 'in', ids)]) diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index 87c8a37254d..d17fe1d760c 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -342,7 +342,7 @@ Sales Journal - (test) - SAJ + SAJ - (test) sale @@ -353,7 +353,7 @@ Sales Credit Note Journal - (test) - SCNJ + SCNJ- (test) sale_refund @@ -366,7 +366,7 @@ Expenses Journal - (test) - EXJ + EXJ- (test) purchase @@ -377,7 +377,7 @@ Expenses Credit Notes Journal - (test) - ECNJ + ECNJ- (test) purchase_refund @@ -390,7 +390,7 @@ Bank Journal - (test) - BNK + BNK- (test) bank @@ -401,7 +401,7 @@ Checks Journal - (test) - CHK + CHK- (test) bank @@ -412,7 +412,7 @@ Cash Journal - (test) - CSH + CSH- (test) cash From f0c123111c9accf12991d6de48f8dc4944a71c53 Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 3 Nov 2010 13:56:39 +0530 Subject: [PATCH 3/4] [ADD]:-added 'account_sequence' module to maintain internal sequence number on the accounting entries bzr revid: mtr@mtr-20101103082639-xd4a0pwkabqit2t7 --- addons/account_sequence/__init__.py | 24 +++++++++ addons/account_sequence/__openerp__.py | 39 ++++++++++++++ addons/account_sequence/account_sequence.py | 52 +++++++++++++++++++ addons/account_sequence/account_sequence.xml | 30 +++++++++++ .../account_sequence_data.xml | 12 +++++ .../account_sequence_minimal.xml | 32 ++++++++++++ 6 files changed, 189 insertions(+) create mode 100644 addons/account_sequence/__init__.py create mode 100644 addons/account_sequence/__openerp__.py create mode 100644 addons/account_sequence/account_sequence.py create mode 100644 addons/account_sequence/account_sequence.xml create mode 100644 addons/account_sequence/account_sequence_data.xml create mode 100644 addons/account_sequence/account_sequence_minimal.xml diff --git a/addons/account_sequence/__init__.py b/addons/account_sequence/__init__.py new file mode 100644 index 00000000000..535fb766048 --- /dev/null +++ b/addons/account_sequence/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +import account_sequence + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_sequence/__openerp__.py b/addons/account_sequence/__openerp__.py new file mode 100644 index 00000000000..5781e6db79e --- /dev/null +++ b/addons/account_sequence/__openerp__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +{ + 'name': 'Sequence Numbering', + 'version': '1.1', + 'category': 'Generic Modules/Accounting', + 'description': """ + This module maintains internal sequence number for accounting entries. + """, + 'author': 'OpenERP SA', + 'website': 'http://www.openerp.com', + 'depends': ['account'], + 'init_xml': [], + 'update_xml': ['account_sequence_data.xml','account_sequence.xml'], + 'demo_xml': ['account_sequence_minimal.xml'], + 'installable': True, + 'active': False, + 'certificate': '', +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py new file mode 100644 index 00000000000..f9a881decbc --- /dev/null +++ b/addons/account_sequence/account_sequence.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import osv, fields + +class account_move(osv.osv): + _inherit = 'account.move' + + _columns = { + 'internal_sequence_number': fields.char('Internal Sequence Number', size=64, readonly=True), + } + + def post(self, cr, uid, ids, context=None): + obj_sequence = self.pool.get('ir.sequence') + res = super(account_move, self).post(cr, uid, ids, context) + for line in self.browse(cr, uid, ids): + if line.journal_id.internal_sequence: + c = {'fiscalyear_id': line.period_id.fiscalyear_id.id} + seq_no = obj_sequence.get_id(cr, uid, line.journal_id.internal_sequence.id, context=c) + if seq_no: + self.write(cr, uid, [line.id], {'internal_sequence_number':seq_no}) + return res + +account_move() + +class account_journal(osv.osv): + _inherit = "account.journal" + + _columns = { + 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence'), + } +account_journal() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_sequence/account_sequence.xml b/addons/account_sequence/account_sequence.xml new file mode 100644 index 00000000000..92c145a9b2e --- /dev/null +++ b/addons/account_sequence/account_sequence.xml @@ -0,0 +1,30 @@ + + + + + + account.move.form.inherit + account.move + form + + + + + + + + + + account.journal.form.inherit + account.journal + form + + + + + + + + + + diff --git a/addons/account_sequence/account_sequence_data.xml b/addons/account_sequence/account_sequence_data.xml new file mode 100644 index 00000000000..5429d93b522 --- /dev/null +++ b/addons/account_sequence/account_sequence_data.xml @@ -0,0 +1,12 @@ + + + + + + + Internal Sequence Journal + account.journal + 1 + + + \ No newline at end of file diff --git a/addons/account_sequence/account_sequence_minimal.xml b/addons/account_sequence/account_sequence_minimal.xml new file mode 100644 index 00000000000..d634c2aa3af --- /dev/null +++ b/addons/account_sequence/account_sequence_minimal.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 3a02ee75a627860a89b13062ada25e50f26fec1d Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 3 Nov 2010 17:19:13 +0530 Subject: [PATCH 4/4] [FIX] Sale:renamed the button for sales in Exception state lp bug: https://launchpad.net/bugs/643552 fixed bzr revid: mtr@mtr-20101103114913-usj5yg7gee4ed0r7 --- addons/sale/sale_view.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 5c3690504c2..85e36f068fd 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -206,9 +206,9 @@