[MERGE] forward port of branch 8.0 up to 3ac46ee

This commit is contained in:
Christophe Simonis
2016-02-02 12:25:06 +01:00
11 changed files with 43 additions and 13 deletions
+1
View File
@@ -1011,6 +1011,7 @@ class account_bank_statement_line(osv.osv):
} }
_defaults = { _defaults = {
'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)), 'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)),
'sequence': 1,
} }
class account_statement_operation_template(osv.osv): class account_statement_operation_template(osv.osv):
+1 -1
View File
@@ -601,7 +601,7 @@
<page string="Transactions" name="statement_line_ids"> <page string="Transactions" name="statement_line_ids">
<field name="line_ids" context="{'date':date}"> <field name="line_ids" context="{'date':date}">
<tree editable="bottom" string="Statement lines" colors="grey:journal_entry_ids"> <tree editable="bottom" string="Statement lines" colors="grey:journal_entry_ids">
<field name="sequence" readonly="1" invisible="1"/> <field name="sequence" widget="handle"/>
<field name="journal_entry_ids" invisible="1"/> <field name="journal_entry_ids" invisible="1"/>
<field name="date" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/> <field name="date" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
<field name="name" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/> <field name="name" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
+5
View File
@@ -95,6 +95,11 @@ class sale_order(osv.Model):
'tax_id': [(6, 0, taxes_ids)], 'tax_id': [(6, 0, taxes_ids)],
'is_delivery': True, 'is_delivery': True,
} }
res = line_obj.product_id_change(cr, uid, ids, order.pricelist_id.id, values['product_id'],
qty=values['product_uom_qty'], uom=False, qty_uos=0, uos=False, name='', partner_id=order.partner_id.id,
lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None)
if res['value'].get('purchase_price'):
values['purchase_price'] = res['value'].get('purchase_price')
if order.order_line: if order.order_line:
values['sequence'] = order.order_line[-1].sequence + 1 values['sequence'] = order.order_line[-1].sequence + 1
line_id = line_obj.create(cr, uid, values, context=context) line_id = line_obj.create(cr, uid, values, context=context)
+1 -1
View File
@@ -87,7 +87,7 @@ class sale_order(osv.osv):
_columns = { _columns = {
'margin': fields.function(_product_margin, string='Margin', help="It gives profitability by calculating the difference between the Unit Price and the cost price.", store={ 'margin': fields.function(_product_margin, string='Margin', help="It gives profitability by calculating the difference between the Unit Price and the cost price.", store={
'sale.order.line': (_get_order, ['margin', 'purchase_price'], 20), 'sale.order.line': (_get_order, ['margin', 'purchase_price', 'order_id'], 20),
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 20), 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 20),
}, digits_compute= dp.get_precision('Product Price')), }, digits_compute= dp.get_precision('Product Price')),
} }
+6
View File
@@ -51,6 +51,12 @@ msgstr ""
msgid " (reserved)" msgid " (reserved)"
msgstr "" msgstr ""
#. module: stock
#: code:addons/stock/stock.py:2954
#, python-format
msgid "You cannot have two inventory adjustements in state 'in Progess' with the same product(%s), same location(%s), same package, same owner and same lot. Please first validate the first inventory adjustement with this product before creating another one."
msgstr ""
#. module: stock #. module: stock
#: code:addons/stock/stock.py:3090 #: code:addons/stock/stock.py:3090
#, python-format #, python-format
+12 -2
View File
@@ -2072,6 +2072,10 @@ class stock_move(osv.osv):
propagated_changes_dict['product_uom_qty'] = vals['product_uom_qty'] propagated_changes_dict['product_uom_qty'] = vals['product_uom_qty']
if vals.get('product_uom_id'): if vals.get('product_uom_id'):
propagated_changes_dict['product_uom_id'] = vals['product_uom_id'] propagated_changes_dict['product_uom_id'] = vals['product_uom_id']
if vals.get('product_uos_qty'):
propagated_changes_dict['product_uos_qty'] = vals['product_uos_qty']
if vals.get('product_uos_id'):
propagated_changes_dict['product_uos_id'] = vals['product_uos_id']
#propagation of expected date: #propagation of expected date:
propagated_date_field = False propagated_date_field = False
if vals.get('date_expected'): if vals.get('date_expected'):
@@ -2991,9 +2995,15 @@ class stock_inventory_line(osv.osv):
} }
def create(self, cr, uid, values, context=None): def create(self, cr, uid, values, context=None):
if context is None:
context = {}
product_obj = self.pool.get('product.product') product_obj = self.pool.get('product.product')
dom = [('product_id', '=', values.get('product_id')), ('inventory_id.state', '=', 'confirm'),
('location_id', '=', values.get('location_id')), ('partner_id', '=', values.get('partner_id')),
('package_id', '=', values.get('package_id')), ('prod_lot_id', '=', values.get('prod_lot_id'))]
res = self.search(cr, uid, dom, context=context)
if res:
location = self.pool['stock.location'].browse(cr, uid, values.get('location_id'), context=context)
product = product_obj.browse(cr, uid, values.get('product_id'), context=context)
raise Warning(_("You cannot have two inventory adjustements in state 'in Progess' with the same product(%s), same location(%s), same package, same owner and same lot. Please first validate the first inventory adjustement with this product before creating another one.") % (product.name, location.name))
if 'product_id' in values and not 'product_uom_id' in values: if 'product_id' in values and not 'product_uom_id' in values:
values['product_uom_id'] = product_obj.browse(cr, uid, values.get('product_id'), context=context).uom_id.id values['product_uom_id'] = product_obj.browse(cr, uid, values.get('product_id'), context=context).uom_id.id
return super(stock_inventory_line, self).create(cr, uid, values, context=context) return super(stock_inventory_line, self).create(cr, uid, values, context=context)
+5 -7
View File
@@ -1945,13 +1945,11 @@
<t t-name="FieldMany2ManyCheckBoxes"> <t t-name="FieldMany2ManyCheckBoxes">
<t t-foreach="widget.get('records')" t-as="record"> <t t-foreach="widget.get('records')" t-as="record">
<div> <div>
<t t-if="selected[record[0]]"> <label style="font-weight: normal">
<input type="checkbox" t-att-data-record-id="JSON.stringify(record[0])" checked="true"/> <input type="checkbox" t-att-data-record-id="JSON.stringify(record[0])"
</t> t-att-checked="selected[record[0]] or null"/>
<t t-if="! selected[record[0]]"> <t t-esc="record[1]"/>
<input type="checkbox" t-att-data-record-id="JSON.stringify(record[0])"/> </label>
</t>
<t t-esc="record[1]"/>
</div> </div>
</t> </t>
</t> </t>
+4
View File
@@ -166,6 +166,10 @@ class TestORM(common.TransactionCase):
['date'], ['date:month', 'date:day'], lazy=False) ['date'], ['date:month', 'date:day'], lazy=False)
self.assertEqual(len(rg), len(all_partners)) self.assertEqual(len(rg), len(all_partners))
def test_write_duplicate(self):
cr, uid, p1 = self.cr, self.uid, self.p1
self.partner.write(cr, uid, [p1, p1], {'name': 'X'})
class TestInherits(common.TransactionCase): class TestInherits(common.TransactionCase):
""" test the behavior of the orm for models that use _inherits; """ test the behavior of the orm for models that use _inherits;
+3 -1
View File
@@ -64,9 +64,11 @@ def copy_cache(records, env):
for record, target in zip(records, records.with_env(env)): for record, target in zip(records, records.with_env(env)):
if not target._cache: if not target._cache:
for name, value in record._cache.iteritems(): for name, value in record._cache.iteritems():
target[name] = value
if isinstance(value, BaseModel): if isinstance(value, BaseModel):
target._cache[name] = value.with_env(env)
copy_cache(value, env) copy_cache(value, env)
else:
target._cache[name] = value
def resolve_all_mro(cls, name, reverse=False): def resolve_all_mro(cls, name, reverse=False):
+1 -1
View File
@@ -3905,7 +3905,7 @@ class BaseModel(object):
self._table, ','.join('"%s"=%s' % u[:2] for u in updates), self._table, ','.join('"%s"=%s' % u[:2] for u in updates),
) )
params = tuple(u[2] for u in updates if len(u) > 2) params = tuple(u[2] for u in updates if len(u) > 2)
for sub_ids in cr.split_for_in_conditions(ids): for sub_ids in cr.split_for_in_conditions(set(ids)):
cr.execute(query, params + (sub_ids,)) cr.execute(query, params + (sub_ids,))
if cr.rowcount != len(sub_ids): if cr.rowcount != len(sub_ids):
raise MissingError(_('One of the records you are trying to modify has already been deleted (Document type: %s).') % self._description) raise MissingError(_('One of the records you are trying to modify has already been deleted (Document type: %s).') % self._description)
+4
View File
@@ -671,6 +671,10 @@ def trans_generate(lang, modules, cr):
query += ' WHERE module IN %s' query += ' WHERE module IN %s'
query_models += ' AND imd.module in %s' query_models += ' AND imd.module in %s'
query_param = (tuple(modules),) query_param = (tuple(modules),)
else:
query += ' WHERE module != %s'
query_models += ' AND imd.module != %s'
query_param = ('__export__',)
query += ' ORDER BY module, model, name' query += ' ORDER BY module, model, name'
query_models += ' ORDER BY module, model' query_models += ' ORDER BY module, model'