简体   繁体   English

通过Odoo中的按钮在销售点界面中调用子窗口

[英]Call a Sub Window In Point Of Sale interface through button in Odoo

I need to ask if there is way to call a child window in the 'Point Of Sale' interface in Odoo-8. 我需要问问是否有办法在Odoo-8的“销售点”界面中调用子窗口。 My scenario is that I have a button on the POS interface and I need to call sub/child window through that button . 我的情况是我在POS界面上有一个按钮,我需要通过该按钮调用子/子窗口。 The window will have some buttons and some textboxes to take input from the user. 该窗口将具有一些按钮和一些文本框,以接受用户的输入。 I can show pop_up form with Error message on it. 我可以显示带有错误消息的pop_up表单。 But I need to call a form with fields and button. 但是我需要调用带有字段和按钮的表单。 Any help or guidance will be appreciated. 任何帮助或指导将不胜感激。 Thanks n Regards 谢谢n问候

This can be done be making the button call a function which returns a ir.action.act_window. 可以通过使按钮调用返回ir.action.act_window的函数来完成。

Example from base_export_languages 来自base_export_languages的示例

return {
            'type': 'ir.actions.act_window',
            'res_model': 'base.language.export',
            'view_mode': 'form',
            'view_type': 'form',
            'res_id': this.id,
            'views': [(False, 'form')],
            'target': 'new',
        }

This will open a window with a model. 这将打开一个带有模型的窗口。 You probably need to make a new model where you keep new data and views. 您可能需要创建一个新模型来保留新数据和视图。 Also you can specify view with 'view_id': view_id, but keep in mind that view_id must be a id as integer. 您也可以使用'view_id': view_id,指定视图'view_id': view_id,但请记住,view_id必须是一个ID(整数)。

Hopefully this will be helpful to you. 希望这会对您有所帮助。

You have to create widget for that. 您必须为此创建小部件。 So basically create one template file and js file to handle button click and other operations. 因此,基本上创建一个模板文件和js文件来处理按钮单击和其他操作。

How to create widget and its basic: https://www.odoo.com/documentation/8.0/howtos/web.html 如何创建小部件及其基本功能: https : //www.odoo.com/documentation/8.0/howtos/web.html

For example see pos_discount module. 例如,请参见pos_discount模块。

Feel free to ask if any issue arises. 随时询问是否出现任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM