diff options
| author | Christophe Simonis <chs@odoo.com> | 2015-08-21 16:08:27 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2015-08-21 16:08:27 +0200 |
| commit | 04e13180c9be77c79d8ddd9e3d43ab6fc4dc3f43 (patch) | |
| tree | 49d5c9440d7fdd1dfc8da4d48ae1e0552a60565f | |
| parent | e95e9f887852b0e76783a78cdb8eefa68d0dc3d4 (diff) | |
| parent | 607114ff00576380c45a5b7a2c1391ee914c7238 (diff) | |
[MERGE] forward port of branch 7.0 up to 607114f
| -rw-r--r-- | addons/l10n_ca/account_chart_template_en.xml | 22 | ||||
| -rw-r--r-- | addons/l10n_ca/account_chart_template_fr.xml | 22 | ||||
| -rw-r--r-- | addons/stock/stock.py | 11 |
3 files changed, 33 insertions, 22 deletions
diff --git a/addons/l10n_ca/account_chart_template_en.xml b/addons/l10n_ca/account_chart_template_en.xml index 64e0632382e..f73bdcec68e 100644 --- a/addons/l10n_ca/account_chart_template_en.xml +++ b/addons/l10n_ca/account_chart_template_en.xml @@ -1,5 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> + <data noupdate="1"> + <!-- Those properties are in a noupdate section in the stock module --> + <!-- No need to create them if they have been deleted --> + <record id="stock.property_stock_account_input_categ" model="ir.property" forcecreate="False"> + <field eval="'account.account,'+str(ref('chart2141_en'))" model="account.account" name="value"/> + <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> + </record> + <record id="stock.property_stock_account_output_categ" model="ir.property" forcecreate="False"> + <field eval="'account.account,'+str(ref('chart1145_en'))" model="account.account" name="value"/> + <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> + </record> + </data> <data> <!-- Chart template --> @@ -16,16 +28,6 @@ <field name="currency_id" ref="base.CAD"/> </record> - <record id="stock.property_stock_account_input_categ" model="ir.property"> - <field eval="'account.account,'+str(ref('chart2141_en'))" model="account.account" name="value"/> - <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> - </record> - - <record id="stock.property_stock_account_output_categ" model="ir.property"> - <field eval="'account.account,'+str(ref('chart1145_en'))" model="account.account" name="value"/> - <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> - </record> - <record id="property_stock_valuation_account_id_en" model="ir.property"> <field name="name">property_stock_valuation_account_id</field> <field name="fields_id" search="[('model','=','product.category'),('name','=','property_stock_valuation_account_id')]"/> diff --git a/addons/l10n_ca/account_chart_template_fr.xml b/addons/l10n_ca/account_chart_template_fr.xml index 510153200c6..b425d525e1d 100644 --- a/addons/l10n_ca/account_chart_template_fr.xml +++ b/addons/l10n_ca/account_chart_template_fr.xml @@ -1,5 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> + <data noupdate="1"> + <!-- Those properties are in a noupdate section in the stock module --> + <!-- No need to create them if they have been deleted --> + <record id="stock.property_stock_account_input_categ" model="ir.property" forcecreate="False"> + <field eval="'account.account,'+str(ref('chart2171_fr'))" model="account.account" name="value"/> + <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> + </record> + <record id="stock.property_stock_account_output_categ" model="ir.property" forcecreate="False"> + <field eval="'account.account,'+str(ref('chart1145_fr'))" model="account.account" name="value"/> + <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> + </record> + </data> <data> <!-- Chart template --> @@ -15,16 +27,6 @@ <field name="currency_id" ref="base.CAD"/> </record> - <record id="stock.property_stock_account_input_categ" model="ir.property"> - <field eval="'account.account,'+str(ref('chart2171_fr'))" model="account.account" name="value"/> - <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> - </record> - - <record id="stock.property_stock_account_output_categ" model="ir.property"> - <field eval="'account.account,'+str(ref('chart1145_fr'))" model="account.account" name="value"/> - <field eval="'product.category,'+str(ref('product.product_category_all'))" model="product.category" name="res_id"/> - </record> - <record id="property_stock_valuation_account_id" model="ir.property"> <field name="name">property_stock_valuation_account_id</field> <field name="fields_id" search="[('model','=','product.category'),('name','=','property_stock_valuation_account_id')]"/> diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 0acf8a229a7..b3e9d951673 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -630,6 +630,13 @@ class stock_picking(osv.osv): res[pick]['max_date'] = dt2 return res + def _get_pickings(self, cr, uid, ids, context=None): + res = set() + for move in self.browse(cr, uid, ids, context=context): + if move.picking_id and not move.picking_id.min_date < move.date_expected < move.picking_id.max_date: + res.add(move.picking_id.id) + return list(res) + def create(self, cr, user, vals, context=None): if ('name' not in vals) or (vals.get('name')=='/') or (vals.get('name') == False): seq_obj_name = self._name @@ -665,11 +672,11 @@ class stock_picking(osv.osv): * Cancelled: has been cancelled, can't be confirmed anymore""" ), 'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date", - store=True, type='datetime', string='Scheduled Time', select=1, help="Scheduled time for the shipment to be processed"), + store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', string='Scheduled Time', select=1, help="Scheduled time for the shipment to be processed"), 'date': fields.datetime('Creation Date', help="Creation date, usually the time of the order.", select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}), 'date_done': fields.datetime('Date of Transfer', help="Date of Completion", states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}), 'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date", - store=True, type='datetime', string='Max. Expected Date', select=2), + store={'stock.move': (_get_pickings, ['date_expected', 'picking_id'], 20)}, type='datetime', string='Max. Expected Date', select=2), 'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}), 'product_id': fields.related('move_lines', 'product_id', type='many2one', relation='product.product', string='Product'), 'auto_picking': fields.boolean('Auto-Picking', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}), |
