diff --git a/addons/account_check_writing/__openerp__.py b/addons/account_check_writing/__openerp__.py index f5a2355b002..e01c17d66a7 100644 --- a/addons/account_check_writing/__openerp__.py +++ b/addons/account_check_writing/__openerp__.py @@ -30,6 +30,7 @@ Module for the Check Writing and Check Printing. 'website': 'http://www.openerp.com', 'depends' : ['account_voucher'], 'data': [ + 'wizard/account_check_batch_printing_view.xml', 'account_check_writing_report.xml', 'account_view.xml', 'account_voucher_view.xml', diff --git a/addons/account_check_writing/wizard/__init__.py b/addons/account_check_writing/wizard/__init__.py new file mode 100644 index 00000000000..d39c8716122 --- /dev/null +++ b/addons/account_check_writing/wizard/__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_check_batch_printing + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_check_writing/wizard/account_check_batch_printing.py b/addons/account_check_writing/wizard/account_check_batch_printing.py new file mode 100644 index 00000000000..76489dee901 --- /dev/null +++ b/addons/account_check_writing/wizard/account_check_batch_printing.py @@ -0,0 +1,87 @@ +# -*- 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 account_check_write(osv.osv_memory): + _name = 'account.check.write' + _description = 'Prin Check in Batch' + + _columns = { + 'check_number': fields.integer('Next Check Number', required=True, help="The number of the next check number to be printed."), + } + + def _get_next_number(self, cr, uid, context=None): + dummy, sequence_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_check_writing', 'sequence_check_number') + return self.pool.get('ir.sequence').read(cr, uid, sequence_id, ['number_next'])['number_next'] + + _defaults = { + 'check_number': _get_next_number, + } + + def print_check_write(self, cr, uid, ids, context=None): + if context is None: + context = {} + voucher_obj = self.pool.get('account.voucher') + ir_sequence_obj = self.pool.get('ir.sequence') + + #update the sequence to number the checks from the value encoded in the wizard + dummy, sequence_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_check_writing', 'sequence_check_number') + increment = ir_sequence_obj.read(cr, uid, sequence_id, ['number_increment'])['number_increment'] + new_value = self.browse(cr, uid, ids[0], context=context).check_number + ir_sequence_obj.write(cr, uid, sequence_id, {'number_next': new_value}) + + #validate the checks so that they get a number + voucher_ids = context.get('active_ids', []) + for check in voucher_obj.browse(cr, uid, voucher_ids, context=context): + new_value += increment + if check.number: + raise osv.except_osv(_('Error!'),_("One of the printed check already got a number.")) + voucher_obj.proforma_voucher(cr, uid, voucher_ids, context=context) + + #update the sequence again (because the assignation using next_val was made during the same transaction of + #the first update of sequence) + ir_sequence_obj.write(cr, uid, sequence_id, {'number_next': new_value}) + + #print the checks + check_layout_report = { + 'top' : 'account.print.check.top', + 'middle' : 'account.print.check.middle', + 'bottom' : 'account.print.check.bottom', + } + check_layout = voucher_obj.browse(cr, uid, voucher_ids[0], context=context).company_id.check_layout + if not check_layout: + check_layout = 'top' + return { + 'type': 'ir.actions.report.xml', + 'report_name':check_layout_report[check_layout], + 'datas': { + 'model':'account.voucher', + 'ids': voucher_ids, + 'report_type': 'pdf' + }, + 'nodestroy': True + } + +account_check_write() + diff --git a/addons/account_check_writing/wizard/account_check_batch_printing_view.xml b/addons/account_check_writing/wizard/account_check_batch_printing_view.xml new file mode 100644 index 00000000000..ea81c444d91 --- /dev/null +++ b/addons/account_check_writing/wizard/account_check_batch_printing_view.xml @@ -0,0 +1,28 @@ + + + + + + account.check.form + account.check.write + +
+ + + +
+
+
+
+
+ + + +
+
diff --git a/addons/account_test/__init__.py b/addons/account_test/__init__.py new file mode 100644 index 00000000000..106682f4a12 --- /dev/null +++ b/addons/account_test/__init__.py @@ -0,0 +1,2 @@ +import account_test +import report diff --git a/addons/account_test/__openerp__.py b/addons/account_test/__openerp__.py new file mode 100644 index 00000000000..cfd4007fed0 --- /dev/null +++ b/addons/account_test/__openerp__.py @@ -0,0 +1,47 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2011 CCI Connect asbl (http://www.cciconnect.be) All Rights Reserved. +# Philmer +# +# 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' : 'Accounting Consistency Tests', + 'version' : '1.0', + 'author' : 'OpenERP', + 'category' : 'Accounting & Finance', + 'website': 'http://www.openerp.com', + 'description': """ +Asserts on accounting. +====================== +With this module you can manually check consistencies and inconsistencies of accounting module from menu Reporting/Accounting/Accounting Tests. + +You can write a query in order to create Consistency Test and you will get the result of the test +in PDF format which can be accessed by Menu Reporting -> Accounting Tests, then select the test +and print the report from Print button in header area. +""", + 'depends' : ['account'], + 'data' : [ + 'security/ir.model.access.csv', + 'account_test_view.xml', + 'account_test_report.xml', + 'account_test_data.xml', + ], + 'active': False, + 'installable': True +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_test/account_test.py b/addons/account_test/account_test.py new file mode 100644 index 00000000000..bf925e8236a --- /dev/null +++ b/addons/account_test/account_test.py @@ -0,0 +1,65 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id: product_expiry.py 4304 2006-10-25 09:54:51Z ged $ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# 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 2 +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +from osv import fields,osv +import pooler +import netsvc +import time +from xml import dom + + +CODE_EXEC_DEFAULT = '''\ +res = [] +cr.execute("select id, code from account_journal") +for record in cr.dictfetchall(): + res.append(record['code']) +result = res +''' + +class accounting_assert_test(osv.osv): + _name = "accounting.assert.test" + _order = "sequence" + + _columns = { + 'name': fields.char('Test Name', size=256, required=True, select=True, translate=True), + 'desc': fields.text('Test Description', select=True, translate=True), + 'code_exec': fields.text('Python code', required=True), + 'active': fields.boolean('Active'), + 'sequence': fields.integer('Sequence'), + } + + _defaults = { + 'code_exec': CODE_EXEC_DEFAULT, + 'active': True, + 'sequence': 10, + } + +accounting_assert_test() + diff --git a/addons/account_test/account_test_data.xml b/addons/account_test/account_test_data.xml new file mode 100644 index 00000000000..4970bef6a0d --- /dev/null +++ b/addons/account_test/account_test_data.xml @@ -0,0 +1,172 @@ + + + + + + 1 + Test 1: General balance + Check the balance: Debit sum = Credit sum + + + + + 2 + Test 2: Opening a fiscal year + Check if the balance of the new opened fiscal year matches with last year's balance + + + + + 3 + Test 3: Movement lines + Check if movement lines are balanced and have the same date and period + 0 or am.period_id!=ml.period_id or (am.date!=ml.date) +""" +cr.execute(sql) +res = cr.dictfetchall() +if res: + res.insert(0,_('* The test failed for these movement lines:')) +result = res + +]]> + + + + 4 + Test 4: Totally reconciled mouvements + Check if the totally reconciled movements are balanced + 0", (record['reconcile_id'],)) + reconcile_ids=cr.dictfetchall() + if reconcile_ids: + res.append(', '.join(["Reconcile name: %(name)s, id=%(id)s " % r for r in reconcile_ids])) +result = res +if result: + result.insert(0,_('* The test failed for these reconciled items(id/name):')) +]]> + + + + 5 + Test 5.1 : Payable and Receivable accountant lines of reconciled invoices + Check that reconciled invoice for Sales/Purchases has reconciled entries for Payable and Receivable Accounts + + + + + 6 + Test 5.2 : Reconcilied invoices and Payable/Receivable accounts + Check that reconciled account moves, that define Payable and Receivable accounts, are belonging to reconciled invoices + + + + + 7 + Test 6 : Invoices status + Check that paid/reconciled invoices are not in 'Open' state + + + + + + 8 + Test 7: « View  » account type + Check that there's no move for any account with « View » account type + + + + + 9 + Test 8 : Closing balance on bank statements + Check on bank statement that the Closing Balance = Starting Balance + sum of statement lines + 0.000000001;") +result = cr.dictfetchall() +if result: + result.insert(0,_('* Unbalanced bank statement that need to be checked: ')) +]]> + + + + 10 + Test 9 : Accounts and partners on account moves + Check that general accounts and partners on account moves are active + + + + diff --git a/addons/account_test/account_test_report.xml b/addons/account_test/account_test_report.xml new file mode 100644 index 00000000000..480507b6072 --- /dev/null +++ b/addons/account_test/account_test_report.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/addons/account_test/account_test_view.xml b/addons/account_test/account_test_view.xml new file mode 100644 index 00000000000..43a67edcc6c --- /dev/null +++ b/addons/account_test/account_test_view.xml @@ -0,0 +1,85 @@ + + + + + + Tests + accounting.assert.test + + + + + + + + + + + Tests + accounting.assert.test + +
+ + + + + + + + + + + + + + + + + + + +
+Code should always set a variable named `result` with the result of your test, that can be a list or
+a dictionary. If `result` is an empty list, it means that the test was succesful. Otherwise it will
+try to translate and print what is inside `result`.
+
+If the result of your test is a dictionary, you can set a variable named `column_order` to choose in
+what order you want to print `result`'s content.
+
+Should you need them, you can also use the following variables into your code:
+    * cr: cursor to the database
+    * uid: ID of the current user
+
+In any ways, the code must be legal python statements with correct indentation (if needed).
+
+Example: 
+    sql = '''SELECT id, name, ref, date
+             FROM account_move_line 
+             WHERE account_id IN (SELECT id FROM account_account WHERE type = 'view')
+          '''
+    cr.execute(sql)
+    result = cr.dictfetchall()
+                                    
+
+
+
+
+
+
+
+ + + Accounting Tests + accounting.assert.test + tree,form + +

+ Click to create Accounting Test. +

+
+
+ + + +
+
diff --git a/addons/account_test/report/__init__.py b/addons/account_test/report/__init__.py new file mode 100644 index 00000000000..0e4fbf07082 --- /dev/null +++ b/addons/account_test/report/__init__.py @@ -0,0 +1,3 @@ +import account_test_report + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_test/report/account_test.rml b/addons/account_test/report/account_test.rml new file mode 100644 index 00000000000..1efa12fd5cb --- /dev/null +++ b/addons/account_test/report/account_test.rml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Accouting tests on [[ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") ]] + + + +
+ [[repeatIn(objects,'o')]] + + + + [[ o.name ]] + + + + + [[ o.desc or '' ]] + + + + + + + [[ repeatIn(execute_code(o.code_exec), 'test_result') ]] + [[ test_result ]] + + + + + + +
+ +
+
diff --git a/addons/account_test/report/account_test_report.py b/addons/account_test/report/account_test_report.py new file mode 100644 index 00000000000..ab683e18688 --- /dev/null +++ b/addons/account_test/report/account_test_report.py @@ -0,0 +1,87 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 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 . +# +############################################################################## + +import datetime +import time +from report import report_sxw +from tools.translate import _ +# +# Use period and Journal for selection or resources +# +class report_assert_account(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(report_assert_account, self).__init__(cr, uid, name, context=context) + self.localcontext.update( { + 'time': time, + 'datetime': datetime, + 'execute_code': self.execute_code, + }) + + def execute_code(self, code_exec): + def reconciled_inv(): + """ + returns the list of invoices that are set as reconciled = True + """ + return self.pool.get('account.invoice').search(self.cr, self.uid, [('reconciled','=',True)]) + + def order_columns(item, cols=None): + """ + This function is used to display a dictionary as a string, with its columns in the order chosen. + + :param item: dict + :param cols: list of field names + :returns: a list of tuples (fieldname: value) in a similar way that would dict.items() do except that the + returned values are following the order given by cols + :rtype: [(key, value)] + """ + if cols is None: + cols = item.keys() + return [(col, item.get(col)) for col in cols if col in item.keys()] + + localdict = { + 'cr': self.cr, + 'uid': self.uid, + 'reconciled_inv': reconciled_inv, #specific function used in different tests + 'result': None, #used to store the result of the test + 'column_order': None, #used to choose the display order of columns (in case you are returning a list of dict) + } + exec code_exec in localdict + result = localdict['result'] + column_order = localdict.get('column_order', None) + + if not isinstance(result, (tuple, list, set)): + result = [result] + if not result: + result = [_('The test was passed successfully')] + else: + def _format(item): + if isinstance(item, dict): + return ', '.join(["%s: %s" % (tup[0], tup[1]) for tup in order_columns(item, column_order)]) + else: + return item + result = [_(_format(rec)) for rec in result] + + return result + +report_sxw.report_sxw('report.account.test.assert.print', 'accounting.assert.test', 'addons/account_test/report/account_test.rml', parser=report_assert_account, header=False) + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_test/security/ir.model.access.csv b/addons/account_test/security/ir.model.access.csv new file mode 100644 index 00000000000..cf7e93b6baa --- /dev/null +++ b/addons/account_test/security/ir.model.access.csv @@ -0,0 +1,3 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_accounting_assert_test","accounting.assert.test","model_accounting_assert_test",base.group_system,1,0,0,1 +"access_accounting_assert_test_manager","accounting.assert.test","model_accounting_assert_test",account.group_account_manager,1,0,0,0 diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index d2429e8dfd2..baf1a8f0b28 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -57,18 +57,17 @@ class Controller(openerp.addons.web.http.Controller): def signup(self, req, dbname, token, name, login, password): """ sign up a user (new or existing)""" values = {'name': name, 'login': login, 'password': password} - return self._signup_with_values(req, dbname, token, values) + try: + self._signup_with_values(req, dbname, token, values) + except SignupError, e: + return {'error': openerp.tools.exception_to_unicode(e)} + return {} def _signup_with_values(self, req, dbname, token, values): registry = RegistryManager.get(dbname) with registry.cursor() as cr: res_users = registry.get('res.users') - try: - res_users.signup(cr, openerp.SUPERUSER_ID, values, token) - except SignupError, e: - return {'error': openerp.tools.exception_to_unicode(e)} - cr.commit() - return {} + res_users.signup(cr, openerp.SUPERUSER_ID, values, token) @openerp.addons.web.http.httprequest def reset_password(self, req, dbname, login): diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml index 66c7e5a7f5c..6202701714c 100644 --- a/addons/fetchmail/fetchmail_view.xml +++ b/addons/fetchmail/fetchmail_view.xml @@ -117,7 +117,7 @@ + res_model="mail.mail" src_model="fetchmail.server"/> diff --git a/addons/fleet/__openerp__.py b/addons/fleet/__openerp__.py index 3a40e7dfc0a..f1e0d1a8580 100644 --- a/addons/fleet/__openerp__.py +++ b/addons/fleet/__openerp__.py @@ -52,7 +52,7 @@ Main Features 'fleet_data.xml', 'fleet_board_view.xml', ], - 'update_xml' : ['security/ir.model.access.csv'], + 'update_xml' : ['security/fleet_security.xml','security/ir.model.access.csv'], 'demo': ['fleet_cars.xml','fleet_demo.xml'], diff --git a/addons/fleet/fleet.py b/addons/fleet/fleet.py index e74ac4839f4..db999d41d12 100644 --- a/addons/fleet/fleet.py +++ b/addons/fleet/fleet.py @@ -66,8 +66,8 @@ class fleet_vehicle_cost(osv.Model): res = {} for record in self.browse(cr, uid, ids, context=context): name = record.vehicle_id.name - if record.cost_subtype.name: - name += ' / '+ record.cost_subtype.name + if record.cost_subtype_id.name: + name += ' / '+ record.cost_subtype_id.name if record.date: name += ' / '+ record.date res[record.id] = name @@ -76,7 +76,7 @@ class fleet_vehicle_cost(osv.Model): _columns = { 'name': fields.function(_cost_name_get_fnc, type="char", string='Name', store=True), 'vehicle_id': fields.many2one('fleet.vehicle', 'Vehicle', required=True, help='Vehicle concerned by this log'), - 'cost_subtype': fields.many2one('fleet.service.type', 'Type', help='Cost type purchased with this cost'), + 'cost_subtype_id': fields.many2one('fleet.service.type', 'Type', help='Cost type purchased with this cost'), 'amount': fields.float('Total Price'), 'cost_type': fields.selection([('contract', 'Contract'), ('services','Services'), ('fuel','Fuel'), ('other','Other')], 'Category of the cost', help='For internal purpose only', required=True), 'parent_id': fields.many2one('fleet.vehicle.cost', 'Parent', help='Parent cost to this current cost'), @@ -104,7 +104,7 @@ class fleet_vehicle_cost(osv.Model): if 'contract_id' in data and data['contract_id']: contract = self.pool.get('fleet.vehicle.log.contract').browse(cr, uid, data['contract_id'], context=context) data['vehicle_id'] = contract.vehicle_id.id - data['cost_subtype'] = contract.cost_subtype.id + data['cost_subtype_id'] = contract.cost_subtype_id.id data['cost_type'] = contract.cost_type if 'odometer' in data and not data['odometer']: #if received value for odometer is 0, then remove it from the data as it would result to the creation of a @@ -135,8 +135,8 @@ class fleet_vehicle_model(osv.Model): res = {} for record in self.browse(cr, uid, ids, context=context): name = record.modelname - if record.brand.name: - name = record.brand.name + ' / ' + name + if record.brand_id.name: + name = record.brand_id.name + ' / ' + name res[record.id] = name return res @@ -157,11 +157,11 @@ class fleet_vehicle_model(osv.Model): _columns = { 'name': fields.function(_model_name_get_fnc, type="char", string='Name', store=True), 'modelname': fields.char('Model name', size=32, required=True), - 'brand': fields.many2one('fleet.vehicle.model.brand', 'Model Brand', required=True, help='Brand of the vehicle'), + 'brand_id': fields.many2one('fleet.vehicle.model.brand', 'Model Brand', required=True, help='Brand of the vehicle'), 'vendors': fields.many2many('res.partner', 'fleet_vehicle_model_vendors', 'model_id', 'partner_id', string='Vendors'), - 'image': fields.related('brand', 'image', type="binary", string="Logo"), - 'image_medium': fields.related('brand', 'image_medium', type="binary", string="Logo"), - 'image_small': fields.related('brand', 'image_small', type="binary", string="Logo"), + 'image': fields.related('brand_id', 'image', type="binary", string="Logo"), + 'image_medium': fields.related('brand_id', 'image_medium', type="binary", string="Logo"), + 'image_small': fields.related('brand_id', 'image_small', type="binary", string="Logo"), } @@ -210,7 +210,7 @@ class fleet_vehicle(osv.Model): def _vehicle_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): res = {} for record in self.browse(cr, uid, ids, context=context): - res[record.id] = record.model_id.brand.name + '/' + record.model_id.modelname + ' / ' + record.license_plate + res[record.id] = record.model_id.brand_id.name + '/' + record.model_id.modelname + ' / ' + record.license_plate return res def return_action_to_open(self, cr, uid, ids, context=None): @@ -308,7 +308,7 @@ class fleet_vehicle(osv.Model): ids = self.pool.get('fleet.vehicle.log.contract').search(cr,uid,[('vehicle_id', '=', record.id), ('state', 'in', ('open', 'toclose'))], limit=1, order='expiration_date asc') if len(ids) > 0: #we display only the name of the oldest overdue/due soon contract - name=(self.pool.get('fleet.vehicle.log.contract').browse(cr, uid, ids[0], context=context).cost_subtype.name) + name=(self.pool.get('fleet.vehicle.log.contract').browse(cr, uid, ids[0], context=context).cost_subtype_id.name) res[record.id] = { 'contract_renewal_overdue': overdue, @@ -333,14 +333,14 @@ class fleet_vehicle(osv.Model): 'company_id': fields.many2one('res.company', 'Company'), 'license_plate': fields.char('License Plate', size=32, required=True, help='License plate number of the vehicle (ie: plate number for a car)'), 'vin_sn': fields.char('Chassis Number', size=32, help='Unique number written on the vehicle motor (VIN/SN number)'), - 'driver': fields.many2one('res.partner', 'Driver', help='Driver of the vehicle'), - 'model_id': fields.many2one('fleet.vehicle.model', 'Model', required=True, help='Model of the vehicle'), - 'log_fuel': fields.one2many('fleet.vehicle.log.fuel', 'vehicle_id', 'Fuel Logs'), + 'driver_id': fields.many2one('res.partner', 'Driver', _idhelp='Driver of the vehicle'), + 'model_id': fields.many2one('fleet.vehicle.model', 'Model', requ_idired=True, help='Model of the vehicle'), + 'log_fuel': fields.one2many('fleet.vehicle.log.f_iduel', 'vehicle_id', 'Fuel Logs'), 'log_services': fields.one2many('fleet.vehicle.log.services', 'vehicle_id', 'Services Logs'), 'log_contracts': fields.one2many('fleet.vehicle.log.contract', 'vehicle_id', 'Contracts'), 'acquisition_date': fields.date('Acquisition Date', required=False, help='Date when the vehicle has been bought'), 'color': fields.char('Color', size=32, help='Color of the vehicle'), - 'state': fields.many2one('fleet.vehicle.state', 'State', help='Current state of the vehicle', ondelete="set null"), + 'state_id': fields.many2one('fleet.vehicle.state', 'State', help='Current state of the vehicle', ondelete="set null"), 'location': fields.char('Location', size=128, help='Location of the vehicle (garage, ...)'), 'seats': fields.integer('Seats Number', help='Number of seats of the vehicle'), 'doors': fields.integer('Doors Number', help='Number of doors of the vehicle'), @@ -366,7 +366,7 @@ class fleet_vehicle(osv.Model): _defaults = { 'doors': 5, 'odometer_unit': 'kilometers', - 'state': _get_default_state, + 'state_id': _get_default_state, } def copy(self, cr, uid, id, default=None, context=None): @@ -408,13 +408,13 @@ class fleet_vehicle(osv.Model): value = self.pool.get('fleet.vehicle.model').browse(cr,uid,vals['model_id'],context=context).name oldmodel = vehicle.model_id.name or _('None') changes.append(_("Model: from '%s' to '%s'") %(oldmodel, value)) - if 'driver' in vals and vehicle.driver.id != vals['driver']: - value = self.pool.get('res.partner').browse(cr,uid,vals['driver'],context=context).name - olddriver = (vehicle.driver.name) or _('None') + if 'driver_id' in vals and vehicle.driver_id.id != vals['driver_id']: + value = self.pool.get('res.partner').browse(cr,uid,vals['driver_id'],context=context).name + olddriver = (vehicle.driver_id.name) or _('None') changes.append(_("Driver: from '%s' to '%s'") %(olddriver, value)) - if 'state' in vals and vehicle.state.id != vals['state']: - value = self.pool.get('fleet.vehicle.state').browse(cr,uid,vals['state'],context=context).name - oldstate = vehicle.state.name or _('None') + if 'state_id' in vals and vehicle.state_id.id != vals['state_id']: + value = self.pool.get('fleet.vehicle.state').browse(cr,uid,vals['state_id'],context=context).name + oldstate = vehicle.state_id.name or _('None') changes.append(_("State: from '%s' to '%s'") %(oldstate, value)) if 'license_plate' in vals and vehicle.license_plate != vals['license_plate']: old_license_plate = vehicle.license_plate or _('None') @@ -548,7 +548,7 @@ class fleet_vehicle_log_fuel(osv.Model): _defaults = { 'purchaser_id': lambda self, cr, uid, ctx: uid, 'date': fields.date.context_today, - 'cost_subtype': _get_default_service_type, + 'cost_subtype_id': _get_default_service_type, 'cost_type': 'fuel', } @@ -585,7 +585,7 @@ class fleet_vehicle_log_services(osv.Model): _defaults = { 'purchaser_id': lambda self, cr, uid, ctx: uid, 'date': fields.date.context_today, - 'cost_subtype': _get_default_service_type, + 'cost_subtype_id': _get_default_service_type, 'cost_type': 'services' } @@ -630,7 +630,7 @@ class fleet_vehicle_log_contract(osv.Model): 'amount': contract.cost_generated, 'date': startdate.strftime(tools.DEFAULT_SERVER_DATE_FORMAT), 'vehicle_id': contract.vehicle_id.id, - 'cost_subtype': contract.cost_subtype.id, + 'cost_subtype_id': contract.cost_subtype_id.id, 'contract_id': contract.id, 'auto_generated': True } @@ -664,8 +664,8 @@ class fleet_vehicle_log_contract(osv.Model): res = {} for record in self.browse(cr, uid, ids, context=context): name = record.vehicle_id.name - if record.cost_subtype.name: - name += ' / '+ record.cost_subtype.name + if record.cost_subtype_id.name: + name += ' / '+ record.cost_subtype_id.name if record.date: name += ' / '+ record.date res[record.id] = name @@ -789,7 +789,7 @@ class fleet_vehicle_log_contract(osv.Model): 'state':'open', 'expiration_date': lambda self, cr, uid, ctx: self.compute_next_year_date(fields.date.context_today(self, cr, uid, context=ctx)), 'cost_frequency': 'no', - 'cost_subtype': _get_default_contract_type, + 'cost_subtype_id': _get_default_contract_type, 'cost_type': 'contract', } diff --git a/addons/fleet/fleet_board_view.xml b/addons/fleet/fleet_board_view.xml index 760fc1cf583..41093d2c283 100644 --- a/addons/fleet/fleet_board_view.xml +++ b/addons/fleet/fleet_board_view.xml @@ -135,17 +135,20 @@ + sequence="50" + groups="group_fleet_user"/> - + + sequence="1" + groups="group_fleet_manager"/> + sequence="2" + groups="group_fleet_manager"/> diff --git a/addons/fleet/fleet_demo.xml b/addons/fleet/fleet_demo.xml index 4760e336dd1..d70943f4beb 100644 --- a/addons/fleet/fleet_demo.xml +++ b/addons/fleet/fleet_demo.xml @@ -3,227 +3,227 @@ Corsa - + Astra - + Agila - + Combo Tour - + Meriva - + AstraGTC - + Zafira - + Zafira Tourer - + Insignia - + Mokka - + Antara - + Ampera - + A1 - + A3 - + A4 - + A5 - + A6 - + A7 - + A8 - + Q3 - + Q5 - + Q7 - + TT - + Serie 1 - + Serie 3 - + Serie 5 - + Serie 6 - + Serie 7 - + Serie X - + Serie Z4 - + Serie M - + Serie Hybrid - + Class A - + Class B - + Class C - + Class CL - + Class CLS - + Class E - + Class M - + Class GL - + Class GLK - + Class R - + Class S - + Class SLK - + SLS - + @@ -253,7 +253,7 @@ Black Grand-Rosiere 5 - + kilometers @@ -268,7 +268,7 @@ Red Grand-Rosiere 5 - + kilometers @@ -283,7 +283,7 @@ Titanium Grey Grand-Rosiere 3 - + kilometers @@ -298,7 +298,7 @@ White Grand-Rosiere 3 - + kilometers @@ -313,7 +313,7 @@ Brown Grand-Rosiere 5 - + kilometers @@ -862,7 +862,7 @@ 650 - + 2012-09-02 4586 @@ -873,7 +873,7 @@ 50 - + 2012-09-02 @@ -881,7 +881,7 @@ 25 - + 2012-09-02 @@ -889,7 +889,7 @@ 100 - + 2012-09-02 @@ -897,7 +897,7 @@ 350 - + 2012-11-02 4814 @@ -908,7 +908,7 @@ 100 - + 2012-11-02 @@ -916,7 +916,7 @@ 150 - + 2012-11-02 @@ -924,7 +924,7 @@ 100 - + 2012-11-02 @@ -932,7 +932,7 @@ 513 - + 2012-10-15 124 @@ -943,7 +943,7 @@ 412 - + 2012-10-08 20984 @@ -954,7 +954,7 @@ 275 - + 2012-09-25 241 @@ -965,7 +965,7 @@ 302 - + 2012-09-15 22513 @@ -978,7 +978,7 @@ 0 20 daily - + @@ -990,7 +990,7 @@ 50 - + 2012-01-01 @@ -998,7 +998,7 @@ 25 - + 2012-01-01 @@ -1006,7 +1006,7 @@ 100 - + 2012-01-01 @@ -1016,7 +1016,7 @@ 0 150 weekly - + @@ -1028,7 +1028,7 @@ 50 - + 2012-01-01 @@ -1036,7 +1036,7 @@ 25 - + 2012-01-01 @@ -1044,7 +1044,7 @@ 100 - + 2012-01-01 @@ -1054,7 +1054,7 @@ 0 400 monthly - + @@ -1066,7 +1066,7 @@ 50 - + 2012-01-01 @@ -1074,7 +1074,7 @@ 25 - + 2012-01-01 @@ -1082,7 +1082,7 @@ 100 - + 2012-01-01 @@ -1092,7 +1092,7 @@ 0 4000 yearly - + @@ -1104,7 +1104,7 @@ 50 - + 2012-01-01 @@ -1112,7 +1112,7 @@ 25 - + 2012-01-01 @@ -1120,7 +1120,7 @@ 100 - + 2012-01-01 @@ -1130,7 +1130,7 @@ 17000 0 no - + @@ -1142,7 +1142,7 @@ 50 - + 2012-01-01 @@ -1150,7 +1150,7 @@ 25 - + 2012-01-01 @@ -1158,7 +1158,7 @@ 100 - + 2012-01-01 diff --git a/addons/fleet/fleet_view.xml b/addons/fleet/fleet_view.xml index 416ca191a6e..1810cc5a938 100644 --- a/addons/fleet/fleet_view.xml +++ b/addons/fleet/fleet_view.xml @@ -10,7 +10,7 @@ - + @@ -30,7 +30,7 @@ fleet.vehicle.model - + @@ -135,7 +135,7 @@ - States of Vehicle + Vehicle Status fleet.vehicle.state form tree,form @@ -149,11 +149,11 @@ - - + + - + fleet.vehicle.form @@ -161,7 +161,7 @@
- +
@@ -179,14 +179,14 @@
- + @@ -231,10 +231,10 @@ - + - + @@ -250,11 +250,10 @@ - + - - + @@ -268,9 +267,9 @@ - + - + @@ -310,7 +309,7 @@
  • - +
  • @@ -347,8 +346,8 @@ - - + + @@ -358,17 +357,17 @@
    -
    - +