[MERGE] forward port of branch 7.0 up to 856bc6f

This commit is contained in:
Christophe Simonis 2015-04-10 18:24:46 +02:00
commit d3e7a8ef5e
12 changed files with 38 additions and 30 deletions

6
README
View File

@ -11,7 +11,7 @@ Installation on Debian/Ubuntu
Add the the apt repository 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: in your source.list and type:
@ -44,8 +44,8 @@ Installation on Windows
Installation on MacOSX Installation on MacOSX
----------------------- -----------------------
Setuping you first database Setting up your first database
--------------------------- ------------------------------
Point your browser to http://localhost:8069/ and click "Manage Databases", the Point your browser to http://localhost:8069/ and click "Manage Databases", the
default master password is "admin". default master password is "admin".

View File

@ -1243,15 +1243,23 @@ class account_move_line(osv.osv):
base_sign = 'base_sign' base_sign = 'base_sign'
tax_sign = 'tax_sign' tax_sign = 'tax_sign'
tmp_cnt = 0 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 #create the base movement
if tmp_cnt == 0: if tmp_cnt == 0:
if tax[base_code]: if tax[base_code]:
tmp_cnt += 1 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_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: else:
data = { data = {
'move_id': vals['move_id'], 'move_id': vals['move_id'],

View File

@ -22,6 +22,8 @@ _logger = logging.getLogger(__name__)
magic_md5 = '$1$' magic_md5 = '$1$'
magic_sha256 = '$5$' magic_sha256 = '$5$'
openerp.addons.base.res.res_users.USER_PRIVATE_FIELDS.append('password_crypt')
def gen_salt(length=8, symbols=None): def gen_salt(length=8, symbols=None):
if symbols is None: if symbols is None:
symbols = ascii_letters + digits symbols = ascii_letters + digits
@ -173,5 +175,4 @@ class res_users(osv.osv):
# Reraise password incorrect # Reraise password incorrect
raise raise
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -35,8 +35,9 @@ class stock_picking(osv.osv):
total_weight = total_weight_net = 0.00 total_weight = total_weight_net = 0.00
for move in picking.move_lines: for move in picking.move_lines:
total_weight += move.weight if move.state != 'cancel':
total_weight_net += move.weight_net total_weight += move.weight
total_weight_net += move.weight_net
res[picking.id] = { res[picking.id] = {
'weight': total_weight, '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', 'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
store={ store={
'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20), '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', 'weight_net': fields.function(_cal_weight, type='float', string='Net Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
store={ store={
'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20), '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), 'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
'number_of_packages': fields.integer('Number of Packages'), 'number_of_packages': fields.integer('Number of Packages'),

View File

@ -220,7 +220,7 @@ class mrp_production(osv.osv):
result[prod.id] = max(line.date_planned_end, result[prod.id]) result[prod.id] = max(line.date_planned_end, result[prod.id])
return result 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. """ Finishes work order if production order is done.
@return: Super method @return: Super method
""" """
@ -230,9 +230,9 @@ class mrp_production(osv.osv):
if workcenter_line.state == 'draft': if workcenter_line.state == 'draft':
workcenter_pool.signal_button_start_working(cr, uid, [workcenter_line.id]) workcenter_pool.signal_button_start_working(cr, uid, [workcenter_line.id])
workcenter_pool.signal_button_done(cr, uid, [workcenter_line.id]) workcenter_pool.signal_button_done(cr, uid, [workcenter_line.id])
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. """ Changes state to In Production and writes starting date.
@return: True @return: True
""" """
@ -240,7 +240,7 @@ class mrp_production(osv.osv):
for prod in self.browse(cr, uid, ids): for prod in self.browse(cr, uid, ids):
if prod.workcenter_lines: if prod.workcenter_lines:
workcenter_pool.signal_button_start_working(cr, uid, [prod.workcenter_lines[0].id]) workcenter_pool.signal_button_start_working(cr, uid, [prod.workcenter_lines[0].id])
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): def action_cancel(self, cr, uid, ids, context=None):
""" Cancels work order if production order is canceled. """ Cancels work order if production order is canceled.

View File

@ -44,6 +44,7 @@ class sale_report(osv.osv):
'nbr': fields.integer('# of Lines', readonly=True), 'nbr': fields.integer('# of Lines', readonly=True),
'state': fields.selection([ 'state': fields.selection([
('draft', 'Quotation'), ('draft', 'Quotation'),
('sent', 'Quotation Sent'),
('waiting_date', 'Waiting Schedule'), ('waiting_date', 'Waiting Schedule'),
('manual', 'Manual In Progress'), ('manual', 'Manual In Progress'),
('progress', 'In Progress'), ('progress', 'In Progress'),

View File

@ -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 to_cur = self.pool.get('product.pricelist').browse(cr, uid, [pricelist])[0].currency_id.id
if product: if product:
product = self.pool['product.product'].browse(cr, uid, product, context=context) 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) to_uom = res.get('product_uom', uom)
if to_uom != product.uom_id.id: 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) purchase_price = self.pool['product.uom']._compute_price(cr, uid, product.uom_id.id, purchase_price, to_uom)

View File

@ -30,6 +30,7 @@ class sale_report(osv.osv):
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse',readonly=True), 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse',readonly=True),
'state': fields.selection([ 'state': fields.selection([
('draft', 'Quotation'), ('draft', 'Quotation'),
('sent', 'Quotation Sent'),
('waiting_date', 'Waiting Schedule'), ('waiting_date', 'Waiting Schedule'),
('manual', 'Manual In Progress'), ('manual', 'Manual In Progress'),
('progress', 'In Progress'), ('progress', 'In Progress'),

View File

@ -725,6 +725,7 @@ class stock_picking(osv.osv):
default.setdefault('backorder_id', False) default.setdefault('backorder_id', False)
if 'invoice_state' not in default and picking_obj.invoice_state == 'invoiced': if 'invoice_state' not in default and picking_obj.invoice_state == 'invoiced':
default['invoice_state'] = '2binvoiced' default['invoice_state'] = '2binvoiced'
default.setdefault('date_done', False)
res = super(stock_picking, self).copy(cr, uid, id, default, context) res = super(stock_picking, self).copy(cr, uid, id, default, context)
return res return res

View File

@ -38,6 +38,9 @@ _logger = logging.getLogger(__name__)
# Basic res.groups and res.users # Basic res.groups and res.users
#---------------------------------------------------------- #----------------------------------------------------------
# Only users who can modify the user (incl. the user herself) see the real contents of these fields
USER_PRIVATE_FIELDS = ['password']
class res_groups(osv.osv): class res_groups(osv.osv):
_name = "res.groups" _name = "res.groups"
_description = "Access Groups" _description = "Access Groups"
@ -278,8 +281,10 @@ class res_users(osv.osv):
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
def override_password(o): def override_password(o):
if 'password' in o and ('id' not in o or o['id'] != uid): if ('id' not in o or o['id'] != uid):
o['password'] = '********' for f in USER_PRIVATE_FIELDS:
if f in o:
o[f] = '********'
return o return o
if fields and (ids == [uid] or ids == uid): if fields and (ids == [uid] or ids == uid):

View File

@ -1220,17 +1220,6 @@ class BaseModel(object):
for fpos2 in range(len(fields)): for fpos2 in range(len(fields)):
if lines2 and lines2[0][fpos2]: if lines2 and lines2[0][fpos2]:
data[fpos2] = lines2[0][fpos2] data[fpos2] = lines2[0][fpos2]
if not data[fpos]:
dt = ''
for rr in r:
name_relation = self.pool[rr._table_name]._rec_name
if isinstance(rr[name_relation], browse_record):
rr = rr[name_relation]
rr_name = self.pool[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:] lines += lines2[1:]
first = False first = False
else: else:

View File

@ -236,6 +236,7 @@ class rml_parse(object):
self.localcontext['lang'] = lang self.localcontext['lang'] = lang
self.lang_dict_called = False self.lang_dict_called = False
for obj in self.objects: for obj in self.objects:
obj.refresh()
obj._context['lang'] = lang obj._context['lang'] = lang
def _get_lang_dict(self): def _get_lang_dict(self):