[MERGE] forward port branch 8.0 up to d16d1c6

This commit is contained in:
Christophe Simonis
2016-12-08 12:14:40 +01:00
5 changed files with 17 additions and 6 deletions
+10
View File
@@ -404,6 +404,7 @@ class product_pricelist_version(osv.osv):
'company_id': fields.related('pricelist_id','company_id',type='many2one',
readonly=True, relation='res.company', string='Company', store={
'product.pricelist': (_get_product_pricelist, ['company_id'], 20),
'product.pricelist.version': (lambda self, cr, uid, ids, c=None: ids, ['pricelist_id'], 20),
})
}
_defaults = {
@@ -505,6 +506,13 @@ class product_pricelist_item(osv.osv):
result.add(item_id.id)
return list(result)
def _get_product_pricelist_version(self, cr, uid, ids, context=None):
result = set()
for version in self.pool['product.pricelist.version'].browse(cr, uid, ids, context=context):
for item_id in version.items_id:
result.add(item_id.id)
return list(result)
_columns = {
'name': fields.char('Rule Name', help="Explicit rule name for this pricelist line."),
'price_version_id': fields.many2one('product.pricelist.version', 'Price List Version', required=True, select=True, ondelete='cascade'),
@@ -536,6 +544,8 @@ class product_pricelist_item(osv.osv):
'company_id': fields.related('price_version_id','company_id',type='many2one',
readonly=True, relation='res.company', string='Company', store={
'product.pricelist': (_get_product_pricelist, ['company_id'], 30),
'product.pricelist.version': (_get_product_pricelist_version, ['pricelist_id'], 30),
'product.pricelist.item': (lambda self, cr, uid, ids, c=None: ids, ['price_version_id'], 30),
})
}
+1
View File
@@ -928,6 +928,7 @@ class sale_order_line(osv.osv):
'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', store=True, string='Salesperson'),
'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store={
'sale.order': (_get_sale_order, ['company_id'], 20),
'sale.order.line': (lambda self, cr, uid, ids, c=None: ids, ['order_id'], 20),
}, readonly=True),
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation and the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}),
'procurement_ids': fields.one2many('procurement.order', 'sale_line_id', 'Procurements'),
-3
View File
@@ -4030,7 +4030,6 @@ class stock_package(osv.osv):
context = dict(context or {}, active_ids=ids)
return self.pool.get("report").get_action(cr, uid, ids, 'stock.report_package_barcode_small', context=context)
def unpack(self, cr, uid, ids, context=None):
quant_obj = self.pool.get('stock.quant')
for package in self.browse(cr, uid, ids, context=context):
@@ -4038,8 +4037,6 @@ class stock_package(osv.osv):
quant_obj.write(cr, SUPERUSER_ID, quant_ids, {'package_id': package.parent_id.id or False}, context=context)
children_package_ids = [child_package.id for child_package in package.children_ids]
self.write(cr, uid, children_package_ids, {'parent_id': package.parent_id.id or False}, context=context)
#delete current package since it contains nothing anymore
self.unlink(cr, uid, ids, context=context)
return self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'stock', 'action_package_view', context=context)
def get_content(self, cr, uid, ids, context=None):
+1 -1
View File
@@ -84,7 +84,7 @@ instance.web_gantt.GanttView = instance.web.View.extend({
if (group_bys.length == 0) {
group_bys = ["_pseudo_group_by"];
_.each(tasks, function(el) {
el._pseudo_group_by = "Gantt View";
el._pseudo_group_by = _t("Gantt View");
});
this.fields._pseudo_group_by = {type: "string"};
}
+5 -2
View File
@@ -740,8 +740,11 @@ class BaseModel(object):
cls = type(self)
methods = []
for attr, func in getmembers(cls, is_constraint):
if not all(name in cls._fields for name in func._constrains):
_logger.warning("@constrains%r parameters must be field names", func._constrains)
for name in func._constrains:
if name not in cls._fields:
_logger.warning("method %s.%s: @constrains parameter %r is not a field name", cls._name, attr, name)
if not cls._fields[name].store:
_logger.warning("method %s.%s: @constrains parameter %r is not stored", cls._name, attr, name)
methods.append(func)
# optimization: memoize result on cls, it will not be recomputed