diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py index 23a309c1dda74978cb1cd326ae0f51380f80731a..f98fce52413d626479ab95537f1f5fd88eb850cd 100644 --- a/addons/account_analytic_plans/account_analytic_plans.py +++ b/addons/account_analytic_plans/account_analytic_plans.py @@ -210,7 +210,7 @@ class account_analytic_plan_instance(osv.osv): ana_plan_instance_obj = self.pool.get('account.analytic.plan.instance') acct_anal_acct = self.pool.get('account.analytic.account') acct_anal_plan_line_obj = self.pool.get('account.analytic.plan.line') - if context and 'journal_id' in context: + if context and context.get('journal_id'): journal = journal_obj.browse(cr, uid, context['journal_id'], context=context) pids = ana_plan_instance_obj.search(cr, uid, [('name','=',vals['name']), ('code','=',vals['code']), ('plan_id','<>',False)], context=context) diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py index 8ef17fa886c7bba3a3665a17ae636bada3427e4d..a4d9f48e359eb7969462ded24907f4bd0fcc66c7 100644 --- a/addons/account_anglo_saxon/invoice.py +++ b/addons/account_anglo_saxon/invoice.py @@ -22,6 +22,7 @@ ############################################################################## from openerp.osv import osv, fields +from openerp.tools.float_utils import float_round as round class account_invoice_line(osv.osv): _inherit = "account.invoice.line" @@ -36,11 +37,12 @@ class account_invoice_line(osv.osv): company_currency = inv.company_id.currency_id.id def get_price(cr, uid, inv, company_currency, i_line, price_unit): cur_obj = self.pool.get('res.currency') + decimal_precision = self.pool.get('decimal.precision') if inv.currency_id.id != company_currency: price = cur_obj.compute(cr, uid, company_currency, inv.currency_id.id, price_unit * i_line.quantity, context={'date': inv.date_invoice}) else: price = price_unit * i_line.quantity - return price + return round(price, decimal_precision.precision_get(cr, uid, 'Account')) if inv.type in ('out_invoice','out_refund'): for i_line in inv.invoice_line: @@ -118,6 +120,8 @@ class account_invoice_line(osv.osv): fpos = i_line.invoice_id.fiscal_position or False a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) diff_res = [] + decimal_precision = self.pool.get('decimal.precision') + account_prec = decimal_precision.precision_get(cr, uid, 'Account') # calculate and write down the possible price difference between invoice price and product price for line in res: if a == line['account_id'] and i_line.product_id.id == line['product_id']: @@ -132,14 +136,14 @@ class account_invoice_line(osv.osv): if valuation_stock_move: valuation_price_unit = stock_move_obj.browse(cr, uid, valuation_stock_move[0], context=context).price_unit if valuation_price_unit != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc: - price_diff = i_line.price_unit - valuation_price_unit - line.update({'price': valuation_price_unit * line['quantity']}) + price_diff = round(i_line.price_unit - valuation_price_unit, account_prec) + line.update({'price': round(valuation_price_unit * line['quantity'], account_prec)}) diff_res.append({ 'type': 'src', 'name': i_line.name[:64], 'price_unit': price_diff, 'quantity': line['quantity'], - 'price': price_diff * line['quantity'], + 'price': round(price_diff * line['quantity'], account_prec), 'account_id': acc, 'product_id': line['product_id'], 'uos_id': line['uos_id'], diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index d0cd945d4f41f98478f4c58fa732f1964bc1fd70..85cf5cecc8571e5e5d654b986ec1a22d90993183 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -631,7 +631,7 @@ <br /> <t t-esc="widget.pos.company.name"/><br /> Phone: <t t-esc="widget.pos.company.phone || ''"/><br /> - User: <t t-esc="widget.pos.user.name"/><br /> + User: <t t-esc="widget.pos.cashier.name"/><br /> Shop: <t t-esc="widget.pos.shop.name"/><br /> <br /> <t t-if="widget.pos.config.receipt_header"> diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml index 4ad5e5b9849a10d1630ded2dc5b01a7d2f086deb..50df0027b5ba6a163dd773f009b82e0e72520c52 100644 --- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml +++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml @@ -16,9 +16,7 @@ cost_method: standard mes_type: fixed name: HR Manger - procure_method: make_to_stock standard_price: 1.0 - supply_method: buy type: service uom_id: product.product_uom_hour uom_po_id: product.product_uom_hour diff --git a/openerp/tools/yaml_import.py b/openerp/tools/yaml_import.py index 10c3663c173603c65374c8d6b6848a9a9542d118..20136834a5d9335224333c1c50f928eb779b9181 100644 --- a/openerp/tools/yaml_import.py +++ b/openerp/tools/yaml_import.py @@ -447,16 +447,15 @@ class YamlInterpreter(object): args = map(lambda x: eval(x, ctx), match.group(2).split(',')) result = getattr(model, match.group(1))(self.cr, SUPERUSER_ID, [], *args) for key, val in (result or {}).get('value', {}).items(): - assert key in fg, ( - "The field %r returned from the onchange call %r " - "does not exist in the source view %r (of object " - "%r). This field will be ignored (and thus not " - "populated) when clients saves the new record" % ( - key, match.group(1), view_info.get('name', '?'), model._name - )) - if key not in fields: - # do not shadow values explicitly set in yaml. - record_dict[key] = process_val(key, val) + if key in fg: + if key not in fields: + # do not shadow values explicitly set in yaml. + record_dict[key] = process_val(key, val) + else: + _logger.warning("The returning field '%s' from your on_change call '%s'" + " does not exist either on the object '%s', either in" + " the view '%s'", + key, match.group(1), model._name, view_info['name']) else: nodes = list(el) + nodes else: