[MERGE] forward port of branch saas-3 up to 31f2a1b

This commit is contained in:
Christophe Simonis 2015-06-30 13:33:35 +02:00
commit 066e41b63d
8 changed files with 21 additions and 7 deletions

View File

@ -913,7 +913,10 @@ class account_invoice(models.Model):
i[2]['period_id'] = period.id i[2]['period_id'] = period.id
ctx['invoice'] = inv ctx['invoice'] = inv
move = account_move.with_context(ctx).create(move_vals) ctx_nolang = ctx.copy()
ctx_nolang.pop('lang', None)
move = account_move.with_context(ctx_nolang).create(move_vals)
# make the invoice point to that move # make the invoice point to that move
vals = { vals = {
'move_id': move.id, 'move_id': move.id,

View File

@ -118,10 +118,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

@ -126,12 +126,11 @@ 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)
grid_id = None grid_id = None
# 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:
@ -158,7 +157,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

@ -3589,6 +3589,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>
@ -3596,6 +3597,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>
@ -3603,6 +3605,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>

View File

@ -445,6 +445,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

@ -1584,7 +1584,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

@ -9,6 +9,7 @@
!record {model: product.product, id: product_onchange1}: !record {model: product.product, id: product_onchange1}:
name: 'Devil Worship Book' name: 'Devil Worship Book'
list_price: 66.6 list_price: 66.6
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.
- -
@ -26,5 +27,5 @@
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

View File

@ -1591,6 +1591,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]