From f4fdbd27e44cb052a8e928f11a0b10a32ea4db41 Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 11:06:31 +0200
Subject: [PATCH 01/26] [FIX] account_analytic_analysis: '_analysis_all'
function: some ids were missing in the 'result' dict
bzr revid: olt@tinyerp.com-20101004090631-e61vtc4vh3r5gh47
---
.../account_analytic_analysis.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index 5a393e1dd83..e765989040b 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -66,6 +66,8 @@ class account_analytic_account(osv.osv):
and invoice_id is not null \
GROUP BY account_analytic_line.account_id;", (parent_ids,))
for account_id, sum in cr.fetchall():
+ if account_id not in res:
+ res[account_id] = {}
res[account_id][f] = sum
for account in accounts:
for child in account.child_ids:
@@ -102,6 +104,8 @@ class account_analytic_account(osv.osv):
and account_analytic_journal.type in ('purchase','general') \
GROUP BY account_analytic_account.id;""", (parent_ids,))
for account_id, sum in cr.fetchall():
+ if account_id not in res:
+ res[account_id] = {}
res[account_id][f] = round(sum, dp)
for account in accounts:
@@ -142,6 +146,8 @@ class account_analytic_account(osv.osv):
and invoice_id is null \
GROUP BY account_analytic_line.account_id" ,(parent_ids,))
for account_id, lwd in cr.fetchall():
+ if account_id not in res:
+ res[account_id] = {}
res[account_id][f] = lwd
for account in accounts:
for child in account.child_ids:
@@ -161,6 +167,8 @@ class account_analytic_account(osv.osv):
AND to_invoice IS NOT NULL \
GROUP BY account_analytic_line.account_id;",(parent_ids,))
for account_id, sua in cr.fetchall():
+ if account_id not in res:
+ res[account_id] = {}
res[account_id][f] = round(sua, dp)
for account in accounts:
for child in account.child_ids:
@@ -181,10 +189,14 @@ class account_analytic_account(osv.osv):
GROUP BY account_analytic_line.account_id",(parent_ids,))
ff = cr.fetchall()
for account_id, hq in ff:
+ if account_id not in res:
+ res[account_id] = {}
res[account_id][f] = round(hq, dp)
for account in accounts:
for child in account.child_ids:
if account.id != child.id:
+ if account.id not in res:
+ res[account.id] = {f: 0.0}
res[account.id][f] += res.get(child.id, {}).get(f, 0.0)
for id in ids:
res[id][f] = round(res[id][f], dp)
@@ -223,6 +235,8 @@ class account_analytic_account(osv.osv):
res2.setdefault(account.id, 0.0)
for child in account.child_ids:
if account.id != child.id:
+ if account.id not in res:
+ res[account.id] = {f: 0.0}
res[account.id][f] += res.get(child.id, {}).get(f, 0.0)
res[account.id][f] += res2.get(child.id, 0.0)
From 52915deaabebd1d592e522ac04930591c55d9aaf Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 12:05:30 +0200
Subject: [PATCH 02/26] [IMP] account_invoice_layout: performance improvement:
avoid 'name_get' in a loop
bzr revid: olt@tinyerp.com-20101004100530-mqyjcts4e10c7qln
---
.../account_invoice_layout.py | 25 +++++++++++--------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/addons/account_invoice_layout/account_invoice_layout.py b/addons/account_invoice_layout/account_invoice_layout.py
index adb80d787a0..2c2a02d4b9d 100644
--- a/addons/account_invoice_layout/account_invoice_layout.py
+++ b/addons/account_invoice_layout/account_invoice_layout.py
@@ -130,19 +130,22 @@ class account_invoice_line(osv.osv):
default['state'] = self.browse(cr, uid, id).state
return super(account_invoice_line, self).copy_data(cr, uid, id, default, context)
- def _fnct(self, cr, uid, id, name, args, context=None):
+ def _fnct(self, cr, uid, ids, name, args, context=None):
res = {}
- for m in self.browse(cr, uid, id):
- if m.state != 'article':
- if m.state == 'line':
- res[m.id] = '-----------------------------------------'
- elif m.state == 'break':
- res[m.id] = 'PAGE BREAK'
+
+ lines = self.browse(cr, uid, ids)
+ account_ids = [line.account_id.id for line in lines]
+ account_names = dict(self.pool.get('account.account').name_get(cr, uid, account_ids, context=context))
+ for line in lines:
+ if line.state != 'article':
+ if line.state == 'line':
+ res[line.id] = '-----------------------------------------'
+ elif line.state == 'break':
+ res[line.id] = 'PAGE BREAK'
else:
- res[m.id] = ' '
+ res[line.id] = ' '
else:
- [(temp)] = self.pool.get('account.account').name_get(cr, uid, [m.account_id.id], context=context)
- res[m.id] = temp[1]
+ res[line.id] = account_names.get(line.account_id.id, '')
return res
_name = "account.invoice.line"
@@ -205,4 +208,4 @@ class account_invoice(osv.osv):
account_invoice()
-# 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 471df158540c3c264b72b036116e7fca0cd316dd Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 12:57:07 +0200
Subject: [PATCH 03/26] [IMP] stock: 'inventory' and 'inventory (with child
locations)' now uses decimal.precision
bzr revid: olt@tinyerp.com-20101004105707-l4sw0f0k6jxhao9e
---
addons/stock/report/lot_overview.rml | 10 +++++-----
addons/stock/report/lot_overview_all.rml | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/addons/stock/report/lot_overview.rml b/addons/stock/report/lot_overview.rml
index f4332455cf9..cebacedeb01 100644
--- a/addons/stock/report/lot_overview.rml
+++ b/addons/stock/report/lot_overview.rml
@@ -167,10 +167,10 @@
[[formatLang( p['prod_qty']) ]] [[ p['uom'] ]]
@@ -209,4 +209,4 @@
-
\ No newline at end of file
+
From dfc45323ffd28e0416e11b24cb6fd822d2a1d090 Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 13:27:02 +0200
Subject: [PATCH 04/26] [IMP] sale_journal: 'picking journal' report now uses
decimal.precision
bzr revid: olt@tinyerp.com-20101004112702-w7wky190ntlexl7k
---
.../report/picking_journal_report.py | 50 ++++++++++---------
1 file changed, 26 insertions(+), 24 deletions(-)
diff --git a/addons/sale_journal/report/picking_journal_report.py b/addons/sale_journal/report/picking_journal_report.py
index 0b447f45cce..74c00367838 100644
--- a/addons/sale_journal/report/picking_journal_report.py
+++ b/addons/sale_journal/report/picking_journal_report.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,12 +15,14 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
##############################################################################
from osv import fields, osv
import tools
+from decimal_precision import decimal_precision as dp
+
class sale_journal_picking_report(osv.osv):
"""
@@ -30,32 +32,32 @@ class sale_journal_picking_report(osv.osv):
_description = "Picking lists"
_auto = False
_columns = {
- 'name': fields.char('Year', size=64, required=False, readonly=True),
- 'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'), ('05', 'May'), ('06', 'June'),
- ('07', 'July'), ('08', 'August'), ('09', 'September'), ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
+ 'name': fields.char('Year', size=64, required=False, readonly=True),
+ 'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'), ('05', 'May'), ('06', 'June'),
+ ('07', 'July'), ('08', 'August'), ('09', 'September'), ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'invoice_state':fields.selection([
- ("invoiced", "invoiced"),
- ("2binvoiced", "to be invoiced"),
+ ("invoiced", "invoiced"),
+ ("2binvoiced", "to be invoiced"),
("none", "None")
- ], "Invoice state", readonly=True),
+ ], "Invoice state", readonly=True),
'state': fields.selection([
- ('draft', 'draft'),
- ('auto', 'waiting'),
- ('confirmed', 'confirmed'),
- ('assigned', 'assigned'),
- ('done', 'done'),
- ('cancel', 'cancel'),
- ], 'State', readonly=True),
- 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
- 'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
- 'quantity': fields.float('Quantities', readonly=True),
- 'price_total': fields.float('Total Price', readonly=True),
- 'price_average': fields.float('Average Price', readonly=True),
- 'count': fields.integer('# of Lines', readonly=True),
+ ('draft', 'draft'),
+ ('auto', 'waiting'),
+ ('confirmed', 'confirmed'),
+ ('assigned', 'assigned'),
+ ('done', 'done'),
+ ('cancel', 'cancel'),
+ ], 'State', readonly=True),
+ 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
+ 'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
+ 'quantity': fields.float('Quantities', readonly=True),
+ 'price_total': fields.float('Total Price', readonly=True, digits_compute=dp.get_precision('Sale Price')),
+ 'price_average': fields.float('Average Price', readonly=True, digits_compute=dp.get_precision('Sale Price')),
+ 'count': fields.integer('# of Lines', readonly=True),
}
_order = 'journal_id, name desc, price_total desc'
-
+
def init(self, cr):
tools.drop_view_if_exists(cr, 'sale_journal_picking_report')
@@ -80,7 +82,7 @@ class sale_journal_picking_report(osv.osv):
order by s.invoice_type_id, s.invoice_state, s.state
)
""")
-
+
sale_journal_picking_report()
-# 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 5b4f3944f6d02dc842d97bc00c31af74fc5cc68b Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 13:30:10 +0200
Subject: [PATCH 05/26] [IMP] report_intrastat: 'intrastat' report now uses
decimal.precision
bzr revid: olt@tinyerp.com-20101004113010-dj6i5kvfce5jnt1z
---
addons/report_intrastat/report_intrastat.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/report_intrastat/report_intrastat.py b/addons/report_intrastat/report_intrastat.py
index 90c2884cceb..a77c4f5d389 100644
--- a/addons/report_intrastat/report_intrastat.py
+++ b/addons/report_intrastat/report_intrastat.py
@@ -21,6 +21,7 @@
from osv import osv, fields
from tools.sql import drop_view_if_exists
+from decimal_precision import decimal_precision as dp
class res_country(osv.osv):
@@ -69,7 +70,7 @@ class report_intrastat(osv.osv):
'code': fields.char('Country code', size=2, readonly=True),
'intrastat_id': fields.many2one('report.intrastat.code', 'Intrastat code', readonly=True),
'weight': fields.float('Weight', readonly=True),
- 'value': fields.float('Value', readonly=True),
+ 'value': fields.float('Value', readonly=True, digits_compute=dp.get_precision('Account')),
'type': fields.selection([('import', 'Import'), ('export', 'Export')], 'Type'),
'currency_id': fields.many2one('res.currency', "Currency", readonly=True),
}
From 4e18d14a2a1416ec50757032c02d9eff44b5c65c Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 13:33:09 +0200
Subject: [PATCH 06/26] [IMP] stock: 'inventory analysis' report now uses
decimal.precision
bzr revid: olt@tinyerp.com-20101004113309-p5c8o6lf906edmqi
---
addons/stock/report/report_stock_move.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py
index a96144060ca..a27e9f15202 100644
--- a/addons/stock/report/report_stock_move.py
+++ b/addons/stock/report/report_stock_move.py
@@ -21,6 +21,7 @@
import tools
from osv import fields,osv
+from decimal_precision import decimal_precision as dp
class report_stock_move(osv.osv):
@@ -44,7 +45,7 @@ class report_stock_move(osv.osv):
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True),
'product_qty_in':fields.integer('In Qty',readonly=True),
'product_qty_out':fields.integer('Out Qty',readonly=True),
- 'value' : fields.float('Total Value', required=True),
+ 'value' : fields.float('Total Value', required=True, digits_compute=dp.get_precision('Sale Price')),
'day_diff2':fields.float('Delay (Days)',readonly=True, digits=(16,2), group_operator="avg"),
'day_diff1':fields.float('Planned (Days)',readonly=True, digits=(16,2), group_operator="avg"),
'day_diff':fields.float('Real (Days)',readonly=True, digits=(16,2), group_operator="avg"),
From 8e1b7362c9acc00e6804f857e29a1d67142e1121 Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 13:37:37 +0200
Subject: [PATCH 07/26] [IMP] stock: 'inventory analysis' report now uses
decimal.precision
bzr revid: olt@tinyerp.com-20101004113737-rms5p1vbty6fdkj9
---
addons/stock/report/report_stock_move.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py
index a27e9f15202..6907f4ed3d5 100644
--- a/addons/stock/report/report_stock_move.py
+++ b/addons/stock/report/report_stock_move.py
@@ -137,7 +137,7 @@ class report_stock_inventory(osv.osv):
'prodlot_id': fields.many2one('stock.production.lot', 'Lot', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'product_qty':fields.float('Qty', digits=(16,2), readonly=True),
- 'value' : fields.float('Total Value', digits=(16,2), required=True),
+ 'value' : fields.float('Total Value', digits=(16,2), required=True, digits_compute=dp.get_precision('Sale Price')),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
\nThe state is \'Waiting\' if the move is waiting for another one.'),
From d51ad12b0c17318118198286a61d85c7813aa5aa Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 13:48:19 +0200
Subject: [PATCH 08/26] [FIX] mrp_repair: don't try to compare a date object
with a datetime object
bzr revid: olt@tinyerp.com-20101004114819-0b8xhsjytfxgll8t
---
addons/mrp_repair/mrp_repair.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py
index af88c32f42a..6cec29650f3 100644
--- a/addons/mrp_repair/mrp_repair.py
+++ b/addons/mrp_repair/mrp_repair.py
@@ -687,8 +687,9 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
if type == 'add':
stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
to_invoice = False
- if guarantee_limit and date.today() > datetime.strptime(guarantee_limit, '%Y-%m-%d'):
+ if guarantee_limit and datetime.strptime(date.today().strftime('%Y-%m-%d'), '%Y-%m-%d') > datetime.strptime(guarantee_limit, '%Y-%m-%d'):
to_invoice=True
+
return {'value': {
'to_invoice': to_invoice,
'location_id': stock_id,
From 3a378cef70d9591530f24e178937df2e39dc99c3 Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 13:52:15 +0200
Subject: [PATCH 09/26] [IMP] mrp_repair: 'Repair Quotation' report now uses
decimal.precision
bzr revid: olt@tinyerp.com-20101004115215-caqr9sv7jcdgduoy
---
addons/mrp_repair/report/order.py | 4 ++--
addons/mrp_repair/report/order.rml | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/addons/mrp_repair/report/order.py b/addons/mrp_repair/report/order.py
index 3d6f9200dd8..d6edc1f01e4 100644
--- a/addons/mrp_repair/report/order.py
+++ b/addons/mrp_repair/report/order.py
@@ -33,9 +33,9 @@ class order(report_sxw.rml_parse):
def total(self, repair):
total = 0.0
for operation in repair.operations:
- total+=operation.price_subtotal
+ total += operation.price_subtotal
for fee in repair.fees_lines:
- total+=fee.price_subtotal
+ total += fee.price_subtotal
total = total + repair.amount_tax
return total
diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml
index 149a2650bfd..328b5e931ee 100644
--- a/addons/mrp_repair/report/order.rml
+++ b/addons/mrp_repair/report/order.rml
@@ -343,7 +343,7 @@
Net Total :
- [[ formatLang(o.amount_untaxed)]] [[ o.pricelist_id.currency_id. symbol ]]
+ [[ formatLang(o.amount_untaxed, digits=get_digits(dp='Sale Price'))]] [[ o.pricelist_id.currency_id. symbol ]]
@@ -357,7 +357,7 @@
Taxes:
- [[ formatLang(o.amount_tax)]] [[ o.pricelist_id.currency_id. symbol ]]
+ [[ formatLang(o.amount_tax, digits=get_digits(dp='Account'))]] [[ o.pricelist_id.currency_id. symbol ]]
@@ -370,7 +370,7 @@
Total :
- [[ formatLang(total(o)) ]] [[ o.pricelist_id.currency_id. symbol ]]
+ [[ formatLang(total(o), digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id. symbol ]]
@@ -391,4 +391,4 @@
-
\ No newline at end of file
+
From fae903c3eea3f86513814a8051a68b0a0287b288 Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 14:18:31 +0200
Subject: [PATCH 10/26] [IMP] event:
* price fields now uses decimal.precision (Sale Price)
* removed 'Event Price'
bzr revid: olt@tinyerp.com-20101004121831-y91de9ed1km551yq
---
addons/event/event.py | 7 ++++---
addons/event/wizard/partner_event_registration.py | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/addons/event/event.py b/addons/event/event.py
index 7a6e904f6e3..ea4a9cf9b8b 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -28,6 +28,7 @@ import time
import tools
import decimal_precision as dp
+
class event_type(osv.osv):
""" Event Type """
_name = 'event.type'
@@ -225,7 +226,7 @@ class event_event(osv.osv):
'product_id': fields.many2one('product.product', 'Product', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="The invoices of this event registration will be created with this Product. Thus it allows you to set the default label and the accounting info you want by default on these invoices."),
'note': fields.text('Notes', help="Description or Summary of Event", readonly=False, states={'done': [('readonly', True)]}),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."),
- 'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify for each registration a specific amount if you want to"),
+ 'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify for each registration a specific amount if you want to", digits_compute=dp.get_precision('Sale Price')),
'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who are giving speech on event."),
'speaker_ids':fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}),
@@ -306,8 +307,8 @@ class event_registration(osv.osv):
'partner_id': fields.many2one('res.partner', 'Partner', states={'done': [('readonly', True)]}),
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
"contact_id": fields.many2one('res.partner.contact', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
- "unit_price": fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Event Price'), readonly=True, states={'draft': [('readonly', False)]}),
- 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute= dp.get_precision('Event Price')),
+ "unit_price": fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}),
+ 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute=dp.get_precision('Sale Price')),
"badge_ids": fields.one2many('event.registration.badge', 'registration_id', 'Badges', readonly=False, states={'done': [('readonly', True)]}),
"event_product": fields.char("Invoice Name", size=128, readonly=True, states={'draft': [('readonly', False)]}),
"tobe_invoiced": fields.boolean("To be Invoiced", readonly=True, states={'draft': [('readonly', False)]}),
diff --git a/addons/event/wizard/partner_event_registration.py b/addons/event/wizard/partner_event_registration.py
index 8462a812313..00f106ab8ae 100644
--- a/addons/event/wizard/partner_event_registration.py
+++ b/addons/event/wizard/partner_event_registration.py
@@ -24,6 +24,7 @@ import netsvc
import tools
from osv import fields, osv
from tools.translate import _
+from decimal_precision import decimal_precision as dp
class partner_event_registration(osv.osv_memory):
@@ -36,7 +37,7 @@ class partner_event_registration(osv.osv_memory):
_columns = {
'event_id': fields.many2one('event.event', 'Event'),
'event_type': fields.many2one('event.type', 'Type', readonly=True),
- 'unit_price': fields.float('Registration Cost'),
+ 'unit_price': fields.float('Registration Cost', digits_compute=dp.get_precision('Sale Price')),
'start_date': fields.datetime('Start date', required=True, help="Beginning Date of Event", readonly=True),
'end_date': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True),
'nb_register': fields.integer('Number of Registration'),
From 99c9ce6d5cdd4e498ac85eebed3bf161f40a9e6d Mon Sep 17 00:00:00 2001
From: "Omar(Pexego),Anup(OpenERP)" <>
Date: Mon, 4 Oct 2010 17:54:35 +0530
Subject: [PATCH 11/26] [FIX] base_calendar,caldav : SQL queries Corrected
lp bug: https://launchpad.net/bugs/654480 fixed
bzr revid: ach@tinyerp.com-20101004122435-vsisrowq9fkk6zv6
---
addons/base_calendar/base_calendar.py | 2 +-
addons/caldav/calendar.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index b71e2daa447..7ccd07351f0 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -724,7 +724,7 @@ true, it will allow you to hide the event alarm information without removing it.
if alarm_ids:
alarm_obj.unlink(cr, uid, alarm_ids)
cr.execute('Update %s set base_calendar_alarm_id=NULL, alarm_id=NULL\
- where id=%%d' % model_obj._table,(datas.id,))
+ where id=%%s' % model_obj._table,(datas.id,))
return True
res_alarm()
diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py
index bcc624d6a67..d22fa98f6e4 100644
--- a/addons/caldav/calendar.py
+++ b/addons/caldav/calendar.py
@@ -716,7 +716,7 @@ class basic_calendar_line(osv.osv):
"""
cr.execute("SELECT COUNT(id) FROM basic_calendar_lines \
- WHERE name='%s' AND calendar_id=%s",
+ WHERE name=%s AND calendar_id=%s",
(vals.get('name'), vals.get('calendar_id')))
res = cr.fetchone()
if res:
From 863f4f5d99e0823718aef0bb9e8454eb18c1508a Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 14:37:52 +0200
Subject: [PATCH 12/26] [FIX] marketing_campaign: 'campaign analysis' report
was wrongly placed in the 'association' module
bzr revid: olt@tinyerp.com-20101004123752-pmu9xq1sb5kjmzfl
---
addons/marketing_campaign/report/campaign_analysis_view.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/marketing_campaign/report/campaign_analysis_view.xml b/addons/marketing_campaign/report/campaign_analysis_view.xml
index aa994fcfc48..fd5a8c0908f 100644
--- a/addons/marketing_campaign/report/campaign_analysis_view.xml
+++ b/addons/marketing_campaign/report/campaign_analysis_view.xml
@@ -84,8 +84,8 @@
-
-
+
+
From 31b73b77e3de5527f8ffe841c2e1b8a4945b8349 Mon Sep 17 00:00:00 2001
From: "Anup (OpenERP)"
Date: Mon, 4 Oct 2010 18:36:05 +0530
Subject: [PATCH 13/26] [FIX] project_timesheet : variable reference corrected
lp bug: https://launchpad.net/bugs/653032 fixed
bzr revid: ach@tinyerp.com-20101004130605-iz181rxj15g5wjfs
---
addons/project_timesheet/project_timesheet.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py
index 411351f1be1..3c53cfe8630 100644
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -112,6 +112,7 @@ class project_work(osv.osv):
timesheet_obj = self.pool.get('hr.analytic.timesheet')
project_obj = self.pool.get('project.project')
uom_obj = self.pool.get('product.uom')
+ result = {}
if isinstance(ids, (long, int)):
ids = [ids,]
@@ -139,7 +140,7 @@ class project_work(osv.osv):
vals_line['unit_amount'] = vals['hours']
prod_id = vals_line.get('product_id', line_id.product_id.id) # False may be set
- if result['product_uom_id'] and (not result['product_uom_id'] == default_uom):
+ if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom):
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
# Compute based on pricetype
From e7dba666915be5f71f8e3382fbb169300294897a Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 15:10:19 +0200
Subject: [PATCH 14/26] [IMP] account_analytic_analysis, analytic,
hr_timesheet_invoice: some fields now uses decimal.precision
bzr revid: olt@tinyerp.com-20101004131019-0s1paonl2gbunsff
---
.../account_analytic_analysis.py | 59 ++++++++++++++-----
addons/analytic/analytic.py | 3 +-
.../report/report_analytic.py | 6 +-
3 files changed, 49 insertions(+), 19 deletions(-)
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index e765989040b..d9e9bf3907b 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -23,6 +23,8 @@ from osv import osv, fields
from osv.orm import intersect
import tools.sql
from tools.translate import _
+from decimal_precision import decimal_precision as dp
+
class account_analytic_account(osv.osv):
_name = "account.analytic.account"
@@ -351,22 +353,47 @@ class account_analytic_account(osv.osv):
return res
_columns ={
- 'ca_invoiced': fields.function(_ca_invoiced_calc, method=True, type='float', string='Invoiced Amount', help="Total customer invoiced amount for this account."),
- 'total_cost': fields.function(_total_cost_calc, method=True, type='float', string='Total Costs', help="Total of costs for this account. It includes real costs (from invoices) and indirect costs, like time spent on timesheets."),
- 'ca_to_invoice': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Amount', help="If invoice from analytic account, the remaining amount you can invoice to the customer based on the total costs."),
- 'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue', help="Based on the costs you had on the project, what would have been the revenue if all these costs have been invoiced at the normal sale price provided by the pricelist."),
- 'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot', help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."),
- 'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date', help="Date of the last invoice created for this analytic account."),
- 'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost', help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."),
- 'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work', help="Date of the latest work done on this account."),
- 'hours_qtt_non_invoiced': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Hours', help="Number of hours (from journal of type 'general') that can be invoiced if you invoice based on analytic account."),
- 'hours_qtt_invoiced': fields.function(_hours_qtt_invoiced_calc, method=True, type='float', string='Invoiced Hours', help="Number of hours that can be invoiced plus those that already have been invoiced."),
- 'remaining_hours': fields.function(_remaining_hours_calc, method=True, type='float', string='Remaining Hours', help="Computed using the formula: Maximum Quantity - Hours Tot."),
- 'remaining_ca': fields.function(_remaining_ca_calc, method=True, type='float', string='Remaining Revenue', help="Computed using the formula: Max Invoice Price - Invoiced Amount."),
- 'revenue_per_hour': fields.function(_revenue_per_hour_calc, method=True, type='float', string='Revenue per Hours (real)', help="Computed using the formula: Invoiced Amount / Hours Tot."),
- 'real_margin': fields.function(_real_margin_calc, method=True, type='float', string='Real Margin', help="Computed using the formula: Invoiced Amount - Total Costs."),
- 'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin', help="Computed using the formula: Theorial Revenue - Total Costs"),
- 'real_margin_rate': fields.function(_real_margin_rate_calc, method=True, type='float', string='Real Margin Rate (%)', help="Computes using the formula: (Real Margin / Total Costs) * 100."),
+ 'ca_invoiced': fields.function(_ca_invoiced_calc, method=True, type='float', string='Invoiced Amount',
+ help="Total customer invoiced amount for this account.",
+ digits_compute=dp.get_precision('Account')),
+ 'total_cost': fields.function(_total_cost_calc, method=True, type='float', string='Total Costs',
+ help="Total of costs for this account. It includes real costs (from invoices) and indirect costs, like time spent on timesheets.",
+ digits_compute=dp.get_precision('Account')),
+ 'ca_to_invoice': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Amount',
+ help="If invoice from analytic account, the remaining amount you can invoice to the customer based on the total costs.",
+ digits_compute=dp.get_precision('Account')),
+ 'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue',
+ help="Based on the costs you had on the project, what would have been the revenue if all these costs have been invoiced at the normal sale price provided by the pricelist.",
+ digits_compute=dp.get_precision('Account')),
+ 'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot',
+ help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."),
+ 'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date',
+ help="Date of the last invoice created for this analytic account."),
+ 'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost',
+ help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."),
+ 'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work',
+ help="Date of the latest work done on this account."),
+ 'hours_qtt_non_invoiced': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Uninvoiced Hours',
+ help="Number of hours (from journal of type 'general') that can be invoiced if you invoice based on analytic account."),
+ 'hours_qtt_invoiced': fields.function(_hours_qtt_invoiced_calc, method=True, type='float', string='Invoiced Hours',
+ help="Number of hours that can be invoiced plus those that already have been invoiced."),
+ 'remaining_hours': fields.function(_remaining_hours_calc, method=True, type='float', string='Remaining Hours',
+ help="Computed using the formula: Maximum Quantity - Hours Tot."),
+ 'remaining_ca': fields.function(_remaining_ca_calc, method=True, type='float', string='Remaining Revenue',
+ help="Computed using the formula: Max Invoice Price - Invoiced Amount.",
+ digits_compute=dp.get_precision('Account')),
+ 'revenue_per_hour': fields.function(_revenue_per_hour_calc, method=True, type='float', string='Revenue per Hours (real)',
+ help="Computed using the formula: Invoiced Amount / Hours Tot.",
+ digits_compute=dp.get_precision('Account')),
+ 'real_margin': fields.function(_real_margin_calc, method=True, type='float', string='Real Margin',
+ help="Computed using the formula: Invoiced Amount - Total Costs.",
+ digits_compute=dp.get_precision('Account')),
+ 'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin',
+ help="Computed using the formula: Theorial Revenue - Total Costs",
+ digits_compute=dp.get_precision('Account')),
+ 'real_margin_rate': fields.function(_real_margin_rate_calc, method=True, type='float', string='Real Margin Rate (%)',
+ help="Computes using the formula: (Real Margin / Total Costs) * 100.",
+ digits_compute=dp.get_precision('Account')),
'month_ids': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
'user_ids': fields.function(_analysis_all, method=True, multi='analytic_analysis', type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
}
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index cf96028f01c..66c74a72bc9 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -25,6 +25,7 @@ import operator
from osv import fields, osv
import decimal_precision as dp
+
class account_analytic_account(osv.osv):
_name = 'account.analytic.account'
_description = 'Analytic Account'
@@ -272,7 +273,7 @@ class account_analytic_line(osv.osv):
_columns = {
'name' : fields.char('Description', size=256, required=True),
'date' : fields.date('Date', required=True, select=1),
- 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.'),
+ 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')),
'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'),
'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True),
'user_id' : fields.many2one('res.users', 'User'),
diff --git a/addons/hr_timesheet_invoice/report/report_analytic.py b/addons/hr_timesheet_invoice/report/report_analytic.py
index 0b3d1440f23..d2db7fd4027 100644
--- a/addons/hr_timesheet_invoice/report/report_analytic.py
+++ b/addons/hr_timesheet_invoice/report/report_analytic.py
@@ -21,6 +21,8 @@
from osv import fields,osv
import tools
+from decimal_precision import decimal_precision as dp
+
class report_analytic_account_close(osv.osv):
_name = "report.analytic.account.close"
@@ -70,8 +72,8 @@ class report_account_analytic_line_to_invoice(osv.osv):
'account_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True),
'product_uom_id':fields.many2one('product.uom', 'UoM', readonly=True),
'unit_amount': fields.float('Units', readonly=True),
- 'sale_price': fields.float('Sale price', readonly=True),
- 'amount': fields.float('Amount', readonly=True),
+ 'sale_price': fields.float('Sale price', readonly=True, digits_compute=dp.get_precision('Sale Price')),
+ 'amount': fields.float('Amount', readonly=True, digits_compute=dp.get_precision('Account')),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
}
From f4927a835d95f1f943594612c3a3d45c629ef50b Mon Sep 17 00:00:00 2001
From: "Anup (OpenERP)"
Date: Mon, 4 Oct 2010 19:21:01 +0530
Subject: [PATCH 15/26] [REF] stock : Product typo changed.
lp bug: https://launchpad.net/bugs/648607 fixed
bzr revid: ach@tinyerp.com-20101004135101-2orb2lzrhpg1nigg
---
addons/stock/product.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/stock/product.py b/addons/stock/product.py
index 790b50c45b3..19b6570a31a 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -318,7 +318,7 @@ class product_product(osv.osv):
'track_outgoing': fields.boolean('Track Outgoing Lots', help="Forces to specify a Production Lot for all moves containing this product and going to a Customer Location"),
'location_id': fields.dummy(string='Stock Location', relation='stock.location', type='many2one'),
'valuation':fields.selection([('manual_periodic', 'Periodic (manual)'),
- ('real_time','Real Time (automatized)'),], 'Stock Valuation', help="Decide if the system must automatically creates account moves based on stock moves", required=True),
+ ('real_time','Real Time (automatized)'),], 'Stock Valuation', help="Decide if the system must automatically create account moves based on stock moves", required=True),
}
_defaults = {
From ae562e1b6a29c9bf617e37e14ae365e7e4259d79 Mon Sep 17 00:00:00 2001
From: "olt@tinyerp.com" <>
Date: Mon, 4 Oct 2010 17:13:03 +0200
Subject: [PATCH 16/26] [FIX] point_of_sale: 'account_statement' report: method
'get_data' was missing [IMP] point_of_sale: 'account_statement' report now
uses decimal.precision
bzr revid: olt@tinyerp.com-20101004151303-k32qnknzuczn3t95
---
addons/point_of_sale/report/account_statement.py | 11 +++++++++++
addons/point_of_sale/report/account_statement.rml | 13 +++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/addons/point_of_sale/report/account_statement.py b/addons/point_of_sale/report/account_statement.py
index 391adb7569f..dc492651bb2 100644
--- a/addons/point_of_sale/report/account_statement.py
+++ b/addons/point_of_sale/report/account_statement.py
@@ -31,10 +31,21 @@ class account_statement(report_sxw.rml_parse):
self.localcontext.update({
'time': time,
'get_total':self._get_total,
+ 'get_data':self._get_data,
})
+
+ def _get_data(self, statement):
+ lines = []
+ for line in statement.line_ids:
+ lines.append(line)
+
+ return lines
+
def _get_total(self, statement_line_ids):
total = 0.0
for line in statement_line_ids:
total += line.amount
return total
+
report_sxw.report_sxw('report.account.statement', 'account.bank.statement', 'addons/statement/report/account_statement.rml', parser=account_statement,header='internal')
+
diff --git a/addons/point_of_sale/report/account_statement.rml b/addons/point_of_sale/report/account_statement.rml
index e4c3b99b6ee..ed26143aa4e 100644
--- a/addons/point_of_sale/report/account_statement.rml
+++ b/addons/point_of_sale/report/account_statement.rml
@@ -216,10 +216,10 @@
[[ formatLang(statement.closing_date,date=True) ]]