summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-02-02 12:25:06 +0100
committerChristophe Simonis <chs@odoo.com>2016-02-02 12:25:06 +0100
commit9ca7ad87b2bd06c4fae5d3428e2262eacf9fdb60 (patch)
treee2cbc5c8c7d878d655136a9fc3c57e0d256869f9
parent5b77e304299cfc92376ceb35e0f5587c0694bcbc (diff)
parent3ac46ee3d4b9775c5d18acc8ffb95188508a20af (diff)
[MERGE] forward port of branch 8.0 up to 3ac46ee
-rw-r--r--addons/account/account_bank_statement.py1
-rw-r--r--addons/account/account_view.xml2
-rw-r--r--addons/delivery/sale.py5
-rw-r--r--addons/sale_margin/sale_margin.py2
-rw-r--r--addons/stock/i18n/stock.pot6
-rw-r--r--addons/stock/stock.py14
-rw-r--r--addons/web/static/src/xml/base.xml12
-rw-r--r--openerp/addons/base/tests/test_orm.py4
-rw-r--r--openerp/fields.py4
-rw-r--r--openerp/models.py2
-rw-r--r--openerp/tools/translate.py4
11 files changed, 43 insertions, 13 deletions
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 9f6cedd9102..ff54a5c0590 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -1011,6 +1011,7 @@ class account_bank_statement_line(osv.osv):
}
_defaults = {
'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):
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 548c0de2899..40ce9f08ae8 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -601,7 +601,7 @@
<page string="Transactions" name="statement_line_ids">
<field name="line_ids" context="{'date':date}">
<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="date" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
<field name="name" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
diff --git a/addons/delivery/sale.py b/addons/delivery/sale.py
index 54c5d124200..0a4a34e3ca1 100644
--- a/addons/delivery/sale.py
+++ b/addons/delivery/sale.py
@@ -95,6 +95,11 @@ class sale_order(osv.Model):
'tax_id': [(6, 0, taxes_ids)],
'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:
values['sequence'] = order.order_line[-1].sequence + 1
line_id = line_obj.create(cr, uid, values, context=context)
diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py
index e44e3815811..2d8af48ce66 100644
--- a/addons/sale_margin/sale_margin.py
+++ b/addons/sale_margin/sale_margin.py
@@ -87,7 +87,7 @@ class sale_order(osv.osv):
_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={
- '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),
}, digits_compute= dp.get_precision('Product Price')),
}
diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot
index daae3a0fc74..805485062d1 100644
--- a/addons/stock/i18n/stock.pot
+++ b/addons/stock/i18n/stock.pot
@@ -52,6 +52,12 @@ msgid " (reserved)"
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
#: code:addons/stock/stock.py:3090
#, python-format
msgid " MTO"
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index c62e5a9b761..4ea86e1d901 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2072,6 +2072,10 @@ class stock_move(osv.osv):
propagated_changes_dict['product_uom_qty'] = vals['product_uom_qty']
if vals.get('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:
propagated_date_field = False
if vals.get('date_expected'):
@@ -2991,9 +2995,15 @@ class stock_inventory_line(osv.osv):
}
def create(self, cr, uid, values, context=None):
- if context is None:
- context = {}
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:
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)
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 39173add5c6..51fc676d8ce 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1945,13 +1945,11 @@
<t t-name="FieldMany2ManyCheckBoxes">
<t t-foreach="widget.get('records')" t-as="record">
<div>
- <t t-if="selected[record[0]]">
- <input type="checkbox" t-att-data-record-id="JSON.stringify(record[0])" checked="true"/>
- </t>
- <t t-if="! selected[record[0]]">
- <input type="checkbox" t-att-data-record-id="JSON.stringify(record[0])"/>
- </t>
- <t t-esc="record[1]"/>
+ <label style="font-weight: normal">
+ <input type="checkbox" t-att-data-record-id="JSON.stringify(record[0])"
+ t-att-checked="selected[record[0]] or null"/>
+ <t t-esc="record[1]"/>
+ </label>
</div>
</t>
</t>
diff --git a/openerp/addons/base/tests/test_orm.py b/openerp/addons/base/tests/test_orm.py
index 7915aa678c8..f33a1cfe126 100644
--- a/openerp/addons/base/tests/test_orm.py
+++ b/openerp/addons/base/tests/test_orm.py
@@ -166,6 +166,10 @@ class TestORM(common.TransactionCase):
['date'], ['date:month', 'date:day'], lazy=False)
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):
""" test the behavior of the orm for models that use _inherits;
diff --git a/openerp/fields.py b/openerp/fields.py
index 7f2e2d3d764..d49f203ffb4 100644
--- a/openerp/fields.py
+++ b/openerp/fields.py
@@ -64,9 +64,11 @@ def copy_cache(records, env):
for record, target in zip(records, records.with_env(env)):
if not target._cache:
for name, value in record._cache.iteritems():
- target[name] = value
if isinstance(value, BaseModel):
+ target._cache[name] = value.with_env(env)
copy_cache(value, env)
+ else:
+ target._cache[name] = value
def resolve_all_mro(cls, name, reverse=False):
diff --git a/openerp/models.py b/openerp/models.py
index c6c7a84bb86..0e2a56ce335 100644
--- a/openerp/models.py
+++ b/openerp/models.py
@@ -3905,7 +3905,7 @@ class BaseModel(object):
self._table, ','.join('"%s"=%s' % u[:2] for u in updates),
)
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,))
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)
diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py
index 260f4e968bd..96dadf9de89 100644
--- a/openerp/tools/translate.py
+++ b/openerp/tools/translate.py
@@ -671,6 +671,10 @@ def trans_generate(lang, modules, cr):
query += ' WHERE module IN %s'
query_models += ' AND imd.module in %s'
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_models += ' ORDER BY module, model'