~numerigraphe-team/stock-logistic-warehouse/7.0-add-stock-available-sale

« back to all changes in this revision

Viewing changes to stock_orderpoint_creator/orderpoint_template.py

  • Committer: nicolas.bessi at camptocamp
  • Date: 2012-05-24 14:07:16 UTC
  • Revision ID: nicolas.bessi@camptocamp.com-20120524140716-b493jcic0vxtbu3o
[Refactor] creator addons
(lp:c2c-addons/6.1  rev 28.1.15)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
""" Template of order point object """
23
23
 
24
 
from openerp.osv.orm import TransientModel, fields
 
24
from openerp.osv.orm import Model, fields
25
25
from base_product_config_template import BaseProductConfigTemplate
26
26
 
27
 
class OrderpointTemplate(BaseProductConfigTemplate, TransientModel):
 
27
class OrderpointTemplate(BaseProductConfigTemplate, Model):
28
28
    """ Template for orderpoints """
29
29
    _name = 'stock.warehouse.orderpoint.template'
30
30
 
31
31
    _inherit = 'stock.warehouse.orderpoint'
32
32
    _table = 'stock_warehouse_orderpoint_template'
 
33
    _clean_mode = 'deactivate'
 
34
 
33
35
 
34
36
    _columns = {
35
37
        'product_id': fields.many2one('product.product',
40
42
    }
41
43
 
42
44
    def _get_ids_2_clean(self, cursor, uid, template_br, product_ids, context=None):
43
 
        """ hook to select model specific objects to clean before recteating new one
44
 
        return must return a list of id. """
 
45
        """ hook to select model specific objects to clean
 
46
        return must return a list of id"""
45
47
        model_obj = self._get_model()
46
 
        search_args = [('warehouse_id', '=', template_br.warehouse_id.id),
47
 
                       ('product_id', 'in', product_ids)]
48
 
 
49
 
        ids2clean = model_obj.search(cursor, uid, search_args, context=context)
50
 
        return ids2clean
 
48
        ids_to_del = model_obj.search(cursor, uid,
 
49
                                      [('product_id', 'in', product_ids)])
 
50
        return ids_to_del
51
51
 
52
52
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: