Browse Source

*Modify XML view (style image field)

*Override javascript method original POS (get_image_url)
pull/52/head
cellsnake 9 years ago
parent
commit
e6fcf09627
  1. 8
      pos_remove_pos_category/static/src/js/pos_remove_pos_category.js
  2. 1269
      pos_remove_pos_category/static/src/js/widgets2.js
  3. 22
      pos_remove_pos_category/views/pos_category.xml

8
pos_remove_pos_category/static/src/js/pos_remove_pos_category.js

@ -33,4 +33,12 @@ openerp.pos_remove_pos_category = function(instance, local) {
return initialize_original.call(this, session, attributes); return initialize_original.call(this, session, attributes);
} }
}); });
//override method js POS (widgets.js)
//change pos.category by product.category
module.ProductCategoriesWidget = module.ProductCategoriesWidget.extend({
get_image_url: function(category){
return window.location.origin + '/web/binary/image?model=product.category&field=image_medium&id='+category.id;
}
});
}; };

1269
pos_remove_pos_category/static/src/js/widgets2.js
File diff suppressed because it is too large
View File

22
pos_remove_pos_category/views/pos_category.xml

@ -2,13 +2,16 @@
<openerp> <openerp>
<data> <data>
<template id="assets_backend" name="pos_remove_pos_category assets" inherit_id="web.assets_backend">
<template id="assets_backend" name="pos_remove_pos_category assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<script type="text/javascript" src="/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js"></script>
<script type="text/javascript"
src="/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js"></script>
</xpath> </xpath>
<xpath expr="//script[@src='/point_of_sale/static/src/js/widgets.js']" position="attributes">
<!--<xpath expr="//script[@src='/point_of_sale/static/src/js/widgets.js']"
position="attributes">
<attribute name="src">/pos_remove_pos_category/static/src/js/widgets2.js</attribute> <attribute name="src">/pos_remove_pos_category/static/src/js/widgets2.js</attribute>
</xpath>
</xpath> -->
</template> </template>
<record id="product_category_form_view" model="ir.ui.view"> <record id="product_category_form_view" model="ir.ui.view">
@ -18,12 +21,16 @@
<field name="priority">20</field> <field name="priority">20</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//group[@name='parent']" position="inside"> <xpath expr="//group[@name='parent']" position="inside">
<field name="available_in_pos"/>
</xpath>
<field name="name" position="after">
<div class="oe_bottom" style="margin-top: 10px;">
<field name="image" <field name="image"
widget="image" widget="image"
class="oe_left oe_avatar" class="oe_left oe_avatar"
options='{"size": [100, 100]}' />
<field name="available_in_pos"/>
</xpath>
options='{"size": [100, 100]}'/>
</div>
</field>
</field> </field>
</record> </record>
@ -36,6 +43,5 @@
</xpath> </xpath>
</field> </field>
</record> </record>
</data> </data>
</openerp> </openerp>
Loading…
Cancel
Save