[IMP] remove addition field from act_window, pass it through context of action
bzr revid: rgaopenerp-20120807084410-1w2jycfedlgg80f0
This commit is contained in:
parent
ce3973795d
commit
7cf4fb8779
|
@ -66,8 +66,8 @@ financial year and for preparation of vouchers there is a module named account_v
|
|||
'wizard/account_period_close_view.xml',
|
||||
'wizard/account_reconcile_view.xml',
|
||||
'wizard/account_unreconcile_view.xml',
|
||||
'account_move_reconciliation.xml',
|
||||
'account_view.xml',
|
||||
'account_move_reconciliation.xml',
|
||||
'account_report.xml',
|
||||
'account_financial_report_data.xml',
|
||||
'wizard/account_report_common_view.xml',
|
||||
|
|
|
@ -22,13 +22,6 @@
|
|||
import tools
|
||||
from osv import fields,osv
|
||||
|
||||
class act_window(osv.osv):
|
||||
_inherit = 'ir.actions.act_window'
|
||||
_columns = {
|
||||
'extended_form_view_id': fields.many2one('ir.ui.view', 'Account form view ref.'),
|
||||
}
|
||||
act_window()
|
||||
|
||||
class res_partner(osv.osv):
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
|
|
|
@ -1601,7 +1601,7 @@
|
|||
<field eval="False" name="auto_search"/>
|
||||
<field name="extended_form_view_id" ref="view_account_move_reconciliation_form_view"/>
|
||||
<field name="domain">[('partner_id.customer','=',True)]</field>
|
||||
<field name="context">{'view_mode':True}</field>
|
||||
<field name="context" eval="{'view_mode':True, 'extended_form_view_id': ref('view_account_move_reconciliation_form_view')}"></field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_payable_manual_reconcile" model="ir.actions.act_window">
|
||||
|
@ -1610,9 +1610,8 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field eval="False" name="auto_search"/>
|
||||
<field name="extended_form_view_id" ref="view_account_move_reconciliation_form_view"/>
|
||||
<field name="domain">[('partner_id.supplier','=',True)]</field>
|
||||
<field name="context">{'view_mode':True}</field>
|
||||
<field name="context" eval="{'view_mode':True, 'extended_form_view_id': ref('view_account_move_reconciliation_form_view')}"></field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
|
|
|
@ -5,74 +5,27 @@ instance.web.views.add('form_clone', 'instance.account.extend_form_view');
|
|||
instance.web.form.tags.add('list_button','instance.account.list_button')
|
||||
instance.web.form.tags.add('btn_extend','instance.account.btn_extend')
|
||||
instance.web.form.widgets.add('many2one_pager','instance.account.many2one_pager')
|
||||
instance.account.extend_actionmanager = instance.web.ActionManager.include({
|
||||
ir_actions_act_window: function (action, on_close) {
|
||||
var self = this;
|
||||
if (_(['base.module.upgrade', 'base.setup.installer'])
|
||||
.contains(action.res_model)) {
|
||||
var old_close = on_close;
|
||||
on_close = function () {
|
||||
instance.webclient.do_reload().then(old_close);
|
||||
};
|
||||
}
|
||||
if (action.target === 'new') {
|
||||
if (this.dialog === null) {
|
||||
// These buttons will be overwrited by <footer> if any
|
||||
this.dialog = new instance.web.Dialog(this, {
|
||||
buttons: { "Close": function() { $(this).dialog("close"); }},
|
||||
dialogClass: 'oe_act_window'
|
||||
});
|
||||
if(on_close)
|
||||
this.dialog.on_close.add(on_close);
|
||||
} else {
|
||||
this.dialog_widget.destroy();
|
||||
}
|
||||
this.dialog.dialog_title = action.name;
|
||||
this.dialog_widget = new instance.web.ViewManagerAction(this, action);
|
||||
this.dialog_widget.appendTo(this.dialog.$element);
|
||||
this.dialog.open();
|
||||
} else {
|
||||
this.dialog_stop();
|
||||
if(action.menu_id) {
|
||||
return this.getParent().do_action(action, function () {
|
||||
instance.webclient.menu.open_menu(action.menu_id);
|
||||
});
|
||||
}
|
||||
this.inner_action = action;
|
||||
if (action.extended_form_view_id){
|
||||
var inner_widget = this.inner_widget = new instance.account.extend_viewmanager(this, action);
|
||||
}else{
|
||||
var inner_widget = this.inner_widget = new instance.web.ViewManagerAction(this, action);
|
||||
}
|
||||
inner_widget.add_breadcrumb();
|
||||
this.inner_widget.appendTo(this.$element);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
|
||||
init: function(parent, action) {
|
||||
this._super.apply(this, arguments);
|
||||
//Fix me: pass hard coded model name, find the way to fetch it from server
|
||||
this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.reconciliation', action.context, action.domain);
|
||||
},
|
||||
|
||||
instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
|
||||
start : function(){
|
||||
this._super()
|
||||
this.setup_exended_form_view(this)
|
||||
if(this.action.context && this.action.context.extended_form_view_id)
|
||||
this.setup_exended_form_view(this)
|
||||
},
|
||||
on_mode_switch: function (view_type, no_store, options) {
|
||||
self = this
|
||||
self.list_loaded = $.when(this._super.apply(this, arguments)).then(function () {
|
||||
self.list_view = self.views['list']
|
||||
if(self.action.context && self.action.context.extended_form_view_id)
|
||||
self.list_view = self.views['list']
|
||||
})
|
||||
},
|
||||
setup_exended_form_view: function(parent){
|
||||
var self = this,
|
||||
from_view,
|
||||
obj_from_view;
|
||||
view_id = this.action.extended_form_view_id[0]
|
||||
view_id = this.action.context.extended_form_view_id
|
||||
from_view = this.registry.get_object('form_clone');
|
||||
this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.reconciliation', this.action.context, this.action.domain);
|
||||
this.dataset_loaded = this.dataset_form.read_slice()
|
||||
obj_from_view = new from_view(self, this.dataset_form, view_id, options={});
|
||||
obj_from_view.template = 'ExtendedFormView'
|
||||
|
|
Loading…
Reference in New Issue