[MERGE] forward port of branch 7.0 up to 1c0bc7c

This commit is contained in:
Christophe Simonis 2015-06-30 12:47:27 +02:00
commit 31f2a1bc38
12 changed files with 36 additions and 16 deletions

View File

@ -1077,7 +1077,9 @@ class account_invoice(osv.osv):
i[2]['period_id'] = period_id i[2]['period_id'] = period_id
ctx.update(invoice=inv) ctx.update(invoice=inv)
move_id = move_obj.create(cr, uid, move, context=ctx) ctx_copy = ctx.copy()
ctx_copy.pop('lang', None)
move_id = move_obj.create(cr, uid, move, context=ctx_copy)
new_move_name = move_obj.browse(cr, uid, move_id, context=ctx).name new_move_name = move_obj.browse(cr, uid, move_id, context=ctx).name
# make the invoice point to that move # make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}, context=ctx) self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}, context=ctx)

View File

@ -112,10 +112,12 @@ class crossovered_budget_lines(osv.osv):
result = 0.0 result = 0.0
if context is None: if context is None:
context = {} context = {}
account_obj = self.pool.get('account.account')
for line in self.browse(cr, uid, ids, context=context): for line in self.browse(cr, uid, ids, context=context):
acc_ids = [x.id for x in line.general_budget_id.account_ids] acc_ids = [x.id for x in line.general_budget_id.account_ids]
if not acc_ids: if not acc_ids:
raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name)) raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name))
acc_ids = account_obj._get_children_and_consol(cr, uid, acc_ids, context=context)
date_to = line.date_to date_to = line.date_to
date_from = line.date_from date_from = line.date_from
if line.analytic_account_id.id: if line.analytic_account_id.id:

View File

