Browse Source

Merge pull request #2 from cellsnake/cellsnake-pos_category_button_with_image-1

pos product category buttons with image
pull/51/head
Juan Carls M. 10 years ago
parent
commit
2c11c85aa5
  1. 11
      pos_remove_pos_category/product.py
  2. 1
      pos_remove_pos_category/views/pos_category.xml

11
pos_remove_pos_category/product.py

@ -44,12 +44,23 @@ class ProductTemplate(models.Model):
class ProductCategory(models.Model):
_inherit = 'product.category'
image = fields.Binary(help='Show Image Category in Form View')
image_medium = fields.Binary(help='Show image category button in POS')
available_in_pos = fields.Boolean(
string="Available in the Point of Sale",
default=True,
help="Check if you want this category to appear in Point Of Sale.\n"
"If you uncheck, children categories will becomes invisible too, "
"whatever their checkbox state.")
@api.one
@api.constrains('image')
def _save_image_medium(self):
if self.image:
temp = tools.image_get_resized_images(self.image)
return self.write({'image_medium': temp['image_medium']})
else:
return self.write({'image_medium': None})
_auto_end_original = models.BaseModel._auto_end

1
pos_remove_pos_category/views/pos_category.xml

@ -15,6 +15,7 @@
<field name="priority">20</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='parent']" position="inside">
<field name="image" widget="image"/>
<field name="available_in_pos"/>
</xpath>
</field>

Loading…
Cancel
Save