[REM] Removed many2onebutton widget from account_voucher, now in view_form.js and view_list.js, as standard widget.
bzr revid: vta@openerp.com-20121105125346-v8hgfn157ef0j8fl
This commit is contained in:
parent
c75d260505
commit
c4fe6c2f58
|
@ -1055,7 +1055,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_move_line_tree" model="ir.ui.view">
|
||||
<record id="view_move_line_tree" model="ir.ui.view">
|
||||
<field name="name">account.move.line.tree</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field eval="4" name="priority"/>
|
||||
|
@ -1850,7 +1850,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_subscription_search" model="ir.ui.view">
|
||||
<record id="view_subscription_search" model="ir.ui.view">
|
||||
<field name="name">account.subscription.search</field>
|
||||
<field name="model">account.subscription</field>
|
||||
<field name="arch" type="xml">
|
||||
|
|
|
@ -60,15 +60,6 @@ This module manages:
|
|||
'security/account_voucher_security.xml',
|
||||
'account_voucher_data.xml',
|
||||
],
|
||||
'js': [
|
||||
'static/src/js/account_voucher_reconciliation.js',
|
||||
],
|
||||
'qweb' : [
|
||||
'static/src/xml/account_voucher_reconciliation.xml',
|
||||
],
|
||||
'css': [
|
||||
#'static/src/css/account_voucher_reconciliation.css',
|
||||
],
|
||||
'test' : [
|
||||
'test/account_voucher.yml',
|
||||
'test/sales_receipt.yml',
|
||||
|
|
|
@ -212,7 +212,7 @@
|
|||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
|
||||
<field name="voucher_id" widget="account_voucher_field" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
|
||||
<field name="voucher_id" widget="many2onebutton" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -223,7 +223,7 @@
|
|||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/form/group/field[@name='sequence']" position="before">
|
||||
<field name="voucher_id" widget="account_voucher_field" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
|
||||
<field name="voucher_id" widget="many2onebutton" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
openerp.account_voucher = function (instance) {
|
||||
var _t = instance.web._t,
|
||||
_lt = instance.web._lt;
|
||||
var QWeb = instance.web.qweb;
|
||||
|
||||
instance.web.account_voucher = {};
|
||||
|
||||
instance.web.form.widgets.add('account_voucher_field', 'instance.web.account_voucher.AccountVoucherField');
|
||||
instance.web.account_voucher.AccountVoucherField = instance.web.form.AbstractField.extend({
|
||||
template: 'FieldAccountVoucher',
|
||||
init: function(field_manager, node) {
|
||||
this._super.apply(this, arguments);
|
||||
var self = this;
|
||||
this.set('value', false);
|
||||
},
|
||||
start: function() {
|
||||
this._super.apply(this, arguments);
|
||||
var self = this;
|
||||
this.string = this.get('value') ? _t('Edit') : _t('Create');
|
||||
this.node.attrs.icon = this.get('value') ? '/web/static/src/img/icons/gtk-yes.png' : '/web/static/src/img/icons/gtk-no.png';
|
||||
this.$button = $(QWeb.render('WidgetButton', {'widget': this}));
|
||||
this.$el.append(this.$button);
|
||||
this.$button.on('click', self.on_click);
|
||||
},
|
||||
on_click: function(ev) {
|
||||
var self = this;
|
||||
ev.stopPropagation();
|
||||
var popup = new instance.web.form.FormOpenPopup(this);
|
||||
popup.show_element(
|
||||
this.field.relation,
|
||||
this.get('value'),
|
||||
this.build_context(),
|
||||
{title: _t("Voucher: ") + this.string}
|
||||
);
|
||||
popup.on('create_completed write_completed', self, function(r){
|
||||
self.set_value(r);
|
||||
});
|
||||
},
|
||||
set_value: function(value_) {
|
||||
var self = this;
|
||||
if (value_ instanceof Array) {
|
||||
value_ = value_[0];
|
||||
}
|
||||
value_ = value_ || false;
|
||||
this.set('value', value_);
|
||||
if (this.is_started) {
|
||||
this.render_value();
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
instance.web.list.columns.add('field.account_voucher_field', 'instance.web.list.AccountVoucherField');
|
||||
instance.web.list.AccountVoucherField = instance.web.list.Column.extend({
|
||||
_format: function (row_data, options) {
|
||||
if (row_data.voucher_id.value) {
|
||||
this.icon = '/web/static/src/img/icons/gtk-yes.png';
|
||||
} else {
|
||||
this.icon = '/web/static/src/img/icons/gtk-no.png';
|
||||
}
|
||||
return QWeb.render('FieldAccountVoucher.cell', {'widget': this});
|
||||
},
|
||||
});
|
||||
|
||||
};
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- vim:fdl=1:
|
||||
-->
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-name="FieldAccountVoucher">
|
||||
<span class="oe_form_field">
|
||||
</span>
|
||||
</t>
|
||||
|
||||
<t t-name="FieldAccountVoucher.cell"
|
||||
><img t-if="widget.icon" t-att-src="_s + widget.icon" width="16" height="16"/>
|
||||
</t>
|
||||
|
||||
</templates>
|
Loading…
Reference in New Issue