@ -111,11 +111,10 @@ class delivery_carrier(osv.osv):
# not using advanced pricing per destination: override grid # not using advanced pricing per destination: override grid
grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id)], context=context) grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id)], context=context)
if grid_id and not (record.normal_price or record.free_if_more_than): if grid_id and not (record.normal_price is not False or record.free_if_more_than):
grid_pool.unlink(cr, uid, grid_id, context=context) grid_pool.unlink(cr, uid, grid_id, context=context)
# Check that float, else 0.0 is False if not (record.normal_price is not False or record.free_if_more_than):
if not (isinstance(record.normal_price,float) or record.free_if_more_than):
continue continue
if not grid_id: if not grid_id:
@ -142,7 +141,7 @@ class delivery_carrier(osv.osv):
'list_price': 0.0, 'list_price': 0.0,
} }
grid_line_pool.create(cr, uid, line_data, context=context) grid_line_pool.create(cr, uid, line_data, context=context)
if isinstance(record.normal_price,float): if record.normal_price is not False:
line_data = { line_data = {
'grid_id': grid_id and grid_id[0], 'grid_id': grid_id and grid_id[0],
'name': _('Default price'), 'name': _('Default price'),

View File

@ -3628,6 +3628,7 @@
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account.data_account_type_payable"/> <field name="user_type" ref="account.data_account_type_payable"/>
<field ref="a44" name="parent_id"/> <field ref="a44" name="parent_id"/>
<field name="financial_report_ids" eval="[(4,ref('account_financial_report_fournisseurs4'))]"/>
</record> </record>
<record id="a446" model="account.account.template"> <record id="a446" model="account.account.template">
<field name="name">Acomptes reçus</field> <field name="name">Acomptes reçus</field>
@ -3635,6 +3636,7 @@
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account.data_account_type_payable"/> <field name="user_type" ref="account.data_account_type_payable"/>
<field ref="a44" name="parent_id"/> <field ref="a44" name="parent_id"/>
<field name="financial_report_ids" eval="[(4,ref('account_financial_report_fournisseurs4'))]"/>
</record> </record>
<record id="a448" model="account.account.template"> <record id="a448" model="account.account.template">
<field name="name">Compensations fournisseurs</field> <field name="name">Compensations fournisseurs</field>
@ -3642,6 +3644,7 @@
<field name="type">other</field> <field name="type">other</field>
<field name="user_type" ref="account.data_account_type_payable"/> <field name="user_type" ref="account.data_account_type_payable"/>
<field ref="a44" name="parent_id"/> <field ref="a44" name="parent_id"/>
<field name="financial_report_ids" eval="[(4,ref('account_financial_report_fournisseurs4'))]"/>
</record> </record>
<record id="a45" model="account.account.template"> <record id="a45" model="account.account.template">
<field name="name">DETTES FISCALES, SALARIALES ET SOCIALES</field> <field name="name">DETTES FISCALES, SALARIALES ET SOCIALES</field>
@ -6338,7 +6341,7 @@
<field name="type">view</field> <field name="type">view</field>
<field name="user_type" ref="user_type_view"/> <field name="user_type" ref="user_type_view"/>
<field ref="a7" name="parent_id"/> <field ref="a7" name="parent_id"/>
<field name="financial_report_ids" eval="[(4,ref('account_financial_report_produitsexceptionnels1')),(4,ref('account_financial_report_bnficepertedelexcerciceavantimpts1'))]"/> <field name="financial_report_ids" eval="[(4,ref('account_financial_report_produitsexceptionnels1')),(4,ref('account_financial_report_bnficepertedelexcerciceavantimpts1')),(4,ref('account_financial_report_bnficepertedelexcercice1'))]"/>
</record> </record>
<record id="a760" model="account.account.template"> <record id="a760" model="account.account.template">
<field name="name">Reprises d'amortissements et de réductions de valeur</field> <field name="name">Reprises d'amortissements et de réductions de valeur</field>

View File

@ -416,6 +416,9 @@ class mail_thread(osv.AbstractModel):
cascaded, because link is done through (res_model, res_id). """ cascaded, because link is done through (res_model, res_id). """
msg_obj = self.pool.get('mail.message') msg_obj = self.pool.get('mail.message')
fol_obj = self.pool.get('mail.followers') fol_obj = self.pool.get('mail.followers')
if isinstance(ids, (int, long)):
ids = [ids]
# delete messages and notifications # delete messages and notifications
msg_ids = msg_obj.search(cr, uid, [('model', '=', self._name), ('res_id', 'in', ids)], context=context) msg_ids = msg_obj.search(cr, uid, [('model', '=', self._name), ('res_id', 'in', ids)], context=context)
msg_obj.unlink(cr, uid, msg_ids, context=context) msg_obj.unlink(cr, uid, msg_ids, context=context)

View File

@ -1341,7 +1341,8 @@ class account_invoice(osv.Model):
not all(picking.invoice_state in ['invoiced'] for picking in order.picking_ids)): not all(picking.invoice_state in ['invoiced'] for picking in order.picking_ids)):
shipped = False shipped = False
for po_line in order.order_line: for po_line in order.order_line:
if all(line.invoice_id.state not in ['draft', 'cancel'] for line in po_line.invoice_lines): if (po_line.invoice_lines and
all(line.invoice_id.state not in ['draft', 'cancel'] for line in po_line.invoice_lines)):
invoiced.append(po_line.id) invoiced.append(po_line.id)
if invoiced and shipped: if invoiced and shipped:
self.pool['purchase.order.line'].write(cr, user_id, invoiced, {'invoiced': True}) self.pool['purchase.order.line'].write(cr, user_id, invoiced, {'invoiced': True})

View File

@ -10,6 +10,7 @@
name: 'Devil Worship Book' name: 'Devil Worship Book'
list_price: 66.6 list_price: 66.6
procure_method: 'make_to_order' procure_method: 'make_to_order'
default_code: 'DWB00001'
- -
In sale order to test process of onchange of Sale Order with access rights of saleman. In sale order to test process of onchange of Sale Order with access rights of saleman.
- -
@ -27,6 +28,6 @@
I verify that the onchange of product on sale order line was correctly triggered I verify that the onchange of product on sale order line was correctly triggered
- -
!assert {model: sale.order, id: sale_order_onchange1, string: The onchange function of product was not correctly triggered}: !assert {model: sale.order, id: sale_order_onchange1, string: The onchange function of product was not correctly triggered}:
- order_line[0].name == u'Devil Worship Book' - order_line[0].name == u'[DWB00001] Devil Worship Book'
- order_line[0].price_unit == 66.6 - order_line[0].price_unit == 66.6
- order_line[0].type == 'make_to_order' - order_line[0].type == 'make_to_order'

