From 484524995a995986e219b4b77707f50cc6d96760 Mon Sep 17 00:00:00 2001 From: jas Date: Mon, 11 Oct 2010 15:07:09 +0530 Subject: [PATCH 01/65] [IMP] : base : improved Warnings bzr revid: jas@tinyerp.com-20101011093709-4tfz25fmwcfs4vft --- bin/addons/base/ir/ir_actions.py | 5 ++--- bin/addons/base/ir/ir_values.py | 3 +-- bin/addons/base/res/partner/partner.py | 1 - bin/osv/orm.py | 6 ++---- bin/report/printscreen/ps_list.py | 1 - bin/report/report_sxw.py | 14 +------------- 6 files changed, 6 insertions(+), 24 deletions(-) diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index 074bfa04f85..7c22d1e3013 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -473,7 +473,7 @@ class actions_server(osv.osv): for field in fields: try: obj = getattr(obj, field) - except Exception,e : + except Exception: logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (field)) return obj @@ -494,7 +494,7 @@ class actions_server(osv.osv): for field in fields: try: obj = getattr(obj, field) - except Exception,e : + except Exception: logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (field)) return obj @@ -502,7 +502,6 @@ class actions_server(osv.osv): def merge_message(self, cr, uid, keystr, action, context=None): if context is None: context = {} - logger = netsvc.Logger() def merge(match): obj_pool = self.pool.get(action.model_id.model) id = context.get('active_id') diff --git a/bin/addons/base/ir/ir_values.py b/bin/addons/base/ir/ir_values.py index 310f3552403..f74ce746e12 100644 --- a/bin/addons/base/ir/ir_values.py +++ b/bin/addons/base/ir/ir_values.py @@ -22,7 +22,6 @@ from osv import osv,fields from osv.orm import except_orm import pickle -from tools.translate import _ class ir_values(osv.osv): _name = 'ir.values' @@ -205,7 +204,7 @@ class ir_values(osv.osv): pos+=1 try: datas = self.pool.get(model).read(cr, uid, [id], fields, context) - except except_orm, e: + except except_orm: return False datas= datas and datas[0] or None if not datas: diff --git a/bin/addons/base/res/partner/partner.py b/bin/addons/base/res/partner/partner.py index 05630dea85b..b65dae6fa7d 100644 --- a/bin/addons/base/res/partner/partner.py +++ b/bin/addons/base/res/partner/partner.py @@ -23,7 +23,6 @@ import math from osv import fields,osv import tools -import ir import pooler from tools.translate import _ diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 55d2a4e226e..f5a82a392e3 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1283,7 +1283,6 @@ class orm_template(object): 'fields': xfields } attrs = {'views': views} - view = False fields = views.get('field', False) and views['field'].get('fields', False) if node.get('name'): attrs = {} @@ -2218,7 +2217,6 @@ class orm(orm_template): fget = self.fields_get(cr, uid, fields) float_int_fields = filter(lambda x: fget[x]['type'] in ('float', 'integer'), fields) - sum = {} flist = '' group_by = groupby if groupby: @@ -3922,7 +3920,7 @@ class orm(orm_template): return True def _apply_ir_rules(self, cr, uid, query, mode='read', context=None): - """Add what's missing in ``query`` to implement all appropriate ir.rules + """Add what's missing in ``query`` to implement all appropriate ir.rules (using the ``model_name``'s rules or the current model's rules if ``model_name`` is None) :param query: the current query object @@ -3978,7 +3976,7 @@ class orm(orm_template): # extract the first field name, to be able to qualify it and add desc/asc m2o_order = m2o_order.split(",",1)[0].strip().split(" ",1)[0] - # Join the dest m2o table if it's not joined yet. We use [LEFT] OUTER join here + # Join the dest m2o table if it's not joined yet. We use [LEFT] OUTER join here # as we don't want to exclude results that have NULL values for the m2o src_table, src_field = qualified_field.replace('"','').split('.', 1) query.join((src_table, dest_model._table, src_field, 'id'), outer=True) diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py index 7fb20eab0dc..fd1169b199e 100644 --- a/bin/report/printscreen/ps_list.py +++ b/bin/report/printscreen/ps_list.py @@ -139,7 +139,6 @@ class report_printscreen_list(report_int): _append_node('header-date', str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M"))) l = [] t = 0 - rowcount = 0; strmax = (pageSize[0]-40) * 2.8346 temp = [] tsum = [] diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 2c505e98622..103e0989978 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -19,24 +19,18 @@ # ############################################################################## from lxml import etree -import traceback, sys import StringIO import cStringIO import base64 -import copy -import locale from datetime import datetime import os import re import time from interface import report_rml import preprocess -import ir import netsvc -import osv import pooler import tools -import warnings import zipfile import common from osv.fields import float as float_class, function as function_class @@ -210,13 +204,10 @@ class rml_parse(object): return res['datas'] else : return '' - except Exception,e: + except Exception: return '' def setLang(self, lang): - if not lang or self.default_lang.has_key(lang): - if not lang: - key = 'en_US' self.localcontext['lang'] = lang self.lang_dict_called = False for obj in self.objects: @@ -437,8 +428,6 @@ class report_sxw(report_rml, preprocess.report): ) cr.commit() except Exception,e: - import traceback, sys - tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) netsvc.Logger().notifyChannel('report', netsvc.LOG_ERROR,str(e)) results.append(result) if results: @@ -512,7 +501,6 @@ class report_sxw(report_rml, preprocess.report): xml_declaration=True) rml_dom = etree.XML(rml) - body = rml_dom[-1] elements = [] key1 = rml_parser.localcontext['name_space']["text"]+"p" key2 = rml_parser.localcontext['name_space']["text"]+"drop-down" From e232dd66384b0c4af20c2e7f2b859c053173cb50 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 11 Oct 2010 18:52:52 +0530 Subject: [PATCH 02/65] [IMP] base: if company_ids is empty, it will be set with deafult value on user creation bzr revid: hmo@tinyerp.com-20101011132252-wcej9vlsb6582w5x --- bin/addons/base/res/res_user.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 929a7018f7d..2b9a3a05eb1 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -350,6 +350,12 @@ class users(osv.osv): # User can write to a few of her own fields (but not her groups for example) SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email'] + def create(self, cr, uid, vals, context=None): + if (not vals.get('company_ids',[])): + company_ids = self._get_companies(cr, uid, context=context) + if company_ids and len(company_ids): vals['company_ids'] = [(6, 0, company_ids)] + return super(users, self).create(cr, uid, vals, context=context) + def write(self, cr, uid, ids, values, context=None): if not hasattr(ids, '__iter__'): ids = [ids] From b153bdce7088c24acb75ba3de83ad1167ba68a08 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 11 Oct 2010 19:01:44 +0530 Subject: [PATCH 03/65] [FIX] base: regression to get default value of group on res.user model bzr revid: hmo@tinyerp.com-20101011133144-ae3oue8865kbb0bp --- bin/addons/base/res/res_user.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 2b9a3a05eb1..d770ef81a10 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -327,8 +327,9 @@ class users(osv.osv): return ids and ids[0] or False def _get_group(self,cr, uid, context=None): - dataobj = self.pool.get('ir.model.data') - data_id = dataobj._get_id(cr, 1, 'base', 'group_user') + data_pool = self.pool.get('ir.model.data') + res = data_pool.get_object_reference(cr, 1, 'base', 'group_user') + data_id = res and res[1] or False return data_id and [data_id] or False _defaults = { From 7c5dce1072bbb0d24b08bbdc9852c30a06c930f0 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 27 Oct 2010 19:06:01 +0530 Subject: [PATCH 04/65] [FIX]: Fixed translation of warning messages lp bug: https://launchpad.net/bugs/660494 fixed bzr revid: rpa@tinyerp.com-20101027133601-caqy1wdk9pduxyem --- bin/addons/__init__.py | 4 +- bin/addons/base/i18n/base.pot | 50 +++++++++++++++++++ bin/addons/base/ir/ir_model.py | 2 +- bin/addons/base/ir/ir_values.py | 2 +- .../base/module/wizard/base_module_upgrade.py | 2 +- 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 0b5c6dc09c5..5476dc198f3 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -30,7 +30,7 @@ import tools import tools.osutil from tools.safe_eval import safe_eval as eval import pooler - +from tools.translate import _ import netsvc @@ -806,7 +806,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): graph = create_graph(cr, ['base'], force) if not graph: logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module base cannot be loaded! (hint: verify addons-path)') - raise osv.osv.except_osv('Could not load base module', 'module base cannot be loaded! (hint: verify addons-path)') + raise osv.osv.except_osv(_('Could not load base module'), _('module base cannot be loaded! (hint: verify addons-path)')) has_updates = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report) if update_module: diff --git a/bin/addons/base/i18n/base.pot b/bin/addons/base/i18n/base.pot index 48ce827f149..51b5df3a8be 100644 --- a/bin/addons/base/i18n/base.pot +++ b/bin/addons/base/i18n/base.pot @@ -4303,6 +4303,7 @@ msgstr "" #: code:addons/base/res/res_config.py:0 #: code:addons/base/res/res_currency.py:0 #: code:addons/base/res/res_user.py:0 +#: code:addons/base/res/ir_property.py:) #, python-format msgid "Error" msgstr "" @@ -5754,6 +5755,7 @@ msgstr "" #. module: base #: code:addons/base/module/wizard/base_module_import.py:0 +#: code:addons/base/ir/ir_values.py: #, python-format msgid "Error !" msgstr "" @@ -8735,3 +8737,51 @@ msgstr "" msgid "Russian / русский язык" msgstr "" +#. module: base +#: code:addons/base/module/wizard/base_module_upgrade.py:0 +#, python-format +msgid "Unmet dependency !" +msgstr "" + +#. module: base +#: code:addons/base/module/wizard/base_module_upgrade.py:0 +#, python-format +msgid "Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages)" +msgstr "" + +#. module: base +#: code:addons/base/ir/ir_model.py:0 +#, python-format +msgid "Invalid search criterions" +msgstr "" + +#. module: base +#: code:addons/base/ir/ir_model.py:0 +#, python-format +msgid "The osv_memory field can only be compared with = and != operator." +msgstr "" + +#. module: base +#: code:addons/base/ir/ir_values.py:0 +#, python-format +msgid "You do not have the permission to perform this operation !!!" +msgstr "" + +#. module: base +#: code:addons/base/res/ir_property.py:0 +#, python-format +msgid "Invalid type" +msgstr "" + +#. module: base +#: code:addons/__init__.py:0 +#, python-format +msgid "Could not load base module" +msgstr "" + +#. module: base +#: code:addons/__init__.py:0 +#, python-format +msgid "module base cannot be loaded! (hint: verify addons-path)" +msgstr "" + diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 3f3700b0e45..86bb6cc4dc5 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -57,7 +57,7 @@ class ir_model(osv.osv): return [] field, operator, value = domain[0] if operator not in ['=', '!=']: - raise osv.except_osv('Invalid search criterions','The osv_memory field can only be compared with = and != operator.') + raise osv.except_osv(_('Invalid search criterions'), _('The osv_memory field can only be compared with = and != operator.')) value = bool(value) if operator == '=' else not bool(value) all_model_ids = self.search(cr, uid, [], context=context) is_osv_mem = self._is_osv_memory(cr, uid, all_model_ids, 'osv_memory', arg=None, context=context) diff --git a/bin/addons/base/ir/ir_values.py b/bin/addons/base/ir/ir_values.py index f74ce746e12..a60fbdddb94 100644 --- a/bin/addons/base/ir/ir_values.py +++ b/bin/addons/base/ir/ir_values.py @@ -229,7 +229,7 @@ class ir_values(osv.osv): if not cnt: res2.remove(r) if r[1] == 'Menuitem' and not res2: - raise osv.except_osv('Error !','You do not have the permission to perform this operation !!!') + raise osv.except_osv(_('Error !'), _('You do not have the permission to perform this operation !!!')) return res2 ir_values() diff --git a/bin/addons/base/module/wizard/base_module_upgrade.py b/bin/addons/base/module/wizard/base_module_upgrade.py index 4db4028bdb0..b791aeea459 100644 --- a/bin/addons/base/module/wizard/base_module_upgrade.py +++ b/bin/addons/base/module/wizard/base_module_upgrade.py @@ -93,7 +93,7 @@ class base_module_upgrade(osv.osv_memory): if dep_mod.state in ('unknown','uninstalled'): unmet_packages.append(dep_mod.name) if len(unmet_packages): - raise osv.except_osv('Unmet dependency !', 'Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages)) + raise osv.except_osv(_('Unmet dependency !'), _('Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages))) mod_obj.download(cr, uid, ids, context=context) cr.commit() _, pool = pooler.restart_pool(cr.dbname, update_module=True) From bba8926e32ba74e5ae7047a2c59dd1be57409b1a Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 28 Oct 2010 17:41:43 +0530 Subject: [PATCH 05/65] [FIX] base: remove _(..) in sql_constraints in res.users model bzr revid: hmo@tinyerp.com-20101028121143-kgb3wcsl59k6hn05 --- bin/addons/base/res/res_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 4de6071f2fe..179825d95b4 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -263,7 +263,7 @@ class users(osv.osv): ] _sql_constraints = [ - ('login_key', 'UNIQUE (login)', _('You can not have two users with the same login !')) + ('login_key', 'UNIQUE (login)', 'You can not have two users with the same login !') ] def _get_email_from(self, cr, uid, ids, context=None): From 24c91a5e4194110d83833f9ba377e537e8edc720 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 28 Oct 2010 17:50:35 +0530 Subject: [PATCH 06/65] [FIX] base: missing import _ bzr revid: hmo@tinyerp.com-20101028122035-pv48msjk6pck4wen --- bin/addons/base/i18n/base.pot | 2 +- bin/addons/base/ir/ir_values.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/i18n/base.pot b/bin/addons/base/i18n/base.pot index 51b5df3a8be..f0ad2bf8207 100644 --- a/bin/addons/base/i18n/base.pot +++ b/bin/addons/base/i18n/base.pot @@ -4303,7 +4303,7 @@ msgstr "" #: code:addons/base/res/res_config.py:0 #: code:addons/base/res/res_currency.py:0 #: code:addons/base/res/res_user.py:0 -#: code:addons/base/res/ir_property.py:) +#: code:addons/base/res/ir_property.py:0 #, python-format msgid "Error" msgstr "" diff --git a/bin/addons/base/ir/ir_values.py b/bin/addons/base/ir/ir_values.py index a60fbdddb94..193dc11bbef 100644 --- a/bin/addons/base/ir/ir_values.py +++ b/bin/addons/base/ir/ir_values.py @@ -22,6 +22,7 @@ from osv import osv,fields from osv.orm import except_orm import pickle +from tools.translate import _ class ir_values(osv.osv): _name = 'ir.values' From d644417abb6d962287ebc2d9293a901a38dcf238 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 4 Nov 2010 11:24:40 +0530 Subject: [PATCH 07/65] [FIX] base: correct warning messages bzr revid: hmo@tinyerp.com-20101104055440-av49qnlqxziq9vro --- bin/addons/base/i18n/base.pot | 2 +- bin/addons/base/module/wizard/base_module_upgrade.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/i18n/base.pot b/bin/addons/base/i18n/base.pot index f0ad2bf8207..d96c081d6a6 100644 --- a/bin/addons/base/i18n/base.pot +++ b/bin/addons/base/i18n/base.pot @@ -8746,7 +8746,7 @@ msgstr "" #. module: base #: code:addons/base/module/wizard/base_module_upgrade.py:0 #, python-format -msgid "Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages)" +msgid "Following modules are not installed or unknown: %s" msgstr "" #. module: base diff --git a/bin/addons/base/module/wizard/base_module_upgrade.py b/bin/addons/base/module/wizard/base_module_upgrade.py index b791aeea459..de9df1ec3e0 100644 --- a/bin/addons/base/module/wizard/base_module_upgrade.py +++ b/bin/addons/base/module/wizard/base_module_upgrade.py @@ -93,7 +93,7 @@ class base_module_upgrade(osv.osv_memory): if dep_mod.state in ('unknown','uninstalled'): unmet_packages.append(dep_mod.name) if len(unmet_packages): - raise osv.except_osv(_('Unmet dependency !'), _('Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages))) + raise osv.except_osv(_('Unmet dependency !'), _('Following modules are not installed or unknown: %s') % ('\n\n' + '\n'.join(unmet_packages))) mod_obj.download(cr, uid, ids, context=context) cr.commit() _, pool = pooler.restart_pool(cr.dbname, update_module=True) From 236e74c3964942f354ae00f5bea0883b4842693e Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 4 Nov 2010 14:09:16 +0530 Subject: [PATCH 08/65] [FIX] base: remove override create method of res.users object. bzr revid: hmo@tinyerp.com-20101104083916-m93lq4olgle5rrq9 --- bin/addons/base/res/res_user.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 179825d95b4..ca70db47243 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -331,12 +331,6 @@ class users(osv.osv): # User can write to a few of her own fields (but not her groups for example) SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email'] - def create(self, cr, uid, vals, context=None): - if (not vals.get('company_ids',[])): - company_ids = self._get_companies(cr, uid, context=context) - if company_ids and len(company_ids): vals['company_ids'] = [(6, 0, company_ids)] - return super(users, self).create(cr, uid, vals, context=context) - def write(self, cr, uid, ids, values, context=None): if not hasattr(ids, '__iter__'): ids = [ids] From 9097750b728cf1ce769acf2fc9bd21d4ba4df7b5 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 10 Nov 2010 17:06:32 +0530 Subject: [PATCH 09/65] [IMP] Account:Improve name_get for invoice bzr revid: ara@tinyerp.com-20101110113632-krw1sokifj1aem41 --- addons/account/invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index e03e0035022..63342143811 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1063,7 +1063,7 @@ class account_invoice(osv.osv): 'out_refund': 'OR: ', 'in_refund': 'SR: ', } - return [(r['id'], types[r['type']]+(r['number'] or '')+' '+(r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')] + return [(r['id'], (r['number']) or types[r['type']]+(r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')] def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): if not args: From 466c65ec7427a9072a2bd5ab04684b0768ecf228 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 10 Nov 2010 18:05:56 +0530 Subject: [PATCH 10/65] [REF] l10n_be: Corrected warnings from build pot bzr revid: mra@mra-laptop-20101110123556-0nhlrne8mm8r9z8m --- addons/l10n_be/wizard/l10_be_partner_vat_listing.py | 1 - addons/l10n_be/wizard/l10n_be_account_vat_declaration.py | 1 - addons/l10n_be/wizard/l10n_be_vat_intra.py | 2 -- 3 files changed, 4 deletions(-) diff --git a/addons/l10n_be/wizard/l10_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10_be_partner_vat_listing.py index bb9874cb387..6776f9c42e1 100644 --- a/addons/l10n_be/wizard/l10_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10_be_partner_vat_listing.py @@ -146,7 +146,6 @@ class partner_vat_list(osv.osv_memory): obj_fyear = self.pool.get('account.fiscalyear') obj_addr = self.pool.get('res.partner.address') obj_vat_lclient = self.pool.get('vat.listing.clients') - obj_model_data = self.pool.get('ir.model.data') seq_controlref = obj_sequence.get(cursor, user, 'controlref') seq_declarantnum = obj_sequence.get(cursor, user, 'declarantnum') diff --git a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py index b915b3ed854..36a9cd50ea0 100644 --- a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py @@ -50,7 +50,6 @@ class l10n_be_vat_declaration(osv.osv_memory): } def create_xml(self, cr, uid, ids, context=None): - obj_fyear = self.pool.get('account.fiscalyear') obj_tax_code = self.pool.get('account.tax.code') obj_acc_period = self.pool.get('account.period') obj_user = self.pool.get('res.users') diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra.py b/addons/l10n_be/wizard/l10n_be_vat_intra.py index a95e9dfbf81..da1a21d87ac 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra.py +++ b/addons/l10n_be/wizard/l10n_be_vat_intra.py @@ -68,13 +68,11 @@ class partner_vat_intra(osv.osv_memory): def create_xml(self, cursor, user, ids, context=None): obj_user = self.pool.get('res.users') - obj_fyear = self.pool.get('account.fiscalyear') obj_sequence = self.pool.get('ir.sequence') obj_partner = self.pool.get('res.partner') obj_partner_add = self.pool.get('res.partner.address') mod_obj = self.pool.get('ir.model.data') street = zip_city = country = p_list = data_clientinfo = '' - error_message = list_partner = [] seq = amount_sum = 0 if context is None: From b44bcdba39ad7165a8a5f25335501a887cacbab1 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 10 Nov 2010 18:19:30 +0530 Subject: [PATCH 11/65] [FIX] Event: Copy registration will not copy invoice_id bzr revid: mra@mra-laptop-20101110124930-i3oq64k3gwyt0066 --- addons/event/event.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/event/event.py b/addons/event/event.py index 64f93e6db55..d54d0253b2d 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -370,6 +370,18 @@ class event_registration(osv.osv): self.history(cr, uid, [reg], _('Invoiced')) return inv_id + def copy(self, cr, uid, id, default=None, context=None): + """ Copy record of Given id + @param id: Id of Registration record. + @param context: A standard dictionary for contextual values + """ + if not default: + default = {} + default.update({ + 'invoice_id': False, + }) + return super(event_registration, self).copy(cr, uid, id, default=default, context=context) + def action_invoice_create(self, cr, uid, ids, grouped=False, date_inv = False, context=None): """ Action of Create Invoice """ res = False From f41331b31e19f20e4418350a6b603f79b59ca159 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 10 Nov 2010 18:23:28 +0530 Subject: [PATCH 12/65] [REF] event bzr revid: mra@mra-laptop-20101110125328-364lsom30eyk1j3b --- addons/event/event.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/event/event.py b/addons/event/event.py index d54d0253b2d..ab90fe64803 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -562,11 +562,11 @@ class event_registration(osv.osv): subject = _('Auto Confirmation: [%s] %s') %(regestration.id, regestration.name) body = regestration.event_id.mail_confirm if subject or body: - tools.email_send(src, email_to, subject, body, email_cc = email_cc, openobject_id = regestration.id) + tools.email_send(src, email_to, subject, body, email_cc=email_cc, openobject_id=regestration.id) self.history(cr, uid, [regestration], subject, history = True, \ - email = email_to, details = body, \ - subject = subject, email_from = src, \ - email_cc = ', '.join(email_cc)) + email=email_to, details=body, \ + subjec=subject, email_from=src, \ + email_cc=', '.join(email_cc)) return True From 24558876c876de6a56d1c4f282271d5234dc5634 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 10 Nov 2010 18:50:57 +0530 Subject: [PATCH 13/65] [FIX] l10n_cr: correct demo data for account type, tax and currency -> some fields removed in trunk so bzr revid: mra@mra-laptop-20101110132057-a4fb39os2pwjtnbr --- addons/l10n_cr/data/account_account_type.xml | 22 -------------------- addons/l10n_cr/data/account_tax_template.xml | 4 ++-- addons/l10n_cr/l10n_cr_base_data.xml | 10 ++++----- 3 files changed, 7 insertions(+), 29 deletions(-) diff --git a/addons/l10n_cr/data/account_account_type.xml b/addons/l10n_cr/data/account_account_type.xml index ab4370761d5..d613b04d2cc 100644 --- a/addons/l10n_cr/data/account_account_type.xml +++ b/addons/l10n_cr/data/account_account_type.xml @@ -8,89 +8,67 @@ A Asset - 10 - balance AV Asset valuation - 13 - balance C Cash - 11 - balance Eq Equity - 30 - detail Ex Expense - 50 - none I Income - 40 - none Pas Passive - 20 - balance Pay Payable - 21 - unreconciled R Receivable - 12 - unreconciled T Tax - 22 - unreconciled V View - 0 - none diff --git a/addons/l10n_cr/data/account_tax_template.xml b/addons/l10n_cr/data/account_tax_template.xml index 8ac4288efa8..cd9fdaab111 100644 --- a/addons/l10n_cr/data/account_tax_template.xml +++ b/addons/l10n_cr/data/account_tax_template.xml @@ -11,7 +11,7 @@ 10 13 percent - vat + all true @@ -34,7 +34,7 @@ 10 13 percent - vat + all true diff --git a/addons/l10n_cr/l10n_cr_base_data.xml b/addons/l10n_cr/l10n_cr_base_data.xml index 4b6939395fb..e26ea348e09 100644 --- a/addons/l10n_cr/l10n_cr_base_data.xml +++ b/addons/l10n_cr/l10n_cr_base_data.xml @@ -1,7 +1,7 @@ - + - + - + - + Πίνακες φόρου - + Υπόλοιπο ΦΠΑ - 501-511 + 501-511 - + ΦΠΑ Εισροών - - + + Λοιπή Ελλάδα εκτός Αιγαίου ΦΠΑ Εισροών 9% - 371 - - - - - ΦΠΑ Εισροών 4,5% - 372 - - - - - ΦΠΑ Εισροών 19% - 373 + 371 - + + ΦΠΑ Εισροών 4,5% + 372 + + + + + ΦΠΑ Εισροών 19% + 373 + + + + Νησιά Αιγαίου ΦΠΑ Εισροών 6% - 374 + 374 - + ΦΠΑ Εισροών 3% - 375 + 375 - - + + ΦΠΑ Εισροών 13% - 376 + 376 - + ΦΠΑ Εκροών - - + + Λοιπή Ελλάδα εκτός Αιγαίου ΦΠΑ Εκροών 9% - 331 - - - - - ΦΠΑ Εκροών 4,5% - 332 - - - - - ΦΠΑ Εκροών 19% - 333 + 331 - + + ΦΠΑ Εκροών 4,5% + 332 + + + + + ΦΠΑ Εκροών 19% + 333 + + + + Νησιά Αιγαίου ΦΠΑ Εκροών 6% - 334 + 334 - + ΦΠΑ Εκροών 3% - 335 + 335 - - + + ΦΠΑ Εκροών 13% - 336 + 336 Σύνολο Εκροών - 311 + 311 Σύνολο Φορολ/τέων Εκροών - 307 + 307 Εκροές 9% - 301 + 301 + Εκροές 4.5% - 302 + 302 + Εκροές 19% - 303 + 303 - + Σύνολο Φορολ/τέων εισροών Σύνολο Φορολ/τέων εισροών - 358 + 358 Εισροές 9% - 351 + 351 + Εισροές 4.5% - 352 + 352 Εισροές 19% - 353 + 353 - + Πρότυπο Ελληνικού Λογιστικού Σχεδίου @@ -194,39 +197,38 @@ - + Εισροές 19 percent - sale + sale - + - - + + Εκροές 19 percent - purchase + purchase - - - + + \ No newline at end of file diff --git a/addons/l10n_it/__init__.py b/addons/l10n_it/__init__.py index 6a6278762b2..adfc1887c32 100755 --- a/addons/l10n_it/__init__.py +++ b/addons/l10n_it/__init__.py @@ -1,12 +1,12 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Italian OpenERP accounting module +# Italian OpenERP accounting module # Copyright (C) 2010 Servabit srl () and the # Italian OpenERP Community () # # ######################################################################## -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -29,5 +29,4 @@ import libroIVA import report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_it/__openerp__.py b/addons/l10n_it/__openerp__.py index f7275688715..5e4d2d5687e 100755 --- a/addons/l10n_it/__openerp__.py +++ b/addons/l10n_it/__openerp__.py @@ -1,11 +1,11 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Italian OpenERP accounting module -# Copyright (C) 2010 Servabit srl () +# Italian OpenERP accounting module +# Copyright (C) 2010 Servabit srl () # # Developed by the servabit OpenERP team: openerp@servabit.it -# +# # Some parts have been taken from modules by the: # Italian OpenERP Community () # Some files follows the ideas in the l10n_fr module, @@ -13,7 +13,7 @@ # ############################################################################# # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -31,29 +31,29 @@ # along with this program. If not, see . # ############################################################################## + { - "name" : "Italy - Chart of Accounts By Servabit", - "version" : "0.4", - "author" : "Servabit srl", + "name": "Italy - Chart of Accounts By Servabit", + "version": "0.4", + "author": "Servabit srl", "website": "http://www.servabit.it", - "category" : "Localisation/Account Charts", + "category": "Localisation/Account Charts", "description": "This is a module to manage the accounting chart for Italy (CC2424 Profile) for a service company.", - "depends" : ["account", "base_iban", "base_vat", "account_chart"], - "demo_xml" : [], - "update_xml" : ['tipoconti_servabit.xml', - 'pianoconti_servabit.xml', + "depends": ["account", "base_iban", "base_vat", "account_chart"], + "demo_xml": [], + "update_xml": ['tipoconti_servabit.xml', + 'pianoconti_servabit.xml', 'account_tax_template.xml', 'journals.xml', 'default_accounts.xml', 'anno_fiscale.xml', 'l10n_chart_it_servabit_wizard.xml', 'report.xml', - 'libroIVA_view.xml', - 'libroIVA_menu.xml', - 'security/ir.model.access.csv', + 'libroIVA_view.xml', + 'libroIVA_menu.xml', + 'security/ir.model.access.csv', ], "active": False, "installable": True, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_it/libroIVA.py b/addons/l10n_it/libroIVA.py index 7485c6cf2b3..f33f969d297 100755 --- a/addons/l10n_it/libroIVA.py +++ b/addons/l10n_it/libroIVA.py @@ -21,10 +21,10 @@ ############################################################################## -# ################################################################################## -# Questa vista SQL viene usata solo per far scegliere l'anno di pianificazione all'utente -# Viene infatti costruita una vista XML di tipo tree che contiene solo i diversi anni per i quali stata fatta almeno una pianificazione -# ################################################################################## +################################################################################### +# Questa vista SQL viene usata solo per far scegliere l'anno di pianificazione all'utente +# Viene infatti costruita una vista XML di tipo tree che contiene solo i diversi anni per i quali stata fatta almeno una pianificazione +################################################################################### from osv import fields, osv diff --git a/addons/l10n_it/productcateg.xml b/addons/l10n_it/productcateg.xml deleted file mode 100755 index e69de29bb2d..00000000000 diff --git a/addons/l10n_it/report/__init__.py b/addons/l10n_it/report/__init__.py index be32155c675..ad438e9351f 100755 --- a/addons/l10n_it/report/__init__.py +++ b/addons/l10n_it/report/__init__.py @@ -1,2 +1,4 @@ import libroIVA_credito -import libroIVA_debito \ No newline at end of file +import libroIVA_debito + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_it/report/libroIVA_credito.py b/addons/l10n_it/report/libroIVA_credito.py index 5a7c5245da1..a74c4ffadb7 100755 --- a/addons/l10n_it/report/libroIVA_credito.py +++ b/addons/l10n_it/report/libroIVA_credito.py @@ -1,26 +1,24 @@ -import datetime import time from report import report_sxw -from osv import osv import pooler - + class l10n_chart_it_servabit_report_libroIVA_credito(report_sxw.rml_parse): - + def __init__(self, cr, uid, name, context): super(l10n_chart_it_servabit_report_libroIVA_credito,self).__init__(cr,uid,name,context) self.localcontext.update({ - 'time' : time, + 'time' : time, 'get_company' : self.get_company, 'get_periods' : self.get_periods, 'get_lines' : self.get_lines, }) - - + + def get_company(self,fiscal_year): #print 'COMP = ',fiscal_year return "" - + def get_periods(self,fiscal_year): #print 'Fiscal year id:',fiscal_year.id obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') @@ -29,13 +27,13 @@ class l10n_chart_it_servabit_report_libroIVA_credito(report_sxw.rml_parse): res=[rec for rec in fy.period_ids] #return fy.periods => non funziona?!? bool object !?!? return res - + def get_invoices(self,period): #print 'PERIOD = ',period.name obj=pooler.get_pool(self.cr.dbname).get('account.invoice') # Selezione tutte le fatture emesse nel periodo self.cr.execute( """ - SELECT id FROM account_invoice + SELECT id FROM account_invoice WHERE (state='open' OR state='paid') AND period_id="""+str(period.id)+""" AND (type='out_invoice' OR type='out_refund') @@ -47,7 +45,7 @@ class l10n_chart_it_servabit_report_libroIVA_credito(report_sxw.rml_parse): invoices=obj.browse(self.cr,self.uid,ids) #print 'INVOICES = ',invoices return invoices - + def get_lines(self,fiscal_year): res=[] obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') @@ -72,8 +70,8 @@ class l10n_chart_it_servabit_report_libroIVA_credito(report_sxw.rml_parse): d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', } return res - - report_sxw.report_sxw('report.l10n_it.report.libroIVA_credito','account.report_libroiva', 'l10n_it/report/libroIVA_credito.rml', parser=l10n_chart_it_servabit_report_libroIVA_credito,header=False) + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_it/report/libroIVA_debito.py b/addons/l10n_it/report/libroIVA_debito.py index 4fe14db714d..b6e38bf4f35 100755 --- a/addons/l10n_it/report/libroIVA_debito.py +++ b/addons/l10n_it/report/libroIVA_debito.py @@ -1,27 +1,25 @@ -import datetime import time from report import report_sxw -from osv import osv import pooler - + class l10n_chart_it_servabit_report_libroIVA_debito(report_sxw.rml_parse): - + def __init__(self, cr, uid, name, context): super(l10n_chart_it_servabit_report_libroIVA_debito,self).__init__(cr,uid,name,context) self.localcontext.update({ - 'time' : time, - 'get_company' : self.get_company, - 'get_periods' : self.get_periods, - 'get_lines' : self.get_lines, + 'time' : time, + 'get_company' : self.get_company, + 'get_periods' : self.get_periods, + 'get_lines' : self.get_lines, }) - - + + def get_company(self,fiscal_year): - #print 'COMP = ',fiscal_year + #print 'COMP = ',fiscal_year return "" - - + + def get_periods(self,fiscal_year): #print 'Fiscal year id:',fiscal_year.id obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') @@ -30,13 +28,13 @@ class l10n_chart_it_servabit_report_libroIVA_debito(report_sxw.rml_parse): res=[rec for rec in fy.period_ids] #return fy.periods => non funziona?!? bool object !?!? return res - + def get_invoices(self,period): #print 'PERIOD = ',period.name obj=pooler.get_pool(self.cr.dbname).get('account.invoice') # Selezione tutte le fatture emesse nel periodo self.cr.execute( """ - SELECT id FROM account_invoice + SELECT id FROM account_invoice WHERE (state='open' OR state='paid') AND period_id="""+str(period.id)+""" AND (type='in_invoice' OR type='in_refund') @@ -48,7 +46,7 @@ class l10n_chart_it_servabit_report_libroIVA_debito(report_sxw.rml_parse): invoices=obj.browse(self.cr,self.uid,ids) #print 'INVOICES = ',invoices return invoices - + def get_lines(self,fiscal_year): res=[] obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') @@ -73,8 +71,8 @@ class l10n_chart_it_servabit_report_libroIVA_debito(report_sxw.rml_parse): d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', } return res - - report_sxw.report_sxw('report.l10n_it.report.libroIVA_debito','account.report_libroiva', 'l10n_it/report/libroIVA_debito.rml', parser=l10n_chart_it_servabit_report_libroIVA_debito,header=False) + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_ma/l10n_ma.py b/addons/l10n_ma/l10n_ma.py index be027f75f13..a8e0dd42687 100644 --- a/addons/l10n_ma/l10n_ma.py +++ b/addons/l10n_ma/l10n_ma.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -20,12 +20,7 @@ # ############################################################################## -from mx import DateTime -import time - from osv import fields, osv -import pooler - class l10n_ma_report(osv.osv): _name = 'l10n.ma.report' From 6637f578c7973b2bd03a334161c5b773f65555ac Mon Sep 17 00:00:00 2001 From: pso Date: Thu, 11 Nov 2010 11:52:25 +0530 Subject: [PATCH 18/65] [FIX] sale: SO -History - can delete related invoice lp bug: https://launchpad.net/bugs/663967 fixed bzr revid: pso@tinyerp.com-20101111062225-xvibc48jivrbwntj --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index b65e640d6dc..29826e1c293 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -245,7 +245,7 @@ class sale_order(osv.osv): 'project_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft': [('readonly', False)]}, help="The analytic account related to a sale order"), 'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}), - 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), + 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', readonly=True, help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), 'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Related Picking', readonly=True, help="This is the list of picking list that have been generated for this invoice"), 'shipped': fields.boolean('Delivered', readonly=True, help="It indicates that the sale order has been delivered. This field is updated only after the scheduler have been launched !"), 'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'), From 4e95e42233a6728401d58359d71f791f79aea703 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 11 Nov 2010 15:43:53 +0530 Subject: [PATCH 19/65] [FIX] Account: Account : problem with journals and error messages lp bug: https://launchpad.net/bugs/615268 fixed bzr revid: mra@mra-laptop-20101111101353-iwtel2bf7sqdqhby --- addons/account/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 94c4acf24aa..1282d199b80 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1094,7 +1094,7 @@ class account_move_line(osv.osv): def _update_check(self, cr, uid, ids, context={}): done = {} for line in self.browse(cr, uid, ids, context): - if line.move_id.state <> 'draft': + if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted): raise osv.except_osv(_('Error !'), _('You can not do this modification on a confirmed entry ! Please note that you can just change some non important fields !')) if line.reconcile_id: raise osv.except_osv(_('Error !'), _('You can not do this modification on a reconciled entry ! Please note that you can just change some non important fields !')) From b7b3431ef5ed4f847a31b1a48b61bf9a1b34adda Mon Sep 17 00:00:00 2001 From: mtr Date: Thu, 11 Nov 2010 16:42:17 +0530 Subject: [PATCH 20/65] [IMP] account: added partner_id on account.model in yml file bzr revid: mtr@mtr-20101111111217-hd3a133mckrikrsv --- addons/account/test/account_use_model.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/test/account_use_model.yml b/addons/account/test/account_use_model.yml index 4eb03a13026..ddb18c1a7d4 100644 --- a/addons/account/test/account_use_model.yml +++ b/addons/account/test/account_use_model.yml @@ -10,6 +10,7 @@ name: test1 sequence: 0.0 quantity: 0.0 + partner_id: base.res_partner_3 name: My Test Model - From 30571eeda91fe263a636c43332b3cf10d3bb3835 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 11 Nov 2010 17:14:43 +0530 Subject: [PATCH 21/65] [FIX] Sale: sale order - missing field client_order_ref in tree view => with extended group lp bug: https://launchpad.net/bugs/659908 fixed bzr revid: mra@mra-laptop-20101111114443-ulw749f2uybwoybt --- addons/sale/sale_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index ec3c390f521..82ec4d68bac 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -84,6 +84,7 @@ + From 1bfc81528d134e89466836981b29b84140fba624 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Thu, 11 Nov 2010 18:38:05 +0530 Subject: [PATCH 22/65] [REF] l10n_*:Correct warning from buildbot bzr revid: ara@tinyerp.com-20101111130805-cqoeyj1zyqu5aw7q --- addons/l10n_br/__openerp__.py | 26 +++--- addons/l10n_cr/__openerp__.py | 20 ++-- addons/l10n_it/__openerp__.py | 27 +++--- addons/l10n_it/libroIVA.py | 9 +- addons/l10n_it/report/libroIVA_credito.py | 105 +++++++++++---------- addons/l10n_it/report/libroIVA_debito.py | 107 +++++++++++----------- 6 files changed, 140 insertions(+), 154 deletions(-) diff --git a/addons/l10n_br/__openerp__.py b/addons/l10n_br/__openerp__.py index c2ff1c0e66e..f173b749cd6 100644 --- a/addons/l10n_br/__openerp__.py +++ b/addons/l10n_br/__openerp__.py @@ -19,26 +19,22 @@ ################################################################################# { - 'name' : 'Brazilian Localization', - 'description' : 'Brazilian Localization', - 'category' : 'Localisation/Account Charts', - 'author' : 'OpenERP Brasil', - 'website' : 'http://openerpbrasil.org', - 'version' : '0.6', - 'depends' : [ - 'account', - 'account_chart', - ], - 'init_xml': [ - ], - 'update_xml' : [ + 'name': 'Brazilian Localization', + 'description': 'Brazilian Localization', + 'category': 'Localisation/Account Charts', + 'author': 'OpenERP Brasil', + 'website': 'http://openerpbrasil.org', + 'version': '0.6', + 'depends': ['account','account_chart'], + 'init_xml': [], + 'update_xml': [ 'data/account.account.type.csv', 'data/account.tax.code.template.csv', 'data/account.account.template.csv', 'data/l10n_br_account_chart_template.xml', - 'data/account_tax_template.xml', + 'data/account_tax_template.xml' ], - 'installable': True + 'installable': True, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_cr/__openerp__.py b/addons/l10n_cr/__openerp__.py index 462c9d3cfae..e826de5ebd0 100644 --- a/addons/l10n_cr/__openerp__.py +++ b/addons/l10n_cr/__openerp__.py @@ -40,17 +40,17 @@ 'website': 'http://clearcorp.co.cr', 'category': 'Localisation/Account Charts', 'description': """Chart of accounts for Costa Rica - Includes: - * account.type - * account.account.template - * account.tax.template - * account.tax.code.template - * account.chart.template + Includes: + * account.type + * account.account.template + * account.tax.template + * account.tax.code.template + * account.chart.template - Everything is in English with Spanish translation. Further translations are welcome, please go to - http://translations.launchpad.net/openerp-costa-rica +Everything is in English with Spanish translation. Further translations are welcome, please go to +http://translations.launchpad.net/openerp-costa-rica """, - 'depends': ['account','account_chart', 'base'], + 'depends': ['account', 'account_chart', 'base'], 'init_xml': [], 'demo_xml': [], 'update_xml': [ @@ -61,7 +61,7 @@ 'data/account_chart_template.xml', 'data/account_tax_template.xml', 'l10n_wizard.xml' - ], + ], 'license': 'Other OSI approved licence', 'installable': True, 'active': False, diff --git a/addons/l10n_it/__openerp__.py b/addons/l10n_it/__openerp__.py index 5e4d2d5687e..a059b7a64e0 100755 --- a/addons/l10n_it/__openerp__.py +++ b/addons/l10n_it/__openerp__.py @@ -38,21 +38,22 @@ "author": "Servabit srl", "website": "http://www.servabit.it", "category": "Localisation/Account Charts", - "description": "This is a module to manage the accounting chart for Italy (CC2424 Profile) for a service company.", + "description": """This is a module to manage the accounting chart for Italy (CC2424 Profile) for a service company.""", "depends": ["account", "base_iban", "base_vat", "account_chart"], "demo_xml": [], - "update_xml": ['tipoconti_servabit.xml', - 'pianoconti_servabit.xml', - 'account_tax_template.xml', - 'journals.xml', - 'default_accounts.xml', - 'anno_fiscale.xml', - 'l10n_chart_it_servabit_wizard.xml', - 'report.xml', - 'libroIVA_view.xml', - 'libroIVA_menu.xml', - 'security/ir.model.access.csv', - ], + "update_xml": [ + 'tipoconti_servabit.xml', + 'pianoconti_servabit.xml', + 'account_tax_template.xml', + 'journals.xml', + 'default_accounts.xml', + 'anno_fiscale.xml', + 'l10n_chart_it_servabit_wizard.xml', + 'report.xml', + 'libroIVA_view.xml', + 'libroIVA_menu.xml', + 'security/ir.model.access.csv' + ], "active": False, "installable": True, } diff --git a/addons/l10n_it/libroIVA.py b/addons/l10n_it/libroIVA.py index f33f969d297..92e3b7ccc15 100755 --- a/addons/l10n_it/libroIVA.py +++ b/addons/l10n_it/libroIVA.py @@ -37,15 +37,12 @@ class l10n_chart_it_servabit_report_libroIVA (osv.osv): _columns = { 'name': fields.char('Fiscal year',size=64), - 'company_id': fields.many2one('res.company', 'Company'), + 'company_id': fields.many2one('res.company', 'Company'), } def init (self, cr) : cr.execute("""DROP VIEW IF EXISTS account_report_libroiva""") - cr.execute(""" - CREATE VIEW account_report_libroiva AS ( - SELECT id, name, company_id FROM account_fiscalyear - )""") + cr.execute("""CREATE VIEW account_report_libroiva AS (SELECT id, name, company_id FROM account_fiscalyear)""") l10n_chart_it_servabit_report_libroIVA() - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_it/report/libroIVA_credito.py b/addons/l10n_it/report/libroIVA_credito.py index a74c4ffadb7..7697d4d9033 100755 --- a/addons/l10n_it/report/libroIVA_credito.py +++ b/addons/l10n_it/report/libroIVA_credito.py @@ -8,70 +8,67 @@ class l10n_chart_it_servabit_report_libroIVA_credito(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(l10n_chart_it_servabit_report_libroIVA_credito,self).__init__(cr,uid,name,context) self.localcontext.update({ - 'time' : time, - 'get_company' : self.get_company, - 'get_periods' : self.get_periods, - 'get_lines' : self.get_lines, + 'time': time, + 'get_company': self.get_company, + 'get_periods': self.get_periods, + 'get_lines': self.get_lines, }) - def get_company(self,fiscal_year): - #print 'COMP = ',fiscal_year + #print 'COMP = ',fiscal_year return "" def get_periods(self,fiscal_year): - #print 'Fiscal year id:',fiscal_year.id - obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') - fy=obj.browse(self.cr,self.uid,fiscal_year.id) - #print 'Periods = ',fy.period_ids - res=[rec for rec in fy.period_ids] - #return fy.periods => non funziona?!? bool object !?!? - return res + #print 'Fiscal year id:',fiscal_year.id + obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') + fy=obj.browse(self.cr,self.uid,fiscal_year.id) + #print 'Periods = ',fy.period_ids + res=[rec for rec in fy.period_ids] + #return fy.periods => non funziona?!? bool object !?!? + return res def get_invoices(self,period): - #print 'PERIOD = ',period.name - obj=pooler.get_pool(self.cr.dbname).get('account.invoice') - # Selezione tutte le fatture emesse nel periodo - self.cr.execute( """ - SELECT id FROM account_invoice - WHERE (state='open' OR state='paid') AND - period_id="""+str(period.id)+""" - AND (type='out_invoice' OR type='out_refund') - """) - ids=self.cr.fetchall() - #print 'IDS = ', - if ids: - ids=[id[0] for id in ids ] - invoices=obj.browse(self.cr,self.uid,ids) - #print 'INVOICES = ',invoices - return invoices + #print 'PERIOD = ',period.name + obj=pooler.get_pool(self.cr.dbname).get('account.invoice') + # Selezione tutte le fatture emesse nel periodo + self.cr.execute(""" + SELECT id FROM account_invoice + WHERE (state='open' OR state='paid') AND + period_id="""+str(period.id)+""" + AND (type='out_invoice' OR type='out_refund') + """) + ids=self.cr.fetchall() + #print 'IDS = ', + if ids: + ids=[id[0] for id in ids ] + invoices=obj.browse(self.cr,self.uid,ids) + #print 'INVOICES = ',invoices + return invoices def get_lines(self,fiscal_year): - res=[] - obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') - fy=obj_fy.browse(self.cr,self.uid,fiscal_year.id) - for period in fy.period_ids: - invoices=self.get_invoices(period) - for invoice in invoices: - d={'periodo': period.name} - d['protocollo']=invoice.number - #print 'PARTNER ',invoice.partner_id.name - causale=invoice.partner_id.name - #print 'CAUSALE = ',causale - d['causale']=causale - d['numero']=invoice.reference - d['data_doc']=invoice.date_invoice - for tax in invoice.tax_line: - #print '\tTAX: ',tax - d['aliquota']=tax.tax_code_id.name - d['imponibile']=tax.base - d['imposta']=tax.amount - res.append(d) - d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', } - return res + res=[] + obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') + fy=obj_fy.browse(self.cr,self.uid,fiscal_year.id) + for period in fy.period_ids: + invoices=self.get_invoices(period) + for invoice in invoices: + d={'periodo': period.name} + d['protocollo']=invoice.number + #print 'PARTNER ',invoice.partner_id.name + causale=invoice.partner_id.name + #print 'CAUSALE = ',causale + d['causale']=causale + d['numero']=invoice.reference + d['data_doc']=invoice.date_invoice + for tax in invoice.tax_line: + #print '\tTAX: ',tax + d['aliquota']=tax.tax_code_id.name + d['imponibile']=tax.base + d['imposta']=tax.amount + res.append(d) + d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', } + return res -report_sxw.report_sxw('report.l10n_it.report.libroIVA_credito','account.report_libroiva', - 'l10n_it/report/libroIVA_credito.rml', - parser=l10n_chart_it_servabit_report_libroIVA_credito,header=False) +report_sxw.report_sxw('report.l10n_it.report.libroIVA_credito','account.report_libroiva', 'l10n_it/report/libroIVA_credito.rml', parser=l10n_chart_it_servabit_report_libroIVA_credito,header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_it/report/libroIVA_debito.py b/addons/l10n_it/report/libroIVA_debito.py index b6e38bf4f35..1a022424144 100755 --- a/addons/l10n_it/report/libroIVA_debito.py +++ b/addons/l10n_it/report/libroIVA_debito.py @@ -2,77 +2,72 @@ import time from report import report_sxw import pooler - class l10n_chart_it_servabit_report_libroIVA_debito(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(l10n_chart_it_servabit_report_libroIVA_debito,self).__init__(cr,uid,name,context) self.localcontext.update({ - 'time' : time, - 'get_company' : self.get_company, - 'get_periods' : self.get_periods, - 'get_lines' : self.get_lines, + 'time': time, + 'get_company': self.get_company, + 'get_periods': self.get_periods, + 'get_lines': self.get_lines, }) - def get_company(self,fiscal_year): - #print 'COMP = ',fiscal_year + #print 'COMP = ',fiscal_year return "" - def get_periods(self,fiscal_year): - #print 'Fiscal year id:',fiscal_year.id - obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') - fy=obj.browse(self.cr,self.uid,fiscal_year.id) - #print 'Periods = ',fy.period_ids - res=[rec for rec in fy.period_ids] - #return fy.periods => non funziona?!? bool object !?!? - return res + #print 'Fiscal year id:',fiscal_year.id + obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') + fy=obj.browse(self.cr,self.uid,fiscal_year.id) + #print 'Periods = ',fy.period_ids + res=[rec for rec in fy.period_ids] + #return fy.periods => non funziona?!? bool object !?!? + return res def get_invoices(self,period): - #print 'PERIOD = ',period.name - obj=pooler.get_pool(self.cr.dbname).get('account.invoice') - # Selezione tutte le fatture emesse nel periodo - self.cr.execute( """ - SELECT id FROM account_invoice - WHERE (state='open' OR state='paid') AND - period_id="""+str(period.id)+""" - AND (type='in_invoice' OR type='in_refund') - """) - ids=self.cr.fetchall() - #print 'IDS = ', - if ids: - ids=[id[0] for id in ids ] - invoices=obj.browse(self.cr,self.uid,ids) - #print 'INVOICES = ',invoices - return invoices + #print 'PERIOD = ',period.name + obj=pooler.get_pool(self.cr.dbname).get('account.invoice') + # Selezione tutte le fatture emesse nel periodo + self.cr.execute(""" + SELECT id FROM account_invoice + WHERE (state='open' OR state='paid') AND + period_id="""+str(period.id)+""" + AND (type='in_invoice' OR type='in_refund') + """) + ids=self.cr.fetchall() + #print 'IDS = ', + if ids: + ids=[id[0] for id in ids ] + invoices=obj.browse(self.cr,self.uid,ids) + #print 'INVOICES = ',invoices + return invoices def get_lines(self,fiscal_year): - res=[] - obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') - fy=obj_fy.browse(self.cr,self.uid,fiscal_year.id) - for period in fy.period_ids: - invoices=self.get_invoices(period) - for invoice in invoices: - d={'periodo': period.name} - d['protocollo']=invoice.number - #print 'PARTNER ',invoice.partner_id.name - causale=invoice.partner_id.name - #print 'CAUSALE = ',causale - d['causale']=causale - d['numero']=invoice.reference - d['data_doc']=invoice.date_invoice - for tax in invoice.tax_line: - #print '\tTAX: ',tax - d['aliquota']=tax.tax_code_id.name - d['imponibile']=tax.base - d['imposta']=tax.amount - res.append(d) - d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', } - return res + res=[] + obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear') + fy=obj_fy.browse(self.cr,self.uid,fiscal_year.id) + for period in fy.period_ids: + invoices=self.get_invoices(period) + for invoice in invoices: + d={'periodo': period.name} + d['protocollo']=invoice.number + #print 'PARTNER ',invoice.partner_id.name + causale=invoice.partner_id.name + #print 'CAUSALE = ',causale + d['causale']=causale + d['numero']=invoice.reference + d['data_doc']=invoice.date_invoice + for tax in invoice.tax_line: + #print '\tTAX: ',tax + d['aliquota']=tax.tax_code_id.name + d['imponibile']=tax.base + d['imposta']=tax.amount + res.append(d) + d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', } + return res -report_sxw.report_sxw('report.l10n_it.report.libroIVA_debito','account.report_libroiva', - 'l10n_it/report/libroIVA_debito.rml', - parser=l10n_chart_it_servabit_report_libroIVA_debito,header=False) +report_sxw.report_sxw('report.l10n_it.report.libroIVA_debito','account.report_libroiva', 'l10n_it/report/libroIVA_debito.rml', parser=l10n_chart_it_servabit_report_libroIVA_debito,header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From c0c5573c8cabc2af7094801fc6b08e8b602b0070 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 11 Nov 2010 19:10:23 +0530 Subject: [PATCH 23/65] [REF] Account: Code clean bzr revid: mra@mra-laptop-20101111134023-a3p5ha24ye0gu8zl --- addons/account/account_bank_statement.py | 2 +- addons/account/account_cash_statement.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 0b03f52a1e9..173f0651a90 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -454,4 +454,4 @@ class account_bank_statement_line(osv.osv): account_bank_statement_line() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index ffcc979169d..0f14fb77bb6 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -95,7 +95,7 @@ class account_cash_statement(osv.osv): @param arg: User defined arguments @return: Dictionary of values. """ - res ={} + res = {} for statement in self.browse(cr, uid, ids): amount_total = 0.0 for line in statement.ending_details_ids: @@ -110,7 +110,7 @@ class account_cash_statement(osv.osv): @param arg: User defined arguments @return: Dictionary of values. """ - res2={} + res2 = {} for statement in self.browse(cr, uid, ids): encoding_total=0.0 for line in statement.line_ids: @@ -297,7 +297,6 @@ class account_cash_statement(osv.osv): """ res = {} balance_start = 0.0 - if not journal_id: res.update({ 'balance_start': balance_start @@ -311,8 +310,7 @@ class account_cash_statement(osv.osv): statement.balance_end_real = statement.balance_end if statement.balance_end != statement.balance_end_cash: return False - else: - return True + return True def _user_allow(self, cr, uid, statement_id, context=None): return True From 405632bf50eabe873ce303008e0306408e7088a2 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 12 Nov 2010 09:53:07 +0530 Subject: [PATCH 24/65] [REF] Account_voucher: Code clean bzr revid: mra@mra-laptop-20101112042307-qqjnqqnzuxcsz8in --- addons/account_voucher/account_voucher.py | 29 ++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 8bd7b64f3f4..24bc8ca43c1 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -30,7 +30,7 @@ from tools.translate import _ class account_move_line(osv.osv): _inherit = 'account.move.line' - def _unreconciled(self, cr, uid, ids, prop, unknow_none, context): + def _unreconciled(self, cr, uid, ids, prop, unknow_none, context=None): res = {} for line in self.browse(cr, uid, ids, context=context): res[line.id] = line.debit - line.credit @@ -71,7 +71,7 @@ class account_voucher(osv.osv): res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1) return res and res[0] or False - def _get_tax(self, cr, uid, context={}): + def _get_tax(self, cr, uid, context=None): journal_pool = self.pool.get('account.journal') journal_id = context.get('journal_id', False) if not journal_id: @@ -207,14 +207,14 @@ class account_voucher(osv.osv): 'tax_id': _get_tax, } - def compute_tax(self, cr, uid, ids, context={}): + def compute_tax(self, cr, uid, ids, context=None): tax_pool = self.pool.get('account.tax') partner_pool = self.pool.get('res.partner') position_pool = self.pool.get('account.fiscal.position') voucher_line_pool = self.pool.get('account.voucher.line') voucher_pool = self.pool.get('account.voucher') - for voucher in voucher_pool.browse(cr, uid, ids, context): + for voucher in voucher_pool.browse(cr, uid, ids, context=context): voucher_amount = 0.0 for line in voucher.line_ids: voucher_amount += line.untax_amount or line.amount @@ -304,10 +304,10 @@ class account_voucher(osv.osv): due_date = terms[-1][0] default.update({ 'date_due':due_date - }) + }) return {'value':default} - def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context={}): + def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context=None): """price Returns a dict that contains new values and context @@ -318,12 +318,11 @@ class account_voucher(osv.osv): @return: Returns a dict which contains new values, and context """ default = { - 'value':{}, + 'value': {}, } if not partner_id or not journal_id: return default - partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') @@ -346,7 +345,6 @@ class account_voucher(osv.osv): vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context) default['value'].update(vals.get('value')) - return default def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, context=None): @@ -471,7 +469,7 @@ class account_voucher(osv.osv): return default - def onchange_date(self, cr, user, ids, date, context={}): + def onchange_date(self, cr, user, ids, date, context=None): """ @param date: latest value from user input for field date @param args: other arguments @@ -488,7 +486,7 @@ class account_voucher(osv.osv): } } - def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context={}): + def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None): if not journal_id: return False journal_pool = self.pool.get('account.journal') @@ -510,14 +508,14 @@ class account_voucher(osv.osv): self.action_move_line_create(cr, uid, ids, context=context) return True - def action_cancel_draft(self, cr, uid, ids, context={}): + def action_cancel_draft(self, cr, uid, ids, context=None): wf_service = netsvc.LocalService("workflow") for voucher_id in ids: wf_service.trg_create(uid, 'account.voucher', voucher_id, cr) self.write(cr, uid, ids, {'state':'draft'}) return True - def cancel_voucher(self, cr, uid, ids, context={}): + def cancel_voucher(self, cr, uid, ids, context=None): reconcile_pool = self.pool.get('account.move.reconcile') move_pool = self.pool.get('account.move') @@ -793,7 +791,7 @@ class account_voucher_line(osv.osv): 'name': '' } - def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}): + def onchange_move_line_id(self, cr, user, ids, move_line_id, context=None): """ Returns a dict that contains new values and context @@ -919,7 +917,6 @@ class account_bank_statement_line(osv.osv): 'amount_reconciled': fields.function(_amount_reconciled, string='Amount reconciled', method=True, type='float'), 'voucher_id': fields.many2one('account.voucher', 'Payment'), - } def unlink(self, cr, uid, ids, context=None): @@ -934,4 +931,4 @@ class account_bank_statement_line(osv.osv): account_bank_statement_line() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From bbe4a8a5ed605d54e8b6dc38ecd3ea706809774b Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 12 Nov 2010 11:05:58 +0530 Subject: [PATCH 25/65] [FIX] Account: Reserve and surplus account with good type in demo xml bzr revid: mra@mra-laptop-20101112053558-oc4o1j0ywa4yluvb --- addons/account/configurable_account_chart.xml | 2 +- addons/account/demo/account_minimal.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/configurable_account_chart.xml b/addons/account/configurable_account_chart.xml index d4abad7d924..dd9c01142c3 100644 --- a/addons/account/configurable_account_chart.xml +++ b/addons/account/configurable_account_chart.xml @@ -220,7 +220,7 @@ 1113 Reserve and Profit/Loss Account - payable + other diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index 01a14fbc4d0..f0f23f8d4e2 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -201,7 +201,7 @@ X1113 Reserve and Profit/Loss - (test) - payable + other From cb139f74c688c4a5100c7596f256b23e53dca34d Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Fri, 12 Nov 2010 14:15:51 +0530 Subject: [PATCH 26/65] [REF] l10n_*:Correct warning from buildbot bzr revid: ara@tinyerp.com-20101112084551-p31rh1c6g77c2lbk --- addons/l10n_cr/__openerp__.py | 14 +++++++------- addons/l10n_it/report/libroIVA_credito.py | 4 +--- addons/l10n_it/report/libroIVA_debito.py | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/addons/l10n_cr/__openerp__.py b/addons/l10n_cr/__openerp__.py index e826de5ebd0..9e1468ea798 100644 --- a/addons/l10n_cr/__openerp__.py +++ b/addons/l10n_cr/__openerp__.py @@ -40,12 +40,12 @@ 'website': 'http://clearcorp.co.cr', 'category': 'Localisation/Account Charts', 'description': """Chart of accounts for Costa Rica - Includes: - * account.type - * account.account.template - * account.tax.template - * account.tax.code.template - * account.chart.template +Includes: +* account.type +* account.account.template +* account.tax.template +* account.tax.code.template +* account.chart.template Everything is in English with Spanish translation. Further translations are welcome, please go to http://translations.launchpad.net/openerp-costa-rica @@ -60,7 +60,7 @@ http://translations.launchpad.net/openerp-costa-rica 'data/account_tax_code_template.xml', 'data/account_chart_template.xml', 'data/account_tax_template.xml', - 'l10n_wizard.xml' + 'l10n_wizard.xml', ], 'license': 'Other OSI approved licence', 'installable': True, diff --git a/addons/l10n_it/report/libroIVA_credito.py b/addons/l10n_it/report/libroIVA_credito.py index 7697d4d9033..d44573f03c1 100755 --- a/addons/l10n_it/report/libroIVA_credito.py +++ b/addons/l10n_it/report/libroIVA_credito.py @@ -33,9 +33,7 @@ class l10n_chart_it_servabit_report_libroIVA_credito(report_sxw.rml_parse): # Selezione tutte le fatture emesse nel periodo self.cr.execute(""" SELECT id FROM account_invoice - WHERE (state='open' OR state='paid') AND - period_id="""+str(period.id)+""" - AND (type='out_invoice' OR type='out_refund') + WHERE (state='open' OR state='paid') AND period_id="""+str(period.id)+""" AND (type='out_invoice' OR type='out_refund') """) ids=self.cr.fetchall() #print 'IDS = ', diff --git a/addons/l10n_it/report/libroIVA_debito.py b/addons/l10n_it/report/libroIVA_debito.py index 1a022424144..071a909ebfe 100755 --- a/addons/l10n_it/report/libroIVA_debito.py +++ b/addons/l10n_it/report/libroIVA_debito.py @@ -32,7 +32,7 @@ class l10n_chart_it_servabit_report_libroIVA_debito(report_sxw.rml_parse): # Selezione tutte le fatture emesse nel periodo self.cr.execute(""" SELECT id FROM account_invoice - WHERE (state='open' OR state='paid') AND + WHERE (state='open' OR state='paid') AND period_id="""+str(period.id)+""" AND (type='in_invoice' OR type='in_refund') """) From 67fa88dcb7556ef774391283b241cfef34337c5c Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 12 Nov 2010 16:32:41 +0530 Subject: [PATCH 27/65] [ADD] Account: confirm draft inovice wizard (missing due to multi=true attribute not given) bzr revid: mra@mra-laptop-20101112110241-8e0ulschm0t7lk1m --- .../account/wizard/account_invoice_state_view.xml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/addons/account/wizard/account_invoice_state_view.xml b/addons/account/wizard/account_invoice_state_view.xml index 8e9c04b788d..a1fd5dc3673 100644 --- a/addons/account/wizard/account_invoice_state_view.xml +++ b/addons/account/wizard/account_invoice_state_view.xml @@ -16,14 +16,11 @@ - - Confirm Draft Invoices - account.invoice.confirm - form - form - - new - + account.invoice.cancel.form From c09479219b6680b7bc85ad4578f6b9f05b00f083 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Fri, 12 Nov 2010 16:41:39 +0530 Subject: [PATCH 28/65] [FIX] account:add description on invoice as demo data in account payment term lp bug: https://launchpad.net/bugs/615522 fixed bzr revid: ara@tinyerp.com-20101112111139-frt0iol6b7v0mu4l --- addons/account/data/account_data2.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/data/account_data2.xml b/addons/account/data/account_data2.xml index 38bdd4b2b2c..165f7c32608 100644 --- a/addons/account/data/account_data2.xml +++ b/addons/account/data/account_data2.xml @@ -12,6 +12,7 @@ --> 30 Days End of Month + 30 Days End of Month 30 Days End of Month From ac2b77a5958076d999ebad7675bfaa125b8267d7 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 12 Nov 2010 18:45:46 +0530 Subject: [PATCH 29/65] [IMP] account_voucher: Implement writoff while validating vouchers bzr revid: psi@tinyerp.co.in-20101112131546-h8cqx7p5ogbwrhq8 --- addons/account_voucher/__openerp__.py | 1 + addons/account_voucher/account_voucher.py | 139 +++++++++++++++++- .../voucher_payment_receipt_view.xml | 4 +- addons/account_voucher/wizard/__init__.py | 1 + .../wizard/account_voucher_payment_option.py | 116 +++++++++++++++ .../wizard/account_voucher_payment_option.xml | 46 ++++++ 6 files changed, 302 insertions(+), 5 deletions(-) create mode 100644 addons/account_voucher/wizard/account_voucher_payment_option.py create mode 100644 addons/account_voucher/wizard/account_voucher_payment_option.xml diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index 6d6203d3d69..e7c75881ee9 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -43,6 +43,7 @@ "account_voucher_report.xml", "wizard/account_voucher_unreconcile_view.xml", "wizard/account_statement_from_invoice_view.xml", + "wizard/account_voucher_payment_option.xml", "account_voucher_view.xml", "voucher_payment_receipt_view.xml", "voucher_sales_purchase_view.xml", diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 8bd7b64f3f4..cc203a64d08 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -541,6 +541,38 @@ class account_voucher(osv.osv): self.write(cr, uid, ids, res) return True + def do_check(self, cr, uid, ids, context=None): + cur_obj = self.pool.get('res.currency') + mod_obj = self.pool.get('ir.model.data') + if context is None: + context = {} + voucher = self.browse(cr, uid, [ids[0]], context=context)[0] + debit= credit = 0.0 + if voucher.line_dr_ids: + for line in voucher.line_dr_ids: + debit += line.amount_original + if voucher.line_cr_ids: + for line in voucher.line_cr_ids: + credit += line.amount_original + if (voucher.amount + debit) != credit: + model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_account_voucher_pay_writeoff')], context=context) + resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] + context.update({'voucher_id': ids[0]}) + return { + 'name': _('Information addendum'), + 'context': context, + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_model': 'account.voucher.pay.writeoff', + 'views': [(resource_id, 'form')], + 'type': 'ir.actions.act_window', + 'target': 'new', + 'nodestroy': True + } + else: + self.action_move_line_create(cr, uid, ids, context=context) + return True + def unlink(self, cr, uid, ids, context=None): for t in self.read(cr, uid, ids, ['state'], context=context): if t['state'] not in ('draft', 'cancel'): @@ -568,7 +600,6 @@ class account_voucher(osv.osv): return {'value':res} def action_move_line_create(self, cr, uid, ids, context=None): - def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: @@ -648,7 +679,6 @@ class account_voucher(osv.osv): line_total = line_total - currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount) elif inv.type == 'purchase': line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount) - for line in inv.line_ids: if not line.amount: continue @@ -716,7 +746,6 @@ class account_voucher(osv.osv): else: account_id = inv.partner_id.property_account_payable.id move_line['account_id'] = account_id - move_line_pool.create(cr, uid, move_line) self.write(cr, uid, [inv.id], { @@ -730,6 +759,110 @@ class account_voucher(osv.osv): move_line_pool.reconcile_partial(cr, uid, rec_ids) return True + def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): + if context is None: + context = {} + seq_obj = self.pool.get('ir.sequence') + #TODO check if we can use different period for payment and the writeoff line + assert len(ids)==1, "Can only pay one voucher at a time" + voucher = self.browse(cr, uid, ids[0]) + if voucher.number: + name = voucher.number + elif voucher.journal_id.sequence_id: + name = seq_obj.get_id(cr, uid, voucher.journal_id.sequence_id.id) + else: + raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !')) + if not voucher.reference: + ref = name.replace('/','') + else: + ref = voucher.reference + + src_account_id = voucher.account_id.id + # Take the seq as name for move + types = {'sale': -1, 'purchase': 1, 'payment': 1, 'receipt': -1} + direction = types[voucher.type] + #take the choosen date + if 'date_p' in context and context['date_p']: + date = context['date_p'] + else: + date = time.strftime('%Y-%m-%d') + # Take the amount in currency and the currency of the payment + if 'amount_currency' in context and context['amount_currency'] and 'currency_id' in context and context['currency_id']: + amount_currency = context['amount_currency'] + currency_id = context['currency_id'] + else: + amount_currency = False + currency_id = False + pay_journal = self.pool.get('account.journal').read(cr, uid, pay_journal_id, ['type'], context=context) + if voucher.type in ('sale', 'receipt'): + if pay_journal['type'] == 'bank': + entry_type = 'bank_pay_voucher' # Bank payment + else: + entry_type = 'pay_voucher' # Cash payment + else: + entry_type = 'cont_voucher' + + # Pay attention to the sign for both debit/credit AND amount_currency + l1 = { + 'debit': direction * pay_amount>0 and direction * pay_amount, + 'credit': direction * pay_amount<0 and - direction * pay_amount, + 'account_id': src_account_id, + 'partner_id': voucher.partner_id.id, + 'ref':ref, + 'date': date, + 'currency_id':currency_id, + 'amount_currency':amount_currency and direction * amount_currency or 0.0, + 'company_id': voucher.company_id.id, + } + l2 = { + 'debit': direction * pay_amount<0 and - direction * pay_amount, + 'credit': direction * pay_amount>0 and direction * pay_amount, + 'account_id': pay_account_id, + 'partner_id': voucher.partner_id.id, + 'ref':ref, + 'date': date, + 'currency_id':currency_id, + 'amount_currency':amount_currency and - direction * amount_currency or 0.0, + 'company_id': voucher.company_id.id, + } + + if not name: + name = voucher.line_ids and voucher.line_ids[0].name or voucher.number + l1['name'] = name + l2['name'] = name + lines = [(0, 0, l1), (0, 0, l2)] + move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'name': name, 'date': date} + move_id = self.pool.get('account.move').create(cr, uid, move, context=context) + + line_ids = [] + total = 0.0 + line = self.pool.get('account.move.line') + move_ids = [move_id,] + if voucher.move_id: + move_ids.append(voucher.move_id.id) + cr.execute('SELECT id FROM account_move_line '\ + 'WHERE move_id IN %s', + ((move_id,),)) + lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) ) + for l in lines: + if l.account_id.id == src_account_id: + line_ids.append(l.id) + total += (l.debit or 0.0) - (l.credit or 0.0) + + voc_id, name = self.name_get(cr, uid, [voucher.id], context=context)[0] + if (not round(total,self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))) or writeoff_acc_id: + self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context) + else: + code = voucher.currency_id.code + # TODO: use currency's formatting function + msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining)") % \ + (name, pay_amount, code, voucher.amount_total, code, total, code) + self.log(cr, uid, voc_id, msg) + self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context) + # Update the stored value (fields.function), so we write to trigger recompute + self.write(cr, uid, ids, {'state':'posted'}, context=context) + return True + def copy(self, cr, uid, id, default={}, context=None): default.update({ 'state': 'draft', diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 83b6243a627..1fdb54f1edc 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -217,7 +217,7 @@