From 5ea8f5c3573a0748a3a91c6ed1998ccc435474a6 Mon Sep 17 00:00:00 2001 From: vitridex <> Date: Tue, 14 Sep 2010 19:56:55 +0530 Subject: [PATCH 01/11] [FIX] Account_anglo_saxon : View ref corrected lp bug: https://launchpad.net/bugs/635073 fixed bzr revid: jvo@tinyerp.com-20100914142655-eunt0m575c7roi36 --- addons/account_anglo_saxon/product_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_anglo_saxon/product_view.xml b/addons/account_anglo_saxon/product_view.xml index 71288ad5c3b..63c21407b69 100644 --- a/addons/account_anglo_saxon/product_view.xml +++ b/addons/account_anglo_saxon/product_view.xml @@ -7,7 +7,7 @@ form - + From 2ab0837d24fba2c206b25f7b2970fbdb6c764e2a Mon Sep 17 00:00:00 2001 From: "Jay (OpenERP)" Date: Tue, 14 Sep 2010 20:28:33 +0530 Subject: [PATCH 02/11] [REF] Audittrail : minor correction of logging messages bzr revid: jvo@tinyerp.com-20100914145833-1a3qyeu77a40588o --- addons/audittrail/audittrail.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index e08fc0ffd69..4278e0a9179 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -208,7 +208,7 @@ class audittrail_objects_proxy(osv_pool): else: field_ids = field_pool.search(cr, uid, [('name', '=', field_name), ('model_id', '=', model.id)]) field_id = field_ids and field_ids[0] or False - assert field_id, _("'%s' field is not exits in '%s' model" %(field_name, model.model)) + assert field_id, _("'%s' field does not exist in '%s' model" %(field_name, model.model)) field = field_pool.read(cr, uid, field_id) relation_model = field['relation'] @@ -254,7 +254,7 @@ class audittrail_objects_proxy(osv_pool): else: field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', '=', model.id)]) field_id = field_ids and field_ids[0] or False - assert field_id, _("'%s' field is not exits in '%s' model" %(line['name'], model.model)) + assert field_id, _("'%s' field does not exist in '%s' model" %(line['name'], model.model)) field = field_pool.read(cr, uid, field_id) old_value = 'old_value' in line and line['old_value'] or '' @@ -303,7 +303,7 @@ class audittrail_objects_proxy(osv_pool): model_ids = model_pool.search(cr, uid, [('model', '=', model)]) model_id = model_ids and model_ids[0] or False - assert model_id, _("'%s' Model is not exits..." %(model)) + assert model_id, _("'%s' Model does not exist..." %(model)) model = model_pool.browse(cr, uid, model_id) if method in ('create'): From 15836238a4cc4785604af949adac330384e20fe8 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Tue, 14 Sep 2010 17:31:34 +0200 Subject: [PATCH 03/11] [IMP] account: bank statement usabilty change bzr revid: qdp-launchpad@tinyerp.com-20100914153134-goyvxyleub4fjvbu --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 2185599b741..db6772dc2c0 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -531,8 +531,8 @@ + - From 3d9c59ff01218d7e1917c4b9fb37accdbfbf5862 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Tue, 14 Sep 2010 19:53:07 +0200 Subject: [PATCH 04/11] [IMP] account: automatic sequence on bank statement lines [FIX] account: multi company on bank/cash statement bzr revid: qdp-launchpad@tinyerp.com-20100914175307-2g876zrv7vtdnrvl --- addons/account/account_bank_statement.py | 21 +++++++++++++++++++-- addons/account/account_cash_statement.py | 15 +++++---------- addons/account/account_view.xml | 4 ++-- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 315a09d3b56..9d6db6bdaca 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -29,6 +29,24 @@ import decimal_precision as dp class account_bank_statement(osv.osv): + def create(self, cr, uid, vals, context=None): + seq = 0 + for line in vals['line_ids']: + seq += 1 + line[2]['sequence'] = seq + vals[seq - 1] = line + return super(account_bank_statement, self).create(cr, uid, vals, context=context) + + def write(self, cr, uid, ids, vals, context=None): + res = super(account_bank_statement, self).write(cr, uid, ids, vals, context=context) + for statement in self.browse(cr, uid, ids, context): + seq = 0 + for line in statement.line_ids: + seq += 1 + if not line.sequence: + self.pool.get('account.bank.statement.line').write(cr, uid, [line.id], {'sequence': seq}, context=context) + return res + def button_import_invoice(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') if context is None: @@ -141,7 +159,7 @@ class account_bank_statement(osv.osv): 'balance_end_real': fields.float('Ending Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]}), 'balance_end': fields.function(_end_balance, method=True, string='Balance'), - 'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True), + 'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), 'line_ids': fields.one2many('account.bank.statement.line', 'statement_id', 'Statement lines', states={'confirm':[('readonly', True)]}), @@ -717,7 +735,6 @@ class account_bank_statement_line(osv.osv): 'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'), 'date': lambda *a: time.strftime('%Y-%m-%d'), 'type': lambda *a: 'general', - 'sequence': lambda *a: 10, } account_bank_statement_line() diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 01d292ce23e..daf2f9ba8f2 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -204,7 +204,6 @@ class account_cash_statement(osv.osv): return res _columns = { - 'company_id':fields.many2one('res.company', 'Company', required=True, states={'draft': [('readonly', False)]}, readonly=True,), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'draft': [('readonly', False)]}, readonly=True, domain=[('type', '=', 'cash')]), 'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"), 'state': fields.selection( @@ -224,22 +223,18 @@ class account_cash_statement(osv.osv): 'state': lambda *a: 'draft', 'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"), 'user_id': lambda self, cr, uid, context=None: uid, - 'company_id': _get_company, 'starting_details_ids':_get_cash_open_box_lines, 'ending_details_ids':_get_default_cash_close_box_lines } def create(self, cr, uid, vals, context=None): - company_id = vals and vals.get('company_id',False) - if company_id: - sql = [ - ('company_id', '=', vals['company_id']), + sql = [ ('journal_id', '=', vals['journal_id']), ('state', '=', 'open') - ] - open_jrnl = self.search(cr, uid, sql) - if open_jrnl: - raise osv.except_osv('Error', _('You can not have two open register for the same journal')) + ] + open_jrnl = self.search(cr, uid, sql) + if open_jrnl: + raise osv.except_osv('Error', _('You can not have two open register for the same journal')) if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash': lines = end_lines = self._get_cash_close_box_lines(cr, uid, [], context) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index db6772dc2c0..5e4e7aa2ccb 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -524,7 +524,7 @@ - + @@ -546,7 +546,7 @@ - + From b602119abdbf3d629f88499ec8d60de3ff94b66d Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Tue, 14 Sep 2010 20:13:52 +0200 Subject: [PATCH 05/11] [FIX] account: fixed line_ids nto mandatory in vals when creating a new statement bzr revid: qdp-launchpad@tinyerp.com-20100914181352-mspg1snv87jss1ek --- addons/account/account_bank_statement.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 9d6db6bdaca..662fdda69d5 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -31,10 +31,11 @@ class account_bank_statement(osv.osv): def create(self, cr, uid, vals, context=None): seq = 0 - for line in vals['line_ids']: - seq += 1 - line[2]['sequence'] = seq - vals[seq - 1] = line + if 'line_ids' in vals: + for line in vals['line_ids']: + seq += 1 + line[2]['sequence'] = seq + vals[seq - 1] = line return super(account_bank_statement, self).create(cr, uid, vals, context=context) def write(self, cr, uid, ids, vals, context=None): From e4840121407e0a83ae61f95a29e1cc291de6ae20 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 15 Sep 2010 00:20:09 +0200 Subject: [PATCH 06/11] imp remove old code bzr revid: fp@tinyerp.com-20100914222009-ht0fxenguhaduf35 --- addons/account_voucher/voucher.py | 28 ------------------------- addons/account_voucher/voucher_view.xml | 12 ----------- 2 files changed, 40 deletions(-) diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 757198ab40f..d6b00de8216 100644 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -661,34 +661,6 @@ class account_voucher(osv.osv): default['date'] = time.strftime('%Y-%m-%d') return super(account_voucher, self).copy(cr, uid, id, default, context) -# # TODO: remove this -# def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): -# """ -# Returns views and fields for current model where view will depend on {view_type}. -# @param view_id: list of fields, which required to read signatures -# @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) -# @param context: context arguments, like lang, time zone -# @param toolbar: contains a list of reports, wizards, and links related to current model -# -# @return: Returns a dict that contains definition for fields, views, and toolbars -# """ -# data_pool = self.pool.get('ir.model.data') -# journal_pool = self.pool.get('account.journal') -# voucher_type = { -# 'sale':'view_sale_receipt_form', -# 'purchase':'view_purchase_receipt_form', -# 'payment':'view_vendor_payment_form', -# 'receipt':'view_vendor_receipt_form' -# } -# if view_type == 'form': -# tview = voucher_type.get(context.get('type')) -# tview = tview or 'view_voucher_form' -# result = data_pool._get_id(cr, uid, 'account_voucher', tview) -# view_id = data_pool.browse(cr, uid, result, context=context).res_id -# -# res = super(account_voucher, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) -# return res - account_voucher() class account_voucher_line(osv.osv): diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml index f51dd29d140..94f7f18c4a0 100644 --- a/addons/account_voucher/voucher_view.xml +++ b/addons/account_voucher/voucher_view.xml @@ -46,18 +46,6 @@ - - From 04308844b814c490cf51b93c1059760f16d371a1 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Wed, 15 Sep 2010 00:26:12 +0200 Subject: [PATCH 07/11] [IMP] remove unused menu bzr revid: fp@tinyerp.com-20100914222612-fs1b1dzegizkqnf5 --- addons/crm/__openerp__.py | 1 - addons/crm/wizard/__init__.py | 1 - addons/crm/wizard/crm_custom_create_menu.py | 78 ------------------- .../wizard/crm_custom_create_menu_view.xml | 36 --------- 4 files changed, 116 deletions(-) delete mode 100644 addons/crm/wizard/crm_custom_create_menu.py delete mode 100644 addons/crm/wizard/crm_custom_create_menu_view.xml diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 4512892897f..94f3d977842 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -85,7 +85,6 @@ Create dashboard for CRM that includes: 'wizard/crm_send_email_view.xml', 'wizard/crm_forward_to_partner_view.xml', - 'wizard/crm_custom_create_menu_view.xml', 'wizard/crm_merge_opportunities_view.xml', 'crm_view.xml', diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py index 70dd08a23cf..03ddbc43622 100644 --- a/addons/crm/wizard/__init__.py +++ b/addons/crm/wizard/__init__.py @@ -30,7 +30,6 @@ import crm_phonecall_to_partner import crm_phonecall_to_opportunity import crm_partner_to_opportunity -import crm_custom_create_menu import crm_merge_opportunities diff --git a/addons/crm/wizard/crm_custom_create_menu.py b/addons/crm/wizard/crm_custom_create_menu.py deleted file mode 100644 index 8cf8619c074..00000000000 --- a/addons/crm/wizard/crm_custom_create_menu.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- 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 osv import fields,osv - - -class crm_case_custom_create_menu(osv.osv_memory): - ''' - Create menu for custom Cases - ''' - _name = 'crm.custom.create.menu' - _description = 'Create menu for custom Cases' - - _columns = { - 'name': fields.char('Menu Name', size=64, required=True), - 'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True), - 'section_id': fields.many2one('crm.case.section.custom', 'Section', required=True), - 'view_form': fields.many2one('ir.ui.view', 'Form View', domain=[('type','=','form'),('model','=','crm.case.custom')]), - 'view_tree': fields.many2one('ir.ui.view', 'Tree View', domain=[('type','=','tree'),('model','=','crm.case.custom')]), - 'view_calendar': fields.many2one('ir.ui.view', 'Calendar View', domain=[('type','=','calendar'),('model','=','crm.case.custom')]), - 'view_search': fields.many2one('ir.ui.view', 'Search View', domain=[('type','=','search'),('model','=','crm.case.custom')]), - } - - def menu_create(self, cr, uid, ids, context=None): - """ - Creates Menus for selected custom section - """ - data_obj = self.pool.get('ir.model.data') - for this in self.browse(cr, uid, ids, context=context): - domain = [('section_id', '=', this.section_id.id)] - view_mode = [this.view_tree and 'tree', this.view_form and 'form', this.view_calendar and 'calendar'] - view_mode = filter(None , view_mode) - action_id = self.pool.get('ir.actions.act_window').create(cr,uid, { - 'name': this.name, - 'res_model': 'crm.case.custom', - 'domain': domain, - 'view_type': 'form', - 'view_mode': ','.join(view_mode), - 'search_view_id': this.view_search.id or False, - 'context': {'default_section_id': this.section_id.id, 'default_user_id': uid} - }) - menu_id=self.pool.get('ir.ui.menu').create(cr, uid, { - 'name': this.name, - 'parent_id': this.menu_parent_id.id, - 'icon': 'STOCK_JUSTIFY_FILL' - }) - self.pool.get('ir.values').create(cr, uid, { - 'name': 'Custom Cases', - 'key2': 'tree_but_open', - 'model': 'ir.ui.menu', - 'res_id': menu_id, - 'value': 'ir.actions.act_window,%d'%action_id, - 'object': True - }) - return {} - -crm_case_custom_create_menu() - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/wizard/crm_custom_create_menu_view.xml b/addons/crm/wizard/crm_custom_create_menu_view.xml deleted file mode 100644 index ad36e51b744..00000000000 --- a/addons/crm/wizard/crm_custom_create_menu_view.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - crm.custom.create.menu.form - crm.custom.create.menu - form - -
- - - - - - - - - - -