[MERGE] forward port of branch 7.0 up to 5f696ba

This commit is contained in:
Denis Ledoux 2014-08-08 16:18:35 +02:00
commit 81a902a07d
5 changed files with 19 additions and 18 deletions

View File

@ -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)

View File

@ -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'],

View File

@ -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">

View File

@ -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

View File

@ -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: