diff options
| author | uco (OpenERP) <uco@tinyerp.com> | 2010-12-06 18:41:02 +0530 |
|---|---|---|
| committer | uco (OpenERP) <uco@tinyerp.com> | 2010-12-06 18:41:02 +0530 |
| commit | b1cf433ecc01a58c8abe27fdf9dbaba2deedf7f5 (patch) | |
| tree | 7d4b2df75b76c3529854cf98c401ad59370ce00a /addons/account_sequence | |
| parent | eb04af83f31615e220a1b5e9639e799eb88242d6 (diff) | |
| parent | 5350ab0c1930e6573ee52bd430bb1d0f5adea2a3 (diff) | |
[MERGE]: Merged with trunk-addons.
bzr revid: uco@tinyerp.com-20101206131102-z2xzz8eshkswo00q
Diffstat (limited to 'addons/account_sequence')
| -rw-r--r-- | addons/account_sequence/__init__.py | 1 | ||||
| -rw-r--r-- | addons/account_sequence/__openerp__.py | 6 | ||||
| -rw-r--r-- | addons/account_sequence/account_sequence.py | 14 | ||||
| -rw-r--r-- | addons/account_sequence/account_sequence.xml | 2 | ||||
| -rw-r--r-- | addons/account_sequence/account_sequence_data.xml | 8 | ||||
| -rw-r--r-- | addons/account_sequence/account_sequence_installer.py | 83 | ||||
| -rw-r--r-- | addons/account_sequence/account_sequence_installer_view.xml | 57 | ||||
| -rw-r--r-- | addons/account_sequence/i18n/account_sequence.pot | 160 |
8 files changed, 296 insertions, 35 deletions
diff --git a/addons/account_sequence/__init__.py b/addons/account_sequence/__init__.py index 535fb766048..b6707106d4b 100644 --- a/addons/account_sequence/__init__.py +++ b/addons/account_sequence/__init__.py @@ -20,5 +20,6 @@ ############################################################################## import account_sequence +import account_sequence_installer # 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 index 966cbcbc8ca..1e3f91a7876 100644 --- a/addons/account_sequence/__openerp__.py +++ b/addons/account_sequence/__openerp__.py @@ -30,7 +30,11 @@ 'website': 'http://www.openerp.com', 'depends': ['account'], 'init_xml': [], - 'update_xml': ['account_sequence_data.xml','account_sequence.xml'], + 'update_xml': [ + 'account_sequence_data.xml', + 'account_sequence_installer_view.xml', + 'account_sequence.xml' + ], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py index e658e61c4af..3c45604b726 100644 --- a/addons/account_sequence/account_sequence.py +++ b/addons/account_sequence/account_sequence.py @@ -34,11 +34,11 @@ class account_move(osv.osv): obj_sequence = self.pool.get('ir.sequence') res = super(account_move, self).post(cr, uid, ids, context=context) seq_no = False - for line in self.browse(cr, uid, ids, context=context): - if line.journal_id.internal_sequence: - seq_no = obj_sequence.get_id(cr, uid, line.journal_id.internal_sequence.id, context=context) + for move in self.browse(cr, uid, ids, context): + if move.journal_id.internal_sequence_id: + seq_no = obj_sequence.get_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context) if seq_no: - self.write(cr, uid, [line.id], {'internal_sequence_number': seq_no}) + self.write(cr, uid, [move.id], {'internal_sequence_number': seq_no}) return res account_move() @@ -47,7 +47,7 @@ class account_journal(osv.osv): _inherit = "account.journal" _columns = { - 'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence'), + 'internal_sequence_id': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used to maintain the internal number for the journal entries related to this journal."), } account_journal() @@ -58,5 +58,7 @@ class account_move_line(osv.osv): _columns = { 'internal_sequence_number': fields.related('move_id','internal_sequence_number', type='char', relation='account.move', help='Internal Sequence Number', string='Internal Number'), } + account_move_line() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_sequence/account_sequence.xml b/addons/account_sequence/account_sequence.xml index dd9c1a36cd4..6b9e2c94402 100644 --- a/addons/account_sequence/account_sequence.xml +++ b/addons/account_sequence/account_sequence.xml @@ -21,7 +21,7 @@ <field name="inherit_id" ref="account.view_account_journal_form"/> <field name="arch" type="xml"> <field name="sequence_id" position="after"> - <field name="internal_sequence"/> + <field name="internal_sequence_id"/> </field> </field> </record> diff --git a/addons/account_sequence/account_sequence_data.xml b/addons/account_sequence/account_sequence_data.xml index 0059f7d41a9..1ad362b3979 100644 --- a/addons/account_sequence/account_sequence_data.xml +++ b/addons/account_sequence/account_sequence_data.xml @@ -1,14 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - <!--Account Journal Internal Sequences--> - <record id="internal_sequence_journal" model="ir.sequence"> - <field name="name">Internal Sequence Journal</field> - <field name="code">account.journal</field> - <field name="number_next">1</field> - </record> - - <function eval="('default', False, 'internal_sequence', [('account.journal', False)], internal_sequence_journal, True, False, False, False, True)" id="internal_seq_default_set" model="ir.values" name="set"/> <!--Account Journal Internal Number of account move line--> diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py new file mode 100644 index 00000000000..f7bcb113388 --- /dev/null +++ b/addons/account_sequence/account_sequence_installer.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). +# +# 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 osv import fields, osv + +class account_sequence_installer(osv.osv_memory): + _name = 'account.sequence.installer' + _inherit = 'res.config.installer' + + _columns = { + 'name': fields.char('Name',size=64, required=True), + 'prefix': fields.char('Prefix',size=64, help="Prefix value of the record for the sequence"), + 'suffix': fields.char('Suffix',size=64, help="Suffix value of the record for the sequence"), + 'number_next': fields.integer('Next Number', required=True, help="Next number of this sequence"), + 'number_increment': fields.integer('Increment Number', required=True, help="The next number of the sequence will be incremented by this number"), + 'padding' : fields.integer('Number padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."), + 'company_id': fields.many2one('res.company', 'Company'), + } + _defaults = { + 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'ir.sequence', context=c), + 'number_increment': 1, + 'number_next': 1, + 'padding' : 0, + 'name': 'Internal Sequence Journal', + } + + def execute(self, cr, uid, ids, context=None): + if context is None: + context = {} + jou_obj = self.pool.get('account.journal') + obj_sequence = self.pool.get('ir.sequence') + record = self.browse(cr, uid, ids, context)[0] + j_ids = [] + if record.company_id: + company_id = record.company_id.id, + search_criteria = [('company_id', '=', company_id)] + else: + company_id = False + search_criteria = [] + vals = { + 'id': 'internal_sequence_journal', + 'code': 'account.journal', + 'name': record.name, + 'prefix': record.prefix, + 'suffix': record.suffix, + 'number_next': record.number_next, + 'number_increment': record.number_increment, + 'padding' : record.padding, + 'company_id': company_id, + } + + ir_seq = obj_sequence.create(cr, uid, vals, context) + res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context) + journal_ids = jou_obj.search(cr, uid, search_criteria, context=context) + for journal in jou_obj.browse(cr, uid, journal_ids, context): + if not journal.internal_sequence_id: + j_ids.append(journal.id) + if j_ids: + jou_obj.write(cr, uid, j_ids, {'internal_sequence_id': ir_seq}) + self.pool.get('ir.values').set(cr, uid, key='default', key2=False, name='internal_sequence_id', models =[('account.journal', False)], value=ir_seq) + return res + +account_sequence_installer() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_sequence/account_sequence_installer_view.xml b/addons/account_sequence/account_sequence_installer_view.xml new file mode 100644 index 00000000000..1051b133045 --- /dev/null +++ b/addons/account_sequence/account_sequence_installer_view.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record id="view_account_sequence_installer" model="ir.ui.view"> + <field name="name">account.sequence.installer.view</field> + <field name="model">account.sequence.installer</field> + <field name="type">form</field> + <field name="inherit_id" ref="base.res_config_installer"/> + <field name="arch" type="xml"> + <data> + <form position="attributes"> + <attribute name="string">Account Sequence Application Configuration</attribute> + </form> + <separator string="title" position="attributes"> + <attribute name="string">Configure Your Account Sequence Application</attribute> + </separator> + <xpath expr='//separator[@string="vsep"]' position='attributes'> + <attribute name='string'></attribute> + </xpath> + <xpath expr="//label[@string='description']" position="attributes"> + <attribute name="string">You can enhance the Account Sequence Application by installing .</attribute> + </xpath> + <group colspan="8"> + <field name="name" colspan="4"/> + <field name="prefix"/> + <field name="suffix"/> + <field name="number_next"/> + <field name="number_increment"/> + <field name="padding"/> + <field name="company_id" groups="base.group_multi_company"/> + </group> + <xpath expr="//button[@string='Install Modules']" position="attributes"> + <attribute name="string">Configure</attribute> + </xpath> + </data> + </field> + </record> + + <record id="action_account_seq_installer" model="ir.actions.act_window"> + <field name="name">Account Sequence Application Configuration</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">account.sequence.installer</field> + <field name="view_id" ref="view_account_sequence_installer"/> + <field name="view_type">form</field> + <field name="view_mode">form</field> + <field name="target">new</field> + </record> + + <record id="account_seq_installer_todo" model="ir.actions.todo"> + <field name="action_id" ref="action_account_seq_installer"/> + <field name="sequence">3</field> + <field name="restart">onskip</field> + </record> + + </data> +</openerp> diff --git a/addons/account_sequence/i18n/account_sequence.pot b/addons/account_sequence/i18n/account_sequence.pot index 3c6132dfaa6..a8a4af9741d 100644 --- a/addons/account_sequence/i18n/account_sequence.pot +++ b/addons/account_sequence/i18n/account_sequence.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 6.0.0-rc1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2010-11-18 16:11:21+0000\n" -"PO-Revision-Date: 2010-11-18 16:11:21+0000\n" +"POT-Creation-Date: 2010-12-03 15:42:55+0000\n" +"PO-Revision-Date: 2010-12-03 15:42:55+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,33 +16,34 @@ msgstr "" "Plural-Forms: \n" #. module: account_sequence -#: sql_constraint:ir.module.module:0 -msgid "The certificate ID of the module must be unique !" +#: model:ir.actions.act_window,name:account_sequence.action_account_seq_installer +msgid "Account Sequence Application Configuration" msgstr "" #. module: account_sequence -#: constraint:ir.ui.view:0 -msgid "Invalid XML for View Architecture!" +#: constraint:account.move:0 +msgid "You cannot create entries on different periods/journals in the same move" msgstr "" #. module: account_sequence -#: model:ir.model,name:account_sequence.model_account_move -msgid "Account Entry" +#: help:account.move,internal_sequence_number:0 +#: help:account.move.line,internal_sequence_number:0 +msgid "Internal Sequence Number" msgstr "" #. module: account_sequence -#: field:account.move,internal_sequence_number:0 -msgid "Internal Sequence Number" +#: help:account.sequence.installer,number_next:0 +msgid "Next number of this sequence" msgstr "" #. module: account_sequence -#: model:ir.model,name:account_sequence.model_account_journal -msgid "Journal" +#: field:account.sequence.installer,number_next:0 +msgid "Next Number" msgstr "" #. module: account_sequence -#: sql_constraint:ir.module.module:0 -msgid "The name of the module must be unique !" +#: field:account.sequence.installer,number_increment:0 +msgid "Increment Number" msgstr "" #. module: account_sequence @@ -51,17 +52,138 @@ msgid "Entries Sequence Numbering" msgstr "" #. module: account_sequence -#: field:account.journal,internal_sequence:0 +#: help:account.sequence.installer,number_increment:0 +msgid "The next number of the sequence will be incremented by this number" +msgstr "" + +#. module: account_sequence +#: field:account.sequence.installer,progress:0 +msgid "Configuration Progress" +msgstr "" + +#. module: account_sequence +#: help:account.sequence.installer,suffix:0 +msgid "Suffix value of the record for the sequence" +msgstr "" + +#. module: account_sequence +#: field:account.sequence.installer,company_id:0 +msgid "Company" +msgstr "" + +#. module: account_sequence +#: help:account.journal,internal_sequence_id:0 +msgid "This sequence will be used to maintain the internal number for the journal entries related to this journal." +msgstr "" + +#. module: account_sequence +#: field:account.sequence.installer,padding:0 +msgid "Number padding" +msgstr "" + +#. module: account_sequence +#: model:ir.model,name:account_sequence.model_account_move_line +msgid "Journal Items" +msgstr "" + +#. module: account_sequence +#: field:account.move,internal_sequence_number:0 +#: field:account.move.line,internal_sequence_number:0 +msgid "Internal Number" +msgstr "" + +#. module: account_sequence +#: constraint:account.move.line:0 +msgid "Company must be same for its related account and period." +msgstr "" + +#. module: account_sequence +#: help:account.sequence.installer,padding:0 +msgid "OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size." +msgstr "" + +#. module: account_sequence +#: field:account.sequence.installer,name:0 +msgid "Name" +msgstr "" + +#. module: account_sequence +#: constraint:account.move.line:0 +msgid "You can not create move line on closed account." +msgstr "" + +#. module: account_sequence +#: constraint:account.move:0 +msgid "You cannot create more than one move per period on centralized journal" +msgstr "" + +#. module: account_sequence +#: sql_constraint:account.move.line:0 +msgid "Wrong credit or debit value in accounting entry !" +msgstr "" + +#. module: account_sequence +#: field:account.journal,internal_sequence_id:0 msgid "Internal Sequence" msgstr "" #. module: account_sequence -#: constraint:ir.model:0 -msgid "The Object name must start with x_ and not contain any special character !" +#: model:ir.model,name:account_sequence.model_account_sequence_installer +msgid "account.sequence.installer" +msgstr "" + +#. module: account_sequence +#: help:account.sequence.installer,prefix:0 +msgid "Prefix value of the record for the sequence" +msgstr "" + +#. module: account_sequence +#: model:ir.model,name:account_sequence.model_account_move +msgid "Account Entry" +msgstr "" + +#. module: account_sequence +#: field:account.sequence.installer,suffix:0 +msgid "Suffix" +msgstr "" + +#. module: account_sequence +#: field:account.sequence.installer,config_logo:0 +msgid "Image" +msgstr "" + +#. module: account_sequence +#: view:account.sequence.installer:0 +msgid "title" +msgstr "" + +#. module: account_sequence +#: sql_constraint:account.journal:0 +msgid "The name of the journal must be unique per company !" +msgstr "" + +#. module: account_sequence +#: field:account.sequence.installer,prefix:0 +msgid "Prefix" +msgstr "" + +#. module: account_sequence +#: sql_constraint:account.journal:0 +msgid "The code of the journal must be unique per company !" +msgstr "" + +#. module: account_sequence +#: constraint:account.move.line:0 +msgid "You can not create move line on receivable/payable account without partner" +msgstr "" + +#. module: account_sequence +#: model:ir.model,name:account_sequence.model_account_journal +msgid "Journal" msgstr "" #. module: account_sequence -#: sql_constraint:ir.model.fields:0 -msgid "Size of the field can never be less than 1 !" +#: constraint:account.move.line:0 +msgid "You can not create move line on view account." msgstr "" |
