From ffacce7140f22a90a46d8819274fedfc7c86c88e Mon Sep 17 00:00:00 2001 From: Ravi Gohil Date: Tue, 30 Dec 2014 18:24:14 +0530 Subject: [PATCH 01/10] [FIX] orm: export on empty one2many When exporting the content of a one2many, if the first row got an empty value, it was filled with the name_get of all lines and skipped the next lines. The guessed reason of this was for the representation of the m2m lines but was left after a proper export of m2m has been implemented (91cafbe). This code was problematic as it prevented to properly export records with an empty value on the first line (e.g. credit amount on account.move.line). Fixes #4218, opw 620178 --- openerp/osv/orm.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index f0cec27b2cd..9cd5d1dcb8f 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -1215,17 +1215,6 @@ class BaseModel(object): for fpos2 in range(len(fields)): if lines2 and lines2[0][fpos2]: data[fpos2] = lines2[0][fpos2] - if not data[fpos]: - dt = '' - for rr in r: - name_relation = self.pool.get(rr._table_name)._rec_name - if isinstance(rr[name_relation], browse_record): - rr = rr[name_relation] - rr_name = self.pool.get(rr._table_name).name_get(cr, uid, [rr.id], context=context) - rr_name = rr_name and rr_name[0] and rr_name[0][1] or '' - dt += tools.ustr(rr_name or '') + ',' - data[fpos] = dt[:-1] - break lines += lines2[1:] first = False else: From 56c95d28439f0829a52ebd879719d29751a7cdbd Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 7 Apr 2015 18:33:48 +0200 Subject: [PATCH 02/10] [FIX] report_sxw: setLang() should discard browse_record cache `setLang` alters the "browse" context of the documents being printed, but it must also discard any values already cached, as they could be using a different language. This is the case when the report uses translatable fields on `res.partner`, because `setLang` is usually called with the target partner language, hence prefetching the translatable fields with the user's language instead of the partner's language. E.g. `setLang(o.partner_id.lang)` will cache any translatable field on `o.partner_id` in the language of the *user*, not the *partner*. --- openerp/report/report_sxw.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/report/report_sxw.py b/openerp/report/report_sxw.py index 9f0f62b07f5..c0260656133 100644 --- a/openerp/report/report_sxw.py +++ b/openerp/report/report_sxw.py @@ -234,6 +234,7 @@ class rml_parse(object): self.localcontext['lang'] = lang self.lang_dict_called = False for obj in self.objects: + obj.refresh() obj._context['lang'] = lang def _get_lang_dict(self): From c09095cbc9c22a5ebedbedaca957a6d9ff72809f Mon Sep 17 00:00:00 2001 From: Somesh Khare Date: Fri, 12 Dec 2014 15:30:19 +0530 Subject: [PATCH 03/10] [FiX] sale(_stock): missing state on report The state 'Quotation Sent' was not visible on the sales analysis report (e.g. group by Status). Add the missing state to the report to correctly disaply it. opw 619748 --- addons/sale/report/sale_report.py | 1 + addons/sale_stock/report/sale_report.py | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index c914aba7bf6..dd7aa19bbd3 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -49,6 +49,7 @@ class sale_report(osv.osv): 'nbr': fields.integer('# of Lines', readonly=True), 'state': fields.selection([ ('draft', 'Quotation'), + ('sent', 'Quotation Sent'), ('waiting_date', 'Waiting Schedule'), ('manual', 'Manual In Progress'), ('progress', 'In Progress'), diff --git a/addons/sale_stock/report/sale_report.py b/addons/sale_stock/report/sale_report.py index b7936ffe7b4..9f5df0fc65c 100644 --- a/addons/sale_stock/report/sale_report.py +++ b/addons/sale_stock/report/sale_report.py @@ -29,6 +29,7 @@ class sale_report(osv.osv): 'shipped_qty_1': fields.integer('Shipped', readonly=True), 'state': fields.selection([ ('draft', 'Quotation'), + ('sent', 'Quotation Sent'), ('waiting_date', 'Waiting Schedule'), ('manual', 'Manual In Progress'), ('progress', 'In Progress'), From 7b7b0d148a4d25179596829a82238e6fb06f95d8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 8 Apr 2015 14:35:39 +0200 Subject: [PATCH 04/10] [FIX] sale_margin: purchase price calculated using the currency of the price type When the margin is calculated, the purchase price is calculated using the currency of the price type 'standard_price' instead of the currency of the company, since they can be different. opw: 631884 --- addons/sale_margin/sale_margin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py index 96031db1f3c..ebe00221c83 100644 --- a/addons/sale_margin/sale_margin.py +++ b/addons/sale_margin/sale_margin.py @@ -37,7 +37,7 @@ class sale_order_line(osv.osv): to_cur = self.pool.get('product.pricelist').browse(cr, uid, [pricelist])[0].currency_id.id if product: product = self.pool['product.product'].browse(cr, uid, product, context=context) - purchase_price = product.standard_price + purchase_price = product.price_get(ptype='standard_price', context=dict(context, currency_id=to_cur))[product.id] to_uom = res.get('product_uom', uom) if to_uom != product.uom_id.id: purchase_price = self.pool['product.uom']._compute_price(cr, uid, product.uom_id.id, purchase_price, to_uom) From 0b684b950f45067bb7f322c930be0b80171a7a5f Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 9 Apr 2015 10:18:12 +0200 Subject: [PATCH 05/10] [FIX] mrp_operations: missing params in overriding methods The context wasn't defined in the below methods: - action_production_end - action_in_production while it is defined in the base methods, in the mrp module. This doesn't lead to any issue in standard modules, but it prevents to correctly override these methods within custom modules when mrp_operations is installed. opw-632425 --- addons/mrp_operations/mrp_operations.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index d31adf9a94f..d841e344a9e 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -223,7 +223,7 @@ class mrp_production(osv.osv): result[prod.id] = max(line.date_planned_end, result[prod.id]) return result - def action_production_end(self, cr, uid, ids): + def action_production_end(self, cr, uid, ids, context=None): """ Finishes work order if production order is done. @return: Super method """ @@ -233,9 +233,9 @@ class mrp_production(osv.osv): if workcenter_line.state == 'draft': wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_start_working', cr) wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_done', cr) - return super(mrp_production,self).action_production_end(cr, uid, ids) + return super(mrp_production,self).action_production_end(cr, uid, ids, context=context) - def action_in_production(self, cr, uid, ids): + def action_in_production(self, cr, uid, ids, context=None): """ Changes state to In Production and writes starting date. @return: True """ @@ -245,7 +245,7 @@ class mrp_production(osv.osv): for prod in self.browse(cr, uid, ids): if prod.workcenter_lines: wf_service.trg_validate(uid, 'mrp.production.workcenter.line', prod.workcenter_lines[0].id, 'button_start_working', cr) - return super(mrp_production,self).action_in_production(cr, uid, ids) + return super(mrp_production,self).action_in_production(cr, uid, ids, context=context) def action_cancel(self, cr, uid, ids, context=None): """ Cancels work order if production order is canceled. From 4ba72fbacb307ab6071a9ac91474b9fef8b926ad Mon Sep 17 00:00:00 2001 From: Akash Balar Date: Tue, 25 Nov 2014 15:32:55 +0530 Subject: [PATCH 06/10] [FIX] stock: reset date_done field at duplication As the state is reset to draft, makes no sense to keep date of completion. --- addons/stock/stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 1d38265a71c..998109635bc 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -725,6 +725,7 @@ class stock_picking(osv.osv): default.setdefault('backorder_id', False) if 'invoice_state' not in default and picking_obj.invoice_state == 'invoiced': default['invoice_state'] = '2binvoiced' + default.setdefault('date_done', False) res = super(stock_picking, self).copy(cr, uid, id, default, context) return res From ee57fbb0225e67cebb9a69d8e0c9c8d08f42e327 Mon Sep 17 00:00:00 2001 From: J Bradshaw Date: Mon, 30 Mar 2015 15:33:30 +0100 Subject: [PATCH 07/10] [FIX] README: Fix URL and spelling Closes #6049 opw-632480 --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 9449819d766..19afb8f46c3 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ Installation on Debian/Ubuntu Add the the apt repository - deb http://nightly.openerp.com/6.1/deb/ ./ + deb http://nightly.odoo.com/7.0/nightly/deb/ ./ in your source.list and type: @@ -44,8 +44,8 @@ Installation on Windows Installation on MacOSX ----------------------- -Setuping you first database ---------------------------- +Setting up your first database +------------------------------ Point your browser to http://localhost:8069/ and click "Manage Databases", the default master password is "admin". From 2a3ce719bc9ad8e386867ba2019c27a0f49a11b9 Mon Sep 17 00:00:00 2001 From: Rucha Dave Date: Wed, 26 Nov 2014 15:25:30 +0530 Subject: [PATCH 08/10] [FIX] delivery: do not use canceled lines in weight computation Canceling a line on a delivery order was not updating the weight of the package. opw 618532 --- addons/delivery/stock.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py index 21c0f90e543..2a452ce1649 100644 --- a/addons/delivery/stock.py +++ b/addons/delivery/stock.py @@ -35,8 +35,9 @@ class stock_picking(osv.osv): total_weight = total_weight_net = 0.00 for move in picking.move_lines: - total_weight += move.weight - total_weight_net += move.weight_net + if move.state != 'cancel': + total_weight += move.weight + total_weight_net += move.weight_net res[picking.id] = { 'weight': total_weight, @@ -57,12 +58,12 @@ class stock_picking(osv.osv): 'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight', store={ 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20), - 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20), + 'stock.move': (_get_picking_line, ['state','product_id','product_qty','product_uom','product_uos_qty'], 20), }), 'weight_net': fields.function(_cal_weight, type='float', string='Net Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight', store={ 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20), - 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20), + 'stock.move': (_get_picking_line, ['state','product_id','product_qty','product_uom','product_uos_qty'], 20), }), 'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32), 'number_of_packages': fields.integer('Number of Packages'), From 39010d38567a4d679cbdb8c0e21cffec6c3bb6b0 Mon Sep 17 00:00:00 2001 From: Somesh Khare Date: Fri, 21 Nov 2014 10:46:35 +0530 Subject: [PATCH 09/10] [FIX] account: wrong amount for tax included Backport of 8.0 code, rev f61339b Create a new journal item with an tax included, the automatically created tax line had the amount computed as tax excluded. Fixes #3731, opw 618305 --- addons/account/account_move_line.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index e79fde1df8f..9287ed239c4 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1246,15 +1246,23 @@ class account_move_line(osv.osv): base_sign = 'base_sign' tax_sign = 'tax_sign' tmp_cnt = 0 - for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=True).get('taxes'): + for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=False).get('taxes'): #create the base movement if tmp_cnt == 0: if tax[base_code]: tmp_cnt += 1 - self.write(cr, uid,[result], { + if tax_id.price_include: + total = tax['price_unit'] + newvals = { 'tax_code_id': tax[base_code], - 'tax_amount': tax[base_sign] * abs(total) - }) + 'tax_amount': tax[base_sign] * abs(total), + } + if tax_id.price_include: + if tax['price_unit'] < 0: + newvals['credit'] = abs(tax['price_unit']) + else: + newvals['debit'] = tax['price_unit'] + self.write(cr, uid, [result], newvals, context=context) else: data = { 'move_id': vals['move_id'], From 856bc6f2b147970245f96e26d882f114c32e035c Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 10 Apr 2015 17:15:50 +0200 Subject: [PATCH 10/10] [FIX] apply same visibility rules as base --- addons/auth_crypt/auth_crypt.py | 3 ++- openerp/addons/base/res/res_users.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/auth_crypt/auth_crypt.py b/addons/auth_crypt/auth_crypt.py index c5bd5799017..a7e3a826223 100644 --- a/addons/auth_crypt/auth_crypt.py +++ b/addons/auth_crypt/auth_crypt.py @@ -22,6 +22,8 @@ _logger = logging.getLogger(__name__) magic_md5 = '$1$' magic_sha256 = '$5$' +openerp.addons.base.res.res_users.USER_PRIVATE_FIELDS.append('password_crypt') + def gen_salt(length=8, symbols=None): if symbols is None: symbols = ascii_letters + digits @@ -173,5 +175,4 @@ class res_users(osv.osv): # Reraise password incorrect raise - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index 1dcae1f657e..c678deff47f 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -34,6 +34,10 @@ from openerp.tools.translate import _ _logger = logging.getLogger(__name__) + +# Only users who can modify the user (incl. the user herself) see the real contents of these fields +USER_PRIVATE_FIELDS = ['password'] + class groups(osv.osv): _name = "res.groups" _description = "Access Groups" @@ -277,8 +281,10 @@ class res_users(osv.osv): def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): def override_password(o): - if 'password' in o and ('id' not in o or o['id'] != uid): - o['password'] = '********' + if ('id' not in o or o['id'] != uid): + for f in USER_PRIVATE_FIELDS: + if f in o: + o[f] = '********' return o if fields and (ids == [uid] or ids == uid):