From f76eff791feaba895ca91f920d0cf3d83d3bd0df Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sat, 4 Dec 2010 15:40:37 +0200 Subject: [PATCH 01/12] hr_timesheet_invoice: fix yaml test refactored the pythonic code inside the yaml test to use a single browse object and made that "partner = ..." line really work bzr revid: p_christ@hol.gr-20101204134037-c5mjwehlxr443ogv --- .../test/test_hr_timesheet_invoice.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml index 39c2d9c6769..8dee90094ad 100644 --- a/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml +++ b/addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml @@ -44,14 +44,10 @@ I check that Invoice is created for this timesheet. - !python {model: account.analytic.line}: | - account_id = self.pool.get('account.analytic.line') - accounts = account_id.browse(cr, uid, [ref("account_analytic_line_developyamlforhrmodule0")])[0] - exp = self.browse(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')])[0] + aline = self.browse(cr, uid, ref('account_analytic_line_developyamlforhrmodule0')) analytic_account_obj = self.pool.get('account.analytic.account') data = self.pool.get('hr.timesheet.invoice.create').read(cr, uid, [ref("hr_timesheet_invoice_create_0")], [], context)[0] - account_ids = accounts['account_id'] - for account in analytic_account_obj.browse(cr, uid, account_ids, context): - partner = account.partner_id.id + partner = aline.account_id.partner_id.id invoice_obj = self.pool.get('account.invoice') invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)]) @@ -63,6 +59,10 @@ product_exp = data['product'] assert product == product_exp + assert aline.invoice_id, "Invoice created, but analytic line wasn't updated." + assert aline.invoice_id == invoice_id, "Invoice doesn't match the one at analytic line" + # The expected amount is hard coded here, please keep updated: + assert invoice_id.amount_untaxed == 187.5, "Invoice amount mismatch: %s" % invoice_id.amount_untaxed - I create final invoice for this analytic account. - From a1f84b2a4eccf7355f4e39d034bfd79f337ee69e Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 7 Dec 2010 15:36:14 +0200 Subject: [PATCH 02/12] l10n_fr: xml indent one report. bzr revid: p_christ@hol.gr-20101207133614-ajv5lqb3qzunjjv0 --- .../report/compute_resultant_report.rml | 653 +++++++++++++++++- 1 file changed, 651 insertions(+), 2 deletions(-) diff --git a/addons/l10n_fr/report/compute_resultant_report.rml b/addons/l10n_fr/report/compute_resultant_report.rml index de59b0201ee..c77be9534cb 100644 --- a/addons/l10n_fr/report/compute_resultant_report.rml +++ b/addons/l10n_fr/report/compute_resultant_report.rml @@ -1,3 +1,652 @@ -[[ _load('cdr',data['form'])]][[ _set_variable('ct1', cdrc1+cdrc2+cdrc3+cdrc4+cdrc5+cdrc6+cdrc7+cdrc8+cdrc9+cdrc10+cdrc11+cdrc12+cdrc13+cdrc14+cdrc15)]][[ _set_variable('ct3', cdrc17+cdrc18+cdrc19+cdrc20)]][[ _set_variable('ct4', cdrc21+cdrc22+cdrc23)]][[ _set_variable('charges', ct1+cdrc16+ct3+ct4+cdrc24+cdrc25)]][[ _set_variable('pta', cdrp1+cdrp2)]][[ _set_variable('ptb', cdrp3+cdrp4+cdrp5+cdrp6+cdrp7)]][[ _set_variable('pt1', pta+ptb)]][[ _set_variable('pt3', cdrp9+cdrp10+cdrp11+cdrp12+cdrp13+cdrp14)]][[ _set_variable('pt4', cdrp15+cdrp16+cdrp17)]][[ _set_variable('produits', pt1+cdrp8+pt3+pt4)]][[ company.name ]]période du [[ time.strftime('%d-%m-%Y',time.strptime(date_start,'%Y-%m-%d'))]] au [[ time.strftime('%d-%m-%Y',time.strptime(date_stop,'%Y-%m-%d'))]]Compte de résultatImprimé le : [[ time.strftime('%d-%m-%Y') ]] Tenue de Compte : [[ company.currency_id.name ]] CHARGES ( hors taxes ) CHARGES D'EXPLOITATION Achat de marchandises[[cdrc1]]Variation des stocks[[cdrc2]]Achats de matières premières et autres approvisionnements[[cdrc3]]Variation des stocks[[cdrc4]]Autres achats et charges externes[[cdrc5]]Redevances de crédit-bail mobilier[[cdrc6]]Redevances de crédit-bail immobilier[[cdrc7]]Impôts, taxes et versements assimilés[[cdrc8]]Salaires et traitements[[cdrc9]]Charges sociales[[cdrc10]]Dotation aux amortissements et aux dépréciations Sur immobilisations : dotations aux amortissements[[cdrc11]]Sur immobilisations : dotations aux dépréciations[[cdrc12]]Sur actif circulant : dotations aux dépréciations[[cdrc13]]Dotations aux provisions[[cdrc14]]Autres charges[[cdrc15]]TOTAL I[[ct1]]Quotes-parts de résultat sur opérations faites en commun ( II )[[cdrc16]]CHARGES FINANCIÈRES Dotations aux amortissements, aux dépréciations et aux provisions[[cdrc17]]Intérêts et charges assimilées[[cdrc18]]Différences négatives de change[[cdrc19]]Charges nettes sur cessions de valeurs mobilières de placement[[cdrc20]]TOTAL III[[ct3]]CHARGES EXCEPTIONNELLES Sur opérations de gestion[[cdrc21]]Sur opérations en capital[[cdrc22]]Dotations aux amortissements, aux dépréciations et aux provisions[[cdrc23]]TOTAL IV[[ct4]]Participation des salariés aux résultats ( V )[[cdrc24]]Impôts sur les bénéfices ( VI )[[cdrc25]]TOTAL CHARGES ( I + II + III + IV+ V+ VI )[[charges]] PRODUITS (hors taxes) PRODUITS D'EXPLOITATION Vente de marchandises[[cdrp1]]Production vendue [biens et services][[cdrp2]]Sous-total A - Montant net du chiffre d'affaires[[pta]]Production stockée[[cdrp3]]Production immobilisée[[cdrp4]]Subventions d'exploitation[[cdrp5]]Reprises sur provisions, dépréciations (et amortissements) et transferts de charges[[cdrp6]]Autres produits[[cdrp7]]Sous-total B[[ptb]]TOTAL I ( A + B )[[pt1]]Quotes-parts de résultat sur opérations faites en commun (II)[[cdrp8]]PRODUITS FINANCIERS De participation[[cdrp9]]D'autres valeurs mobilières et créances de l'actif immobilisé[[cdrp10]]Autres intérêts et produits assimilés[[cdrp11]]Reprises sur provisions, dépréciations et transferts de charges[[cdrp12]]Différences positives de change[[cdrp13]]Produits nets sur cessions de valeurs mobilières de placement[[cdrp14]]TOTAL III[[pt3]]PRODUITS EXCEPTIONNELS Sur opérations de gestion[[cdrp15]]Sur opérations en capital[[cdrp16]]Reprises sur provisions, dépréciations et transferts de charges[[cdrp17]]TOTAL IV[[pt4]]TOTAL DES PRODUITS ( I + II + III + IV )[[produits]]PRODUITS - CHARGES[[produits-charges]] - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ _load('cdr',data['form'])]] + [[ _set_variable('ct1', cdrc1+cdrc2+cdrc3+cdrc4+cdrc5+cdrc6+cdrc7+cdrc8+cdrc9+cdrc10+cdrc11+cdrc12+cdrc13+cdrc14+cdrc15)]] + [[ _set_variable('ct3', cdrc17+cdrc18+cdrc19+cdrc20)]] + [[ _set_variable('ct4', cdrc21+cdrc22+cdrc23)]] + [[ _set_variable('charges', ct1+cdrc16+ct3+ct4+cdrc24+cdrc25)]] + [[ _set_variable('pta', cdrp1+cdrp2)]] + [[ _set_variable('ptb', cdrp3+cdrp4+cdrp5+cdrp6+cdrp7)]] + [[ _set_variable('pt1', pta+ptb)]] + [[ _set_variable('pt3', cdrp9+cdrp10+cdrp11+cdrp12+cdrp13+cdrp14)]] + [[ _set_variable('pt4', cdrp15+cdrp16+cdrp17)]] + [[ _set_variable('produits', pt1+cdrp8+pt3+pt4)]] + + + + [[ company.name ]] + période du [[ time.strftime('%d-%m-%Y',time.strptime(date_start,'%Y-%m-%d'))]] au [[ time.strftime('%d-%m-%Y',time.strptime(date_stop,'%Y-%m-%d'))]] + + + Compte de résultat + + + Imprimé le : [[ time.strftime('%d-%m-%Y') ]] + + + + + + + + + + + + + + + Tenue de Compte : [[ company.currency_id.name ]] + + + + + + + + + + CHARGES ( hors taxes ) + + + + + + + + + + CHARGES D'EXPLOITATION + + + + + + + + + + Achat de marchandises + + + [[cdrc1]] + + + + + Variation des stocks + + + [[cdrc2]] + + + + + Achats de matières premières et autres approvisionnements + + + [[cdrc3]] + + + + + Variation des stocks + + + [[cdrc4]] + + + + + Autres achats et charges externes + + + [[cdrc5]] + + + + + Redevances de crédit-bail mobilier + + + [[cdrc6]] + + + + + Redevances de crédit-bail immobilier + + + [[cdrc7]] + + + + + Impôts, taxes et versements assimilés + + + [[cdrc8]] + + + + + Salaires et traitements + + + [[cdrc9]] + + + + + Charges sociales + + + [[cdrc10]] + + + + + Dotation aux amortissements et aux dépréciations + + + + + + + + + + Sur immobilisations : dotations aux amortissements + + + [[cdrc11]] + + + + + Sur immobilisations : dotations aux dépréciations + + + [[cdrc12]] + + + + + Sur actif circulant : dotations aux dépréciations + + + [[cdrc13]] + + + + + Dotations aux provisions + + + [[cdrc14]] + + + + + Autres charges + + + [[cdrc15]] + + + + + TOTAL I + + + [[ct1]] + + + + + Quotes-parts de résultat sur opérations faites en commun ( II ) + + + [[cdrc16]] + + + + + CHARGES FINANCIÈRES + + + + + + + + + + Dotations aux amortissements, aux dépréciations et aux provisions + + + [[cdrc17]] + + + + + Intérêts et charges assimilées + + + [[cdrc18]] + + + + + Différences négatives de change + + + [[cdrc19]] + + + + + Charges nettes sur cessions de valeurs mobilières de placement + + + [[cdrc20]] + + + + + TOTAL III + + + [[ct3]] + + + + + CHARGES EXCEPTIONNELLES + + + + + + + + + + Sur opérations de gestion + + + [[cdrc21]] + + + + + Sur opérations en capital + + + [[cdrc22]] + + + + + Dotations aux amortissements, aux dépréciations et aux provisions + + + [[cdrc23]] + + + + + TOTAL IV + + + [[ct4]] + + + + + Participation des salariés aux résultats ( V ) + + + [[cdrc24]] + + + + + Impôts sur les bénéfices ( VI ) + + + [[cdrc25]] + + + + + TOTAL CHARGES ( I + II + III + IV+ V+ VI ) + + + [[charges]] + + + + + + + + + + + + + + + + + PRODUITS (hors taxes) + + + + + + + + + + PRODUITS D'EXPLOITATION + + + + + + + + + + Vente de marchandises + + + [[cdrp1]] + + + + + Production vendue [biens et services] + + + [[cdrp2]] + + + + + Sous-total A - Montant net du chiffre d'affaires + + + [[pta]] + + + + + Production stockée + + + [[cdrp3]] + + + + + Production immobilisée + + + [[cdrp4]] + + + + + Subventions d'exploitation + + + [[cdrp5]] + + + + + Reprises sur provisions, dépréciations (et amortissements) et transferts de charges + + + [[cdrp6]] + + + + + Autres produits + + + [[cdrp7]] + + + + + Sous-total B + + + [[ptb]] + + + + + TOTAL I ( A + B ) + + + [[pt1]] + + + + + Quotes-parts de résultat sur opérations faites en commun (II) + + + [[cdrp8]] + + + + + PRODUITS FINANCIERS + + + + + + + + + + De participation + + + [[cdrp9]] + + + + + D'autres valeurs mobilières et créances de l'actif immobilisé + + + [[cdrp10]] + + + + + Autres intérêts et produits assimilés + + + [[cdrp11]] + + + + + Reprises sur provisions, dépréciations et transferts de charges + + + [[cdrp12]] + + + + + Différences positives de change + + + [[cdrp13]] + + + + + Produits nets sur cessions de valeurs mobilières de placement + + + [[cdrp14]] + + + + + TOTAL III + + + [[pt3]] + + + + + PRODUITS EXCEPTIONNELS + + + + + + + + + + Sur opérations de gestion + + + [[cdrp15]] + + + + + Sur opérations en capital + + + [[cdrp16]] + + + + + Reprises sur provisions, dépréciations et transferts de charges + + + [[cdrp17]] + + + + + TOTAL IV + + + [[pt4]] + + + + + TOTAL DES PRODUITS ( I + II + III + IV ) + + + [[produits]] + + + + + PRODUITS - CHARGES + + + [[produits-charges]] + + + + + + + + From f2e5b430006b96c2af38405480c7c93e720fc60c Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 7 Dec 2010 15:36:26 +0200 Subject: [PATCH 03/12] base_module_doc_rst: expand tabs at xml files. bzr revid: p_christ@hol.gr-20101207133626-6owfuexawo36v9sx --- .../base_module_doc_rst_view.xml | 38 +++++++++---------- .../base_module_doc_rst_wizard.xml | 24 ++++++------ 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/addons/base_module_doc_rst/base_module_doc_rst_view.xml b/addons/base_module_doc_rst/base_module_doc_rst_view.xml index 9a40bc86df3..2fa4e220d0d 100644 --- a/addons/base_module_doc_rst/base_module_doc_rst_view.xml +++ b/addons/base_module_doc_rst/base_module_doc_rst_view.xml @@ -1,25 +1,25 @@ - + - + - - ir.module.module.form.graph - ir.module.module - - form - - - - - - - - - + + ir.module.module.form.graph + ir.module.module + + form + + + + + + + + + - + diff --git a/addons/base_module_doc_rst/base_module_doc_rst_wizard.xml b/addons/base_module_doc_rst/base_module_doc_rst_wizard.xml index 2912dfed040..338791e29f1 100644 --- a/addons/base_module_doc_rst/base_module_doc_rst_wizard.xml +++ b/addons/base_module_doc_rst/base_module_doc_rst_wizard.xml @@ -2,21 +2,19 @@ + id="wiz_tech_guide_rst" + model="ir.module.module" + name="tech.guide.rst" + string="Create RST Technical Guide" + keyword="client_action_multi" + multi="True" /> + id="wiz_gen_graph" + model="ir.module.module" + name="create.relation.graph" + string="Generate Relationship Graph" + multi="False" /> From 082b1a587221371b7393f14c2a3210d1ee55e792 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 7 Dec 2010 15:36:35 +0200 Subject: [PATCH 04/12] l10n_uk: invalidate the certificate We cannot reuse the same certificate accross an addon rename. bzr revid: p_christ@hol.gr-20101207133635-ohzh39tdvnrtxp87 --- addons/l10n_uk/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_uk/__openerp__.py b/addons/l10n_uk/__openerp__.py index f8df66de02b..19b3e32b8d1 100644 --- a/addons/l10n_uk/__openerp__.py +++ b/addons/l10n_uk/__openerp__.py @@ -75,6 +75,6 @@ 'demo_xml': [], 'installable': True, 'active': False, - 'certificate': '0064392144797', + 'certificate': None # was '0064392144797', TODO: reissue new number } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From edb16c16de6918dac79099100a286f029397f998 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 7 Dec 2010 15:36:44 +0200 Subject: [PATCH 05/12] l10n_ro: fix the inherit of res.partner form Since it needs to supplement the "vat" field, it should reference the inherited "base_vat.view_partner_form" that introduces it, rather than the "base.view_partner_form" that doesn't have it. bzr revid: p_christ@hol.gr-20101207133644-0z0fc1b3h53u23fx --- addons/l10n_ro/partner_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_ro/partner_view.xml b/addons/l10n_ro/partner_view.xml index bd349dbb5fa..db98168bb09 100644 --- a/addons/l10n_ro/partner_view.xml +++ b/addons/l10n_ro/partner_view.xml @@ -3,7 +3,7 @@ res.partner.form.ro - + res.partner form From e37f0384f8048782e51c70cb7637aebc3b214eaf Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 7 Dec 2010 15:36:57 +0200 Subject: [PATCH 06/12] sale: pack the warning message in one string (i18n), allow utf8 [Bug 684616] As reported by Jacara, str(type_ul.name) would bork with unicode. In addition, the concatenated string would be harder to translate. bzr revid: p_christ@hol.gr-20101207133657-7tk732027zuj9whs --- addons/sale/sale.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 29826e1c293..66d7c1ac56a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1053,11 +1053,14 @@ class sale_order_line(osv.osv): q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom) # qty = qty - qty % q + q if qty and (q and not (qty % q) == 0): - ean = pack.ean + ean = pack.ean or _('(n/a)') qty_pack = pack.qty type_ul = pack.ul - warn_msg = _("You selected a quantity of %d Units.\nBut it's not compatible with the selected packaging.\nHere is a proposition of quantities according to the packaging: ") % (qty) - warn_msg = warn_msg + "\n\n" + _("EAN: ") + str(ean) + _(" Quantity: ") + str(qty_pack) + _(" Type of ul: ") + str(type_ul.name) + warn_msg = _("You selected a quantity of %d Units.\n" + "But it's not compatible with the selected packaging.\n" + "Here is a proposition of quantities according to the packaging:\n\n" + "EAN: %s Quantity: %s Type of ul: %s") % \ + (qty, ean, qty_pack, type_ul.name) warning = { 'title': _('Picking Information !'), 'message': warn_msg From 7c7586686d330e54f5efd881510eeea53d54f780 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 9 Dec 2010 10:19:04 +0100 Subject: [PATCH 07/12] [IMP] tools.misc: enabled Hebrew (he_IL) language bzr revid: odo@openerp.com-20101209091904-ytigf6ja7j65yx63 --- bin/tools/misc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 59230d5f141..b1d77446c87 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -954,6 +954,7 @@ def get_languages(): 'fr_FR': u'French / Français', 'gl_ES': u'Galician / Galego', 'gu_IN': u'Gujarati / ગુજરાતી', + 'he_IL': u'Hebrew / עִבְרִי', 'hi_IN': u'Hindi / हिंदी', 'hr_HR': u'Croatian / hrvatski jezik', 'hu_HU': u'Hungarian / Magyar', From 9daa68e67c17efbac26ece2a9e9d19df14ac439a Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 9 Dec 2010 11:57:33 +0100 Subject: [PATCH 08/12] [IMP] orm,base: added context to _constraints functions + use generic osv.osv.check_recursion() lp bug: https://launchpad.net/bugs/525808 fixed bzr revid: odo@openerp.com-20101209105733-j3uffwp4rl07nzc4 --- bin/addons/base/ir/ir_model.py | 4 ++-- bin/addons/base/ir/ir_rule.py | 2 +- bin/addons/base/ir/ir_ui_menu.py | 12 +----------- bin/addons/base/ir/ir_ui_view.py | 2 +- bin/addons/base/res/partner/partner.py | 14 ++------------ bin/addons/base/res/res_company.py | 12 +----------- bin/osv/orm.py | 6 +++--- 7 files changed, 11 insertions(+), 41 deletions(-) diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 583985b5930..80a24a45720 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -81,8 +81,8 @@ class ir_model(osv.osv): 'state': lambda self,cr,uid,ctx=None: (ctx and ctx.get('manual',False)) and 'manual' or 'base', } - def _check_model_name(self, cr, uid, ids): - for model in self.browse(cr, uid, ids): + def _check_model_name(self, cr, uid, ids, context=None): + for model in self.browse(cr, uid, ids, context=context): if model.state=='manual': if not model.model.startswith('x_'): return False diff --git a/bin/addons/base/ir/ir_rule.py b/bin/addons/base/ir/ir_rule.py index 657dc65a12a..f75528f6d47 100644 --- a/bin/addons/base/ir/ir_rule.py +++ b/bin/addons/base/ir/ir_rule.py @@ -47,7 +47,7 @@ class ir_rule(osv.osv): res[rule.id] = False return res - def _check_model_obj(self, cr, uid, ids, context={}): + def _check_model_obj(self, cr, uid, ids, context=None): return not any(isinstance(self.pool.get(rule.model_id.model), osv.osv_memory) for rule in self.browse(cr, uid, ids, context)) _columns = { diff --git a/bin/addons/base/ir/ir_ui_menu.py b/bin/addons/base/ir/ir_ui_menu.py index 43a5cb5bf76..800a3ede95a 100644 --- a/bin/addons/base/ir/ir_ui_menu.py +++ b/bin/addons/base/ir/ir_ui_menu.py @@ -257,16 +257,6 @@ class ir_ui_menu(osv.osv): return {} return {'type': {'icon_pict': 'picture'}, 'value': {'icon_pict': ('stock', (icon,'ICON_SIZE_MENU'))}} - def _check_recursion(self, cr, uid, ids): - level = 100 - while len(ids): - cr.execute('select distinct parent_id from ir_ui_menu where id IN %s',(tuple(ids),)) - ids = filter(None, map(lambda x:x[0], cr.fetchall())) - if not level: - return False - level -= 1 - return True - def read_image(self, path): path_info = path.split(',') icon_path = addons.get_module_resource(path_info[0],path_info[1]) @@ -318,7 +308,7 @@ class ir_ui_menu(osv.osv): return _('Error ! You can not create recursive Menu.') _constraints = [ - (_check_recursion, _rec_message , ['parent_id']) + (osv.osv._check_recursion, _rec_message , ['parent_id']) ] _defaults = { 'icon' : 'STOCK_OPEN', diff --git a/bin/addons/base/ir/ir_ui_view.py b/bin/addons/base/ir/ir_ui_view.py index 4c90e85a35c..059d441e245 100644 --- a/bin/addons/base/ir/ir_ui_view.py +++ b/bin/addons/base/ir/ir_ui_view.py @@ -28,7 +28,7 @@ import netsvc import os import logging -def _check_xml(self, cr, uid, ids, context={}): +def _check_xml(self, cr, uid, ids, context=None): logger = logging.getLogger('init') for view in self.browse(cr, uid, ids, context): eview = etree.fromstring(view.arch.encode('utf8')) diff --git a/bin/addons/base/res/partner/partner.py b/bin/addons/base/res/partner/partner.py index 8318a7602bf..04d5547973b 100644 --- a/bin/addons/base/res/partner/partner.py +++ b/bin/addons/base/res/partner/partner.py @@ -51,16 +51,6 @@ class res_partner_category(osv.osv): res = self.name_get(cr, uid, ids, context=context) return dict(res) - def _check_recursion(self, cr, uid, ids): - level = 100 - while len(ids): - cr.execute('select distinct parent_id from res_partner_category where id IN %s',(tuple(ids),)) - ids = filter(None, map(lambda x:x[0], cr.fetchall())) - if not level: - return False - level -= 1 - return True - _description='Partner Categories' _name = 'res.partner.category' _columns = { @@ -71,7 +61,7 @@ class res_partner_category(osv.osv): 'active' : fields.boolean('Active', help="The active field allows you to hide the category without removing it."), } _constraints = [ - (_check_recursion, 'Error ! You can not create recursive categories.', ['parent_id']) + (osv.osv._check_recursion, 'Error ! You can not create recursive categories.', ['parent_id']) ] _defaults = { 'active' : lambda *a: 1, @@ -149,7 +139,7 @@ class res_partner(osv.osv): def do_share(self, cr, uid, ids, *args): return True - def _check_ean_key(self, cr, uid, ids): + def _check_ean_key(self, cr, uid, ids, context=None): for partner_o in pooler.get_pool(cr.dbname).get('res.partner').read(cr, uid, ids, ['ean13',]): thisean=partner_o['ean13'] if thisean and thisean!='': diff --git a/bin/addons/base/res/res_company.py b/bin/addons/base/res/res_company.py index 098d8b9b50e..7361d1871d3 100644 --- a/bin/addons/base/res/res_company.py +++ b/bin/addons/base/res/res_company.py @@ -184,16 +184,6 @@ class res_company(osv.osv): except: return False - def _check_recursion(self, cr, uid, ids): - level = 100 - while len(ids): - cr.execute('select distinct parent_id from res_company where id IN %s',(tuple(ids),)) - ids = filter(None, map(lambda x:x[0], cr.fetchall())) - if not level: - return False - level -= 1 - return True - def _get_logo(self, cr, uid, ids): return open(os.path.join( tools.config['root_path'], '..', 'pixmaps', 'openerp-header.png'), @@ -280,7 +270,7 @@ class res_company(osv.osv): } _constraints = [ - (_check_recursion, 'Error! You can not create recursive companies.', ['parent_id']) + (osv.osv._check_recursion, 'Error! You can not create recursive companies.', ['parent_id']) ] res_company() diff --git a/bin/osv/orm.py b/bin/osv/orm.py index b66aa390e57..84b95d31661 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -4233,14 +4233,14 @@ class orm(orm_template): cr.execute(query + "WHERE ID IN %s", (tuple(ids),)) return cr.fetchone()[0] == len(ids) - def check_recursion(self, cr, uid, ids, parent=None): + def check_recursion(self, cr, uid, ids, context=None, parent=None): warnings.warn("You are using deprecated %s.check_recursion(). Please use the '_check_recursion()' instead!" % \ self._name, DeprecationWarning, stacklevel=3) assert parent is None or parent in self._columns or parent in self._inherit_fields,\ "The 'parent' parameter passed to check_recursion() must be None or a valid field name" - return self._check_recursion(cr, uid, ids, parent) + return self._check_recursion(cr, uid, ids, context, parent) - def _check_recursion(self, cr, uid, ids, parent=None): + def _check_recursion(self, cr, uid, ids, context=None, parent=None): """ Verifies that there is no loop in a hierarchical structure of records, by following the parent relationship using the **parent** field until a loop From a8a985eeccb0bdc5c6c10e1225b080caee2cf8f5 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Thu, 9 Dec 2010 12:05:10 +0100 Subject: [PATCH 09/12] [FIX] l10n_uk: set a new certificate number bzr revid: qdp-launchpad@tinyerp.com-20101209110510-n9rw0rfdlhhyttlr --- addons/l10n_uk/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_uk/__openerp__.py b/addons/l10n_uk/__openerp__.py index 19b3e32b8d1..f0898b63651 100644 --- a/addons/l10n_uk/__openerp__.py +++ b/addons/l10n_uk/__openerp__.py @@ -75,6 +75,6 @@ 'demo_xml': [], 'installable': True, 'active': False, - 'certificate': None # was '0064392144797', TODO: reissue new number + 'certificate': '8956603329629', } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 172c0cda3e4d5aa90436ccb6de7ede9ce92147c8 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Thu, 9 Dec 2010 12:57:12 +0100 Subject: [PATCH 10/12] [FIX] l10n_uk: set a valid certificate number bzr revid: qdp-launchpad@tinyerp.com-20101209115712-tg62m1j4h4wsqli5 --- addons/l10n_uk/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_uk/__openerp__.py b/addons/l10n_uk/__openerp__.py index f0898b63651..c84385ba1d3 100644 --- a/addons/l10n_uk/__openerp__.py +++ b/addons/l10n_uk/__openerp__.py @@ -75,6 +75,6 @@ 'demo_xml': [], 'installable': True, 'active': False, - 'certificate': '8956603329629', + 'certificate': '18956603329629', } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 47aae9553fa86da658168e95bbf9eabc49711d12 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 9 Dec 2010 17:39:18 +0530 Subject: [PATCH 11/12] [FIX] Account: account and account_financial_report - wrong selection condition on balance report lp bug: https://launchpad.net/bugs/582243 fixed bzr revid: mra@mra-laptop-20101209120918-zssimdszxldnx0v4 --- addons/account/report/account_balance.py | 5 +++-- addons/account/report/account_balance_sheet.py | 5 +++-- addons/account/report/account_profit_loss.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index f9697710f8f..45d7e107180 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -84,11 +84,12 @@ class account_balance(report_sxw.rml_parse, common_report_header): } self.sum_debit += account_rec['debit'] self.sum_credit += account_rec['credit'] + acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account') if disp_acc == 'bal_movement': - if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0: + if round(res['credit'], acc_digit) > 0 or round(res['debit'], acc_digit) > 0 or round(res['balance'], acc_digit) != 0: self.result_acc.append(res) elif disp_acc == 'bal_solde': - if res['balance'] != 0: + if round(res['balance'], acc_digit) != 0: self.result_acc.append(res) else: self.result_acc.append(res) diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py index b6f39fbbebd..0c280d2edfd 100644 --- a/addons/account/report/account_balance_sheet.py +++ b/addons/account/report/account_balance_sheet.py @@ -129,15 +129,16 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header) 'level': account.level, 'balance':account.balance, } + acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account') if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_dr += account.balance if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_cr += account.balance if data['form']['display_account'] == 'bal_movement': - if account.credit > 0 or account.debit > 0 or account.balance > 0: + if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0: accounts_temp.append(account_dict) elif data['form']['display_account'] == 'bal_solde': - if account.balance != 0: + if round(account.balance, acc_digit) != 0: accounts_temp.append(account_dict) else: accounts_temp.append(account_dict) diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py index 117f9e351fb..7c8248b8275 100644 --- a/addons/account/report/account_profit_loss.py +++ b/addons/account/report/account_profit_loss.py @@ -99,15 +99,16 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): accounts_temp = [] for account in accounts: if (account.user_type.report_type) and (account.user_type.report_type == typ): + acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account') if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_dr += abs(account.debit - account.credit) if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit): self.result_sum_cr += abs(account.debit - account.credit) if data['form']['display_account'] == 'bal_movement': - if account.credit > 0 or account.debit > 0 or account.balance > 0: + if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0: accounts_temp.append(account) elif data['form']['display_account'] == 'bal_solde': - if account.balance != 0: + if round(account.balance, acc_digit) != 0: accounts_temp.append(account) else: accounts_temp.append(account) From ca709f6ce807b488b0b1def5505433b4333651c4 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Thu, 9 Dec 2010 18:22:30 +0530 Subject: [PATCH 12/12] [FIX] sale: can't sort by customer in line to invoice lp bug: https://launchpad.net/bugs/681438 fixed bzr revid: mra@mra-laptop-20101209125230-nrzbkf1ap0h7izf2 --- 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 a21e494dae8..05a71edb065 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -889,7 +889,7 @@ class sale_order_line(osv.osv): \n* The \'Exception\' state is set when the related sale order is set as exception. \ \n* The \'Done\' state is set when the sale order line has been picked. \ \n* The \'Cancelled\' state is set when a user cancel the sale order related.'), - 'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer'), + 'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', store=True, string='Customer'), 'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', store=True, string='Salesman'), 'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft': [('readonly', False)]}), }