diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 9f6cedd9102b01e0206cf4f6243e6c72c8c025fe..ff54a5c0590f67043c3be9fffe3f4d04fbae3588 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 548c0de28997111927bfd67da2d54ff727e9e9e3..40ce9f08ae816fba85949b25f352aac937fa2363 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 54c5d124200ff85a9e16b4d07fbb40529e8dbea7..0a4a34e3ca1ba96faac3678c2a2194796f18a6c1 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 e44e381581112ccf531d4e21dfde01b881e89dbd..2d8af48ce661fcd4688c5fd370f15b43838973db 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 daae3a0fc74d4f40c5729b52ebf87adaf7107fc7..805485062d14349c582fed35c3ec5ea5888241bc 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -51,6 +51,12 @@ msgstr "" 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 diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c62e5a9b7612547478734c19a329b4884b38c0b1..4ea86e1d901320f6ecd825c0bd9f7f585a6c856b 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 39173add5c650eeab0f793948ec94a34bf849c85..51fc676d8ce8d40d5dd5ee00caee01c96699f57d 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 7915aa678c859e5e885ec866a39f34e759ab2ee1..f33a1cfe126bba4ba8803bea7200e4109adf7200 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 7f2e2d3d764fe527b016ed61459afaa02430365b..d49f203ffb4e6a810525c649ce6f332ff4d7afaa 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 c6c7a84bb86ebfda441850498f4839cbd30075c0..0e2a56ce335de143a305a8c579c6ff44c3ad5381 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 260f4e968bd0c2d8ea070808e604c2b2f3ed2f1a..96dadf9de89fee952e9a9480777c149cbc439245 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'