[FIX] point_of_sale: On product form : push on button 'Set a Custom Ean' on tab information raise an exception => Use a record action and clean python files

This commit is contained in:
Christophe Matthieu 2014-07-31 17:21:26 +02:00
parent 87a20d1cc3
commit 7efe3bb2d8
6 changed files with 10 additions and 39 deletions

View File

@ -1379,16 +1379,4 @@ class product_template(osv.osv):
'available_in_pos': True,
}
def edit_ean(self, cr, uid, ids, context):
return {
'name': _("Assign a Custom EAN"),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.ean_wizard',
'target' : 'new',
'view_id': False,
'context':context,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -523,6 +523,13 @@
<menuitem action="product_pos_category_action" id="menu_product_pos_category" parent="menu_point_of_sale_product" sequence="0" />
<!-- END -->
<record id="action_edit_ean" model="ir.actions.act_window">
<field name="name">Edit Ean</field>
<field name="res_model">pos.ean_wizard</field>
<field name="target">new</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
@ -539,7 +546,7 @@
</group>
</group>
<field name="ean13" position="after">
<button colspan="2" name="edit_ean" type="object" string="Set a Custom EAN" class="oe_link oe_edit_only"/>
<button colspan="2" name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" class="oe_link oe_edit_only"/>
</field>
</field>
</record>

View File

@ -18,18 +18,6 @@ class res_users(osv.osv):
for user in self.browse(cr, uid, ids, context=context)
)
def edit_ean(self, cr, uid, ids, context):
return {
'name': "Edit Ean",
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.ean_wizard',
'target' : 'new',
'view_id': False,
'context':context,
}
_constraints = [
(_check_ean, "Error: Invalid ean code", ['ean13'],),
]

View File

@ -11,7 +11,7 @@
<page string="Point of Sale">
<group>
<field name="ean13" />
<button name="edit_ean" type="object" string="Edit" />
<button name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" />
</group>
</page>
</notebook>

View File

@ -19,18 +19,6 @@ class res_users(osv.osv):
for user in self.browse(cr, uid, ids, context=context)
)
def edit_ean(self, cr, uid, ids, context):
return {
'name': "Edit EAN",
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.ean_wizard',
'target' : 'new',
'view_id': False,
'context':context,
}
_constraints = [
(_check_ean, "Error: Invalid ean code", ['ean13'],),
]

View File

@ -23,7 +23,7 @@
<group>
<field name="pos_config" />
<field name="ean13" />
<button name="edit_ean" type="object" string="Edit EAN" class="oe_edit_only" />
<button name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" class="oe_edit_only" />
</group>
</page>
</notebook>