diff --git a/addons/account/__init__.py b/addons/account/__init__.py index 24129306e13..52c65f0c3da 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -25,6 +25,7 @@ import project import partner import invoice import account_bank_statement +import account_bank import account_cash_statement import account_move_line import account_analytic_line diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 23846183ddf..1b378e15e93 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -122,7 +122,8 @@ module named account_voucher. 'company_view.xml', 'board_account_view.xml', "wizard/account_report_profit_loss_view.xml", - "wizard/account_report_balance_sheet_view.xml" + "wizard/account_report_balance_sheet_view.xml", + "account_bank_view.xml" ], 'demo_xml': [ 'demo/account_demo.xml', diff --git a/addons/account/account.py b/addons/account/account.py index 72208314ed9..0cee9291e97 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -602,7 +602,7 @@ class account_journal(osv.osv): _description = "Journal" _columns = { 'name': fields.char('Journal Name', size=64, required=True), - 'code': fields.char('Code', size=5, required=True, help="The code will be used to generate the numbers of the journal entries of this journal."), + 'code': fields.char('Code', size=5, required=True, help="The code will be displayed on reports."), 'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'), ('situation', 'Opening/Closing Situation')], 'Type', size=32, required=True, help="Select 'Sale' for Sale journal to be used at the time of making invoice."\ " Select 'Purchase' for Purchase Journal to be used at the time of approving purchase order."\ @@ -2675,9 +2675,10 @@ class wizard_multi_charts_accounts(osv.osv_memory): return False def _get_default_accounts(self, cr, uid, context=None): - return [{'acc_name': _('Current'),'account_type':'bank'}, - {'acc_name': _('Deposit'),'account_type':'bank'}, - {'acc_name': _('Cash'),'account_type':'cash'}] + return [ + {'acc_name': _('Bank Account'),'account_type':'bank'}, + {'acc_name': _('Cash'),'account_type':'cash'} + ] _defaults = { 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, [uid], c)[0].company_id.id, diff --git a/addons/account/account_bank.py b/addons/account/account_bank.py new file mode 100644 index 00000000000..a3d66ccdf7c --- /dev/null +++ b/addons/account/account_bank.py @@ -0,0 +1,103 @@ +# -*- 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 . +# +############################################################################## + +from tools.translate import _ +from osv import fields, osv + +class bank(osv.osv): + _inherit = "res.partner.bank" + _columns = { + 'journal_id': fields.many2one('account.journal', 'Account Journal', help="This journal will be created automatically for this bank account when you save the record"), + } + def create(self, cr, uid, data, context={}): + result = super(bank, self).create(cr, uid, data, context=context) + self.post_write(cr, uid, [result], context=context) + return result + + def write(self, cr, uid, ids, data, context={}): + result = super(bank, self).write(cr, uid, ids, data, context=context) + self.post_write(cr, uid, ids, context=context) + return result + + def post_write(self, cr, uid, ids, context={}): + obj_acc = self.pool.get('account.account') + obj_data = self.pool.get('ir.model.data') + for bank in self.browse(cr, uid, ids, context): + if bank.company_id and not bank.journal_id: + # Find the code and parent of the bank account to create + dig = 6 + current_num = 1 + ids = obj_acc.search(cr, uid, [('type','=','liquidity')], context=context) + # No liquidity account exists, no template available + if not ids: continue + + ref_acc_bank_temp = obj_acc.browse(cr, uid, ids[0], context=context) + ref_acc_bank = ref_acc_bank_temp.parent_id + while True: + new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)), '0')) + str(current_num) + ids = obj_acc.search(cr, uid, [('code', '=', new_code), ('company_id', '=', bank.company_id.id)]) + if not ids: + break + current_num += 1 + + acc = { + 'name': (bank.bank_name or '')+' '+bank.acc_number, + 'currency_id': bank.company_id.currency_id.id, + 'code': new_code, + 'type': 'liquidity', + 'user_type': ref_acc_bank_temp.user_type.id, + 'reconcile': False, + 'parent_id': ref_acc_bank.id, + 'company_id': bank.company_id.id, + } + acc_bank_id = obj_acc.create(cr,uid,acc,context=context) + + # Get the journal view id + data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')]) + data = obj_data.browse(cr, uid, data_id[0], context=context) + view_id_cash = data.res_id + + jour_obj = self.pool.get('account.journal') + new_code = 1 + while True: + code = _('BNK')+str(new_code) + ids = jour_obj.search(cr, uid, [('code','=',code)], context=context) + if not ids: + break + new_code += 1 + + #create the bank journal + vals_journal = { + 'name': (bank.bank_name or '')+' '+bank.acc_number, + 'code': code, + 'type': 'bank', + 'company_id': bank.company_id.id, + 'analytic_journal_id': False, + 'currency_id': False, + 'default_credit_account_id': acc_bank_id, + 'default_debit_account_id': acc_bank_id, + 'view_id': view_id_cash + } + journal_id = jour_obj.create(cr, uid, vals_journal, context=context) + + self.write(cr, uid, [bank.id], {'journal_id': journal_id}, context=context) + return True + diff --git a/addons/account/account_bank_view.xml b/addons/account/account_bank_view.xml new file mode 100644 index 00000000000..d91739817ac --- /dev/null +++ b/addons/account/account_bank_view.xml @@ -0,0 +1,48 @@ + + + + + + + + Partner Bank Accounts - Journal + res.partner.bank + form + + + + + + + + + + + + + + Bank Accounts + res.partner.bank + form + tree,form + + Configure your company's bank account and select those that must appear on the report footer. You can drag & drop bank in the list view to reorder bank accounts. If you use the accounting application of OpenERP, journals and accounts will be created automatically based on these data. + + + + + + + + 4 + + + + + diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 19def9fff12..5de205e1690 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -767,7 +767,7 @@ An account type is used to determine how an account is used in each journal. The deferral method of an account type determines the process for the annual closing. Reports such as the Balance Sheet and the Profit and Loss report use the category (profit/loss or balance sheet). For example, the account type could be linked to an asset account, expense account or payable account. From this view, you can create and manage the account types you need for your company. - + diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index cfb98ffb1ae..fbee97875ae 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -97,27 +97,30 @@
- + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + + diff --git a/addons/account/project/analytic_account_demo.xml b/addons/account/project/analytic_account_demo.xml index 6df74d0a0ba..7cf5a59efc1 100644 --- a/addons/account/project/analytic_account_demo.xml +++ b/addons/account/project/analytic_account_demo.xml @@ -2,7 +2,7 @@ - + 0 diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index 37b5b841e23..9f37558d759 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -83,14 +83,14 @@ class res_partner_bank(osv.osv): def create(self, cr, uid, vals, context=None): #overwrite to format the iban number correctly - if 'iban' in vals and vals['iban']: - vals['iban'] = _format_iban(vals['iban']) + if (vals.get('state',False)=='iban') and vals.get('acc_number', False): + vals['acc_number'] = _format_iban(vals['acc_number']) return super(res_partner_bank, self).create(cr, uid, vals, context) def write(self, cr, uid, ids, vals, context=None): #overwrite to format the iban number correctly - if 'iban' in vals and vals['iban']: - vals['iban'] = _format_iban(vals['iban']) + if (vals.get('state',False)=='iban') and vals.get('acc_number', False): + vals['acc_number'] = _format_iban(vals['acc_number']) return super(res_partner_bank, self).write(cr, uid, ids, vals, context) def check_iban(self, cr, uid, ids, context=None): @@ -98,9 +98,9 @@ class res_partner_bank(osv.osv): Check the IBAN number ''' for bank_acc in self.browse(cr, uid, ids, context=context): - if not bank_acc.iban: + if bank_acc.state<>'iban': continue - iban = _format_iban(bank_acc.iban).lower() + iban = _format_iban(bank_acc.acc_number).lower() if iban[:2] in _iban_len and len(iban) != _iban_len[iban[:2]]: return False #the four first digits have to be shifted to the end @@ -122,39 +122,11 @@ class res_partner_bank(osv.osv): def default_iban_check(iban_cn): return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase - iban_country = self.browse(cr, uid, ids)[0].iban[:2] + iban_country = self.browse(cr, uid, ids)[0].acc_number[:2].lower() if default_iban_check(iban_country): iban_example = iban_country in _ref_iban and _ref_iban[iban_country] + ' \nWhere A = Account number, B = National bank code, S = Branch code, C = account No, N = branch No, K = National check digits....' or '' return _('The IBAN does not seem to be correct. You should have entered something like this %s'), (iban_example) - return _('The IBAN is invalid, It should begin with the country code'), () - - def name_get(self, cr, uid, ids, context=None): - res = [] - to_check_ids = [] - for val in self.browse(cr, uid, ids, context=context): - if val.state=='iban': - iban = _pretty_iban(val.iban or '') - bic = val.bank.bic or '' - res.append((val.id, _('IBAN: %s / BIC: %s') % (iban, bic))) - else: - to_check_ids.append(val.id) - res += super(res_partner_bank, self).name_get(cr, uid, to_check_ids, context=context) - return res - - def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): - #overwrite the search method in order to search not only on bank type == basic account number but also on type == iban - res = super(res_partner_bank,self).search(cr, uid, args, offset, limit, order, context=context, count=count) - if filter(lambda x:x[0]=='acc_number' ,args): - #get the value of the search - iban_value = filter(lambda x:x[0]=='acc_number' ,args)[0][2] - #get the other arguments of the search - args1 = filter(lambda x:x[0]!='acc_number' ,args) - #add the new criterion - args1 += [('iban','ilike',iban_value)] - #append the results to the older search - res += super(res_partner_bank,self).search(cr, uid, args1, offset, limit, - order, context=context, count=count) - return res + return _('The IBAN is invalid, it should begin with the country code'), () def get_bban_from_iban(self, cr, uid, ids, context=None): ''' @@ -169,21 +141,23 @@ class res_partner_bank(osv.osv): 'gb': lambda x: x[14:], } for record in self.browse(cr, uid, ids, context=context): - if not record.iban: + if not record.acc_number: res[record.id] = False continue res[record.id] = False for code, function in mapping_list.items(): - if record.iban.lower().startswith(code): - res[record.id] = function(record.iban) + if record.acc_number.lower().startswith(code): + res[record.id] = function(record.acc_number) break return res _columns = { - 'iban': fields.char('IBAN', size=34, readonly=True, help="International Bank Account Number"), + # Deprecated: we keep it for backward compatibility, to be removed in v7 + # We use acc_number instead of IBAN since v6.1, but we keep this field + # to not break community modules. + 'iban': fields.related('acc_number', string='IBAN', size=34, readonly=True, help="International Bank Account Number", type="char"), } - - _constraints = [(check_iban, _construct_constraint_msg, ["iban"])] + _constraints = [(check_iban, _construct_constraint_msg, ["acc_number"])] res_partner_bank() diff --git a/addons/base_iban/base_iban_data.xml b/addons/base_iban/base_iban_data.xml index dae3999505e..ac481098254 100644 --- a/addons/base_iban/base_iban_data.xml +++ b/addons/base_iban/base_iban_data.xml @@ -8,15 +8,10 @@ IBAN Account iban - - - iban - - - + %(bank_name)s: IBAN %(acc_number)s - BIC %(bank_bic)s - bic + bank_bic @@ -33,11 +28,5 @@ - - acc_number - - - - diff --git a/addons/base_iban/base_iban_view.xml b/addons/base_iban/base_iban_view.xml index e1e73f28f3b..30816750035 100644 --- a/addons/base_iban/base_iban_view.xml +++ b/addons/base_iban/base_iban_view.xml @@ -2,57 +2,5 @@ - - res.partner.bank.form.iban.inherit - res.partner.bank - - form - - - - - - - - - - - res.partner.bank.tree.iban.inherit - res.partner.bank - - tree - - - - - - - - - - res.partner.form.iban.inherit - res.partner - - form - - - - - - - - - - res.partner.form.iban.inherit.list - res.partner - - form - - - - - - - diff --git a/addons/crm/security/crm_security.xml b/addons/crm/security/crm_security.xml index 45b7ccb017e..8ac32086cfd 100644 --- a/addons/crm/security/crm_security.xml +++ b/addons/crm/security/crm_security.xml @@ -16,6 +16,10 @@ + + + + Personal Leads diff --git a/addons/hr/security/hr_security.xml b/addons/hr/security/hr_security.xml index aadadd224e9..1ec0e42c47e 100644 --- a/addons/hr/security/hr_security.xml +++ b/addons/hr/security/hr_security.xml @@ -3,10 +3,10 @@ - Human Resources / Officer + Human Resources / HR Officer - Human Resources / Manager + Human Resources / HR Manager diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index caacb2e3247..3a538590d10 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -121,7 +121,7 @@ class mrp_repair(osv.osv): 'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number', select=True, domain="[('product_id','=',product_id)]"), 'state': fields.selection([ ('draft','Quotation'), - ('confirmed','Confirmed'), + ('confirmed','Confirmed, to repair'), ('ready','Ready to Repair'), ('under_repair','Under Repair'), ('2binvoiced','To be Invoiced'), diff --git a/addons/project/project.py b/addons/project/project.py index b1461da424c..622b5ffc2c2 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -26,10 +26,10 @@ from datetime import datetime, date from tools.translate import _ from osv import fields, osv -class project_project(osv.osv): - _name = 'project.project' - -project_project() +# I think we can remove this in v6.1 since VMT's improvements in the framework ? +#class project_project(osv.osv): +# _name = 'project.project' +#project_project() class project_task_type(osv.osv): _name = 'project.task.type' @@ -39,13 +39,12 @@ class project_task_type(osv.osv): 'name': fields.char('Stage Name', required=True, size=64, translate=True), 'description': fields.text('Description'), 'sequence': fields.integer('Sequence'), + 'project_default': fields.boolean('Common to All Projects', help="If you check this field, this stage will be proposed by default on each new project. It will not assign this stage to existing projects."), 'project_ids': fields.many2many('project.project', 'project_task_type_rel', 'type_id', 'project_id', 'Projects'), } - _defaults = { 'sequence': 1 } - project_task_type() class project(osv.osv): @@ -150,11 +149,16 @@ class project(osv.osv): 'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), } + def _get_type_common(self, cr, uid, context): + ids = self.pool.get('project.task.type').search(cr, uid, [('project_default','=',1)], context=context) + return ids + _order = "sequence" _defaults = { 'active': True, 'priority': 1, 'sequence': 10, + 'type_ids': _get_type_common } # TODO: Why not using a SQL contraints ? diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index a2df2e2e76c..d78f208526a 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -15,10 +15,9 @@ project.task - + Resource: project.project + --> Projects @@ -26,5 +25,29 @@ + + + + 1 + Design + + + + 2 + Development + + + + 3 + Testing + + + + 4 + Deployment + + + + diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index a2a5bb8c17c..999d16c07cc 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -221,26 +221,8 @@ - - - - 1 - Specification - - - 2 - Development - - - 3 - Testing - - - 4 - Merge - - +