[IMP] point_of_sale: enable product re-ordering in the point of sale.

This commit is contained in:
Frédéric van der Essen
2014-11-26 12:18:52 +01:00
parent 7d647eb903
commit 24875c11d0
3 changed files with 17 additions and 1 deletions
@@ -569,6 +569,18 @@
</field>
</field>
</record>
<record id="product_template_tree_view" model="ir.ui.view">
<field name="name">product.template.tree.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<field name="name" position="before">
<field name="sequence" widget="handle" />
</field>
</field>
</record>
<!-- END -->
<menuitem name="Configuration" parent="menu_point_root"
+3 -1
View File
@@ -296,6 +296,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
fields: ['display_name', 'list_price','price','pos_categ_id', 'taxes_id', 'barcode', 'default_code',
'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description',
'product_tmpl_id'],
order: ['sequence','name'],
domain: function(self){ return [['sale_ok','=',true],['available_in_pos','=',true]]; },
context: function(self){ return { pricelist: self.pricelist.id, display_default_code: false }; },
loaded: function(self, products){
@@ -428,6 +429,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
var domain = typeof model.domain === 'function' ? model.domain(self,tmp) : model.domain;
var context = typeof model.context === 'function' ? model.context(self,tmp) : model.context;
var ids = typeof model.ids === 'function' ? model.ids(self,tmp) : model.ids;
var order = typeof model.order === 'function' ? model.order(self,tmp): model.order;
progress += progress_step;
@@ -435,7 +437,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
if (model.ids) {
var records = new instance.web.Model(model.model).call('read',[ids,fields],context);
} else {
var records = new instance.web.Model(model.model).query(fields).filter(domain).context(context).all()
var records = new instance.web.Model(model.model).query(fields).filter(domain).order_by(order).context(context).all()
}
records.then(function(result){
try{ // catching exceptions in model.loaded(...)
+2
View File
@@ -483,6 +483,7 @@ class product_template(osv.osv):
_columns = {
'name': fields.char('Name', required=True, translate=True, select=True),
'sequence': fields.integer('Sequence', help='Gives the sequence order when displaying a product list'),
'product_manager': fields.many2one('res.users','Product Manager'),
'description': fields.text('Description',translate=True,
help="A precise description of the Product, used only for internal information purposes."),
@@ -738,6 +739,7 @@ class product_template(osv.osv):
'categ_id' : _default_category,
'type' : 'consu',
'active': True,
'sequence': 1,
}
def _check_uom(self, cursor, user, ids, context=None):