|
@ -20,7 +20,7 @@ |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
|
|
|
|
|
|
import sys |
|
|
import sys |
|
|
from openerp import models, fields, api |
|
|
|
|
|
|
|
|
from openerp import models, fields, api, tools |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProductTemplate(models.Model): |
|
|
class ProductTemplate(models.Model): |
|
@ -44,6 +44,11 @@ class ProductTemplate(models.Model): |
|
|
class ProductCategory(models.Model): |
|
|
class ProductCategory(models.Model): |
|
|
_inherit = 'product.category' |
|
|
_inherit = 'product.category' |
|
|
|
|
|
|
|
|
|
|
|
image = fields.Binary(help='Show Image Category in Form View') |
|
|
|
|
|
image_medium = fields.Binary(help='Show image category button in POS', |
|
|
|
|
|
compute="_get_image", |
|
|
|
|
|
inverse="_set_image", |
|
|
|
|
|
store=True) |
|
|
available_in_pos = fields.Boolean( |
|
|
available_in_pos = fields.Boolean( |
|
|
string="Available in the Point of Sale", |
|
|
string="Available in the Point of Sale", |
|
|
default=True, |
|
|
default=True, |
|
@ -51,6 +56,17 @@ class ProductCategory(models.Model): |
|
|
"If you uncheck, children categories will becomes invisible too, " |
|
|
"If you uncheck, children categories will becomes invisible too, " |
|
|
"whatever their checkbox state.") |
|
|
"whatever their checkbox state.") |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
def _get_image(self): |
|
|
|
|
|
return dict( |
|
|
|
|
|
(rec.id, tools.image_get_resized_images(rec.image)) for rec in |
|
|
|
|
|
self) |
|
|
|
|
|
|
|
|
|
|
|
@api.one |
|
|
|
|
|
def _set_image(self): |
|
|
|
|
|
return self.write( |
|
|
|
|
|
{'image': tools.image_resize_image_big(self.image_medium)}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_auto_end_original = models.BaseModel._auto_end |
|
|
_auto_end_original = models.BaseModel._auto_end |
|
|
|
|
|
|
|
@ -87,4 +103,5 @@ def _auto_end(self, cr, context=None): |
|
|
self._foreign_keys = foreign_keys |
|
|
self._foreign_keys = foreign_keys |
|
|
return _auto_end_original(self, cr, context=context) |
|
|
return _auto_end_original(self, cr, context=context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models.BaseModel._auto_end = _auto_end |
|
|
models.BaseModel._auto_end = _auto_end |