View File

@ -743,7 +743,7 @@
<field name="name">stock.picking.tree</field> <field name="name">stock.picking.tree</field>
<field name="model">stock.picking</field> <field name="model">stock.picking</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree colors="blue:state == 'draft';grey:state == 'cancel';red:state not in ('cancel', 'done') and date &lt; current_date" string="Picking list"> <tree colors="blue:state == 'draft';grey:state == 'cancel';red:state not in ('cancel', 'done') and min_date &lt; current_date" string="Picking list">
<field name="name"/> <field name="name"/>
<field name="backorder_id"/> <field name="backorder_id"/>
<field name="origin"/> <field name="origin"/>
@ -1019,7 +1019,7 @@
<field name="name">stock.picking.in.tree</field> <field name="name">stock.picking.in.tree</field>
<field name="model">stock.picking.in</field> <field name="model">stock.picking.in</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree colors="blue:state == 'draft';grey:state == 'done';red:state not in ('cancel', 'done') and date &lt; current_date" string="Picking list"> <tree colors="blue:state == 'draft';grey:state == 'done';red:state not in ('cancel', 'done') and min_date &lt; current_date" string="Picking list">
<field name="name"/> <field name="name"/>
<field name="partner_id" string="Supplier"/> <field name="partner_id" string="Supplier"/>
<field name="backorder_id"/> <field name="backorder_id"/>

View File

@ -423,7 +423,7 @@
<t t-set="debug" t-value="__debug__ ? '&amp;debug' : ''"/> <t t-set="debug" t-value="__debug__ ? '&amp;debug' : ''"/>
<a class="oe_logo" t-attf-href="/web?#{debug}"> <a class="oe_logo" t-attf-href="/web?#{debug}">
<span class="oe_logo_edit">Edit Company data</span> <span class="oe_logo_edit">Edit Company data</span>
<img t-att-src='widget.session.url("/web/binary/company_logo")'/> <img />
</a> </a>
<div class="oe_secondary_menus_container"/> <div class="oe_secondary_menus_container"/>
<div class="oe_footer"> <div class="oe_footer">

View File

@ -36,6 +36,12 @@ import openerp
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
def memory_info(process):
""" psutil < 2.0 does not have memory_info, >= 3.0 does not have
get_memory_info """
return (getattr(process, 'memory_info', None) or process.get_memory_info)()
def LocalService(name): def LocalService(name):
""" """
The openerp.netsvc.LocalService() function is deprecated. It still works The openerp.netsvc.LocalService() function is deprecated. It still works
@ -221,7 +227,7 @@ def dispatch_rpc(service_name, method, params):
if rpc_request_flag or rpc_response_flag: if rpc_request_flag or rpc_response_flag:
start_time = time.time() start_time = time.time()
start_rss, start_vms = 0, 0 start_rss, start_vms = 0, 0
start_rss, start_vms = psutil.Process(os.getpid()).get_memory_info() start_rss, start_vms = memory_info(psutil.Process(os.getpid()))
if rpc_request and rpc_response_flag: if rpc_request and rpc_response_flag:
log(rpc_request,logging.DEBUG,'%s.%s'%(service_name,method), replace_request_password(params)) log(rpc_request,logging.DEBUG,'%s.%s'%(service_name,method), replace_request_password(params))
@ -242,7 +248,7 @@ def dispatch_rpc(service_name, method, params):
if rpc_request_flag or rpc_response_flag: if rpc_request_flag or rpc_response_flag:
end_time = time.time() end_time = time.time()
end_rss, end_vms = 0, 0 end_rss, end_vms = 0, 0
end_rss, end_vms = psutil.Process(os.getpid()).get_memory_info() end_rss, end_vms = memory_info(psutil.Process(os.getpid()))
logline = '%s.%s time:%.3fs mem: %sk -> %sk (diff: %sk)' % (service_name, method, end_time - start_time, start_vms / 1024, end_vms / 1024, (end_vms - start_vms)/1024) logline = '%s.%s time:%.3fs mem: %sk -> %sk (diff: %sk)' % (service_name, method, end_time - start_time, start_vms / 1024, end_vms / 1024, (end_vms - start_vms)/1024)
if rpc_response_flag: if rpc_response_flag:
log(rpc_response,logging.DEBUG, logline, result) log(rpc_response,logging.DEBUG, logline, result)

View File

@ -1355,6 +1355,8 @@ class sparse(function):
""" """
if self._type == 'many2many': if self._type == 'many2many':
if not value:
return []
assert value[0][0] == 6, 'Unsupported m2m value for sparse field: %s' % value assert value[0][0] == 6, 'Unsupported m2m value for sparse field: %s' % value
return value[0][2] return value[0][2]

View File

@ -31,6 +31,7 @@ except ImportError:
import openerp import openerp
import openerp.tools.config as config import openerp.tools.config as config
from openerp.netsvc import memory_info
from openerp.release import nt_service_name from openerp.release import nt_service_name
from openerp.tools.misc import stripped_sys_argv, dumpstacks from openerp.tools.misc import stripped_sys_argv, dumpstacks
@ -647,7 +648,7 @@ class Worker(object):
_logger.info("Worker (%d) max request (%s) reached.", self.pid, self.request_count) _logger.info("Worker (%d) max request (%s) reached.", self.pid, self.request_count)
self.alive = False self.alive = False
# Reset the worker if it consumes too much memory (e.g. caused by a memory leak). # Reset the worker if it consumes too much memory (e.g. caused by a memory leak).
rss, vms = psutil.Process(os.getpid()).get_memory_info() rss, vms = memory_info(psutil.Process(os.getpid()))
if vms > config['limit_memory_soft']: if vms > config['limit_memory_soft']:
_logger.info('Worker (%d) virtual memory limit (%s) reached.', self.pid, vms) _logger.info('Worker (%d) virtual memory limit (%s) reached.', self.pid, vms)
self.alive = False # Commit suicide after the request. self.alive = False # Commit suicide after the request.
@ -768,7 +769,7 @@ class WorkerCron(Worker):
self.setproctitle(db_name) self.setproctitle(db_name)
if rpc_request_flag: if rpc_request_flag:
start_time = time.time() start_time = time.time()
start_rss, start_vms = psutil.Process(os.getpid()).get_memory_info() start_rss, start_vms = memory_info(psutil.Process(os.getpid()))
import openerp.addons.base as base import openerp.addons.base as base
base.ir.ir_cron.ir_cron._acquire_job(db_name) base.ir.ir_cron.ir_cron._acquire_job(db_name)
@ -779,7 +780,7 @@ class WorkerCron(Worker):
openerp.sql_db.close_db(db_name) openerp.sql_db.close_db(db_name)
if rpc_request_flag: if rpc_request_flag:
end_time = time.time() end_time = time.time()
end_rss, end_vms = psutil.Process(os.getpid()).get_memory_info() end_rss, end_vms = memory_info(psutil.Process(os.getpid()))
logline = '%s time:%.3fs mem: %sk -> %sk (diff: %sk)' % (db_name, end_time - start_time, start_vms / 1024, end_vms / 1024, (end_vms - start_vms)/1024) logline = '%s time:%.3fs mem: %sk -> %sk (diff: %sk)' % (db_name, end_time - start_time, start_vms / 1024, end_vms / 1024, (end_vms - start_vms)/1024)
_logger.debug("WorkerCron (%s) %s", self.pid, logline) _logger.debug("WorkerCron (%s) %s", self.pid, logline)