end_date = default_end_date
if start_date and end_date:
- return (start_date.strftime(DF), end_date.strftime(DF))
+ return (datetime.strftime(start_date, DF), datetime.strftime(end_date, DF))
else:
return (start_date, end_date)
##### Automatic actions #####
- def generate_goals_from_challenge(self, cr, uid, ids, context=None):
- _logger.warning("Deprecated, use private method _generate_goals_from_challenge(...) instead.")
- return self._generate_goals_from_challenge(cr, uid, ids, context=context)
-
def _generate_goals_from_challenge(self, cr, uid, ids, context=None):
"""Generate the goals for each line and user.
help="Small-sized image of the product. It is automatically "\
"resized as a 64x64px image, with aspect ratio preserved. "\
"Use this field anywhere a small image is required."),
-
+ 'packaging_ids': fields.one2many(
+ 'product.packaging', 'product_tmpl_id', 'Logistical Units',
+ help="Gives the different ways to package the same product. This has no impact on "
+ "the picking order and is mainly used if you use the EDI module."),
'seller_ids': fields.one2many('product.supplierinfo', 'product_tmpl_id', 'Supplier'),
'seller_delay': fields.related('seller_ids','delay', type='integer', string='Supplier Lead Time',
help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
if not context or "create_product_product" not in context:
self.create_variant_ids(cr, uid, [product_template_id], context=context)
self._set_standard_price(cr, uid, product_template_id, vals.get('standard_price', 0.0), context=context)
+
+ # TODO: this is needed to set given values to first variant after creation
+ # these fields should be moved to product as lead to confusion
+ related_vals = {}
+ if vals.get('ean13'):
+ related_vals['ean13'] = vals['ean13']
+ if vals.get('default_code'):
+ related_vals['default_code'] = vals['default_code']
+ if related_vals:
+ self.write(cr, uid, product_template_id, related_vals, context=context)
+
return product_template_id
def write(self, cr, uid, ids, vals, context=None):
'active': fields.boolean('Active', help="If unchecked, it will allow you to hide the product without removing it."),
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade", select=True),
'ean13': fields.char('EAN13 Barcode', size=13, help="International Article Number used for product identification."),
- 'packaging': fields.one2many('product.packaging', 'product_id', 'Packaging', help="Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."),
'name_template': fields.related('product_tmpl_id', 'name', string="Template Name", type='char', store={
'product.template': (_get_name_template_ids, ['name'], 10),
'product.product': (lambda self, cr, uid, ids, c=None: ids, [], 10),
'ul_container': fields.many2one('product.ul', 'Pallet Logistic Unit'),
'rows' : fields.integer('Number of Layers', required=True,
help='The number of layers on a pallet or box'),
- 'product_id' : fields.many2one('product.product', 'Product', select=1, ondelete='cascade', required=True),
+ 'product_tmpl_id' : fields.many2one('product.template', 'Product', select=1, ondelete='cascade', required=True),
'ean' : fields.char('EAN', size=14, help="The EAN code of the package unit."),
'code' : fields.char('Code', help="The code of the transport unit."),
'weight': fields.float('Total Package Weight',
element: "#customize-menu a:contains(Product Attribute's Filters)",
},
{
- title: "select product attribute memory 16 Go",
- element: 'form.js_attributes label:contains(16 Go) input:not(:checked)',
+ title: "select product attribute memory 16 GB",
+ element: 'form.js_attributes label:contains(16 GB) input:not(:checked)',
},
{
title: "check the selection",
- waitFor: 'form.js_attributes label:contains(16 Go) input:checked',
+ waitFor: 'form.js_attributes label:contains(16 GB) input:checked',
},
{
title: "select ipod",
},
{
title: "finish",
- waitFor: 'label:contains(32 GB) input',
+ waitFor: 'form[action="/shop/cart/update"] label:contains(32 Go) input',
}
]
});
element: '.oe_product_cart a:contains("iPod")',
},
{
- title: "select ipod 32Go",
+ title: "select ipod 32GB",
waitFor: '#product_detail',
- element: 'label:contains(32 Go) input',
+ element: 'label:contains(32 GB) input',
},
{
title: "click on add to cart",
- waitFor: 'label:contains(32 Go) input[checked]',
+ waitFor: 'label:contains(32 GB) input[checked]',
element: 'form[action="/shop/cart/update"] .btn',
},
{
{
title: "add one more iPod",
waitFor: '.my_cart_quantity:contains(2)',
- element: '#cart_products tr:contains("32 Go") a.js_add_cart_json:eq(1)',
+ element: '#cart_products tr:contains("32 GB") a.js_add_cart_json:eq(1)',
},
{
title: "remove Headphones",
- waitFor: '#cart_products tr:contains("32 Go") input.js_quantity[value=2]',
+ waitFor: '#cart_products tr:contains("32 GB") input.js_quantity[value=2]',
element: '#cart_products tr:contains("Apple In-Ear Headphones") a.js_add_cart_json:first',
},
{