<field name="model">account.move.line</field>
<field eval="24" name="priority"/>
<field name="arch" type="xml">
- <tree_account_move_line_quickadd colors="red:state == 'draft';black:state == 'valid'" string="Journal Items to Reconcile" create="true" on_write="on_create_write" version="7.0" editable="bottom">
+ <tree_account_move_line_quickadd colors="red:state == 'draft';black:state == 'valid'" string="Journal Items to Reconcile" create="true" on_write="on_create_write" version="7.0" editable="top">
<field name="date"/>
<field name="move_id" required="0"/>
<field name="ref"/>
-openerp.account = function (instance) {
+
+openerp.account.quickadd = function (instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
this.$el.prepend(QWeb.render("AccountMoveLineQuickAdd", {widget: this}));
- this.$("#oe_account_select_journal").change(function() {
+ this.$(".oe_account_select_journal").change(function() {
self.current_journal = parseInt(this.value);
self.do_search(self.last_domain, self.last_context, self.last_group_by);
});
- this.$("#oe_account_select_period").change(function() {
+ this.$(".oe_account_select_period").change(function() {
self.current_period = parseInt(this.value);
self.do_search(self.last_domain, self.last_context, self.last_group_by);
});
this.last_group_by = group_by;
this.old_search = _.bind(this._super, this);
var mod = new instance.web.Model("account.move.line", context, domain);
- return new instance.web.Model("account.move.line", context, domain);
- $.when(mod.call("list_journals", []).then(function(result) {
+ return $.when(mod.call("list_journals", []).then(function(result) {
self.journals = result;
}),mod.call("list_periods", []).then(function(result) {
self.periods = result;
["journal_id", "=", self.current_journal],
["period_id", "=", self.current_period]
]);
- var cc = new instance.web.CompoundContext(this.last_context, {
+ //1
+ /*var ncontext = {
+ "journal_id": self.current_journal,
+ "period_id" :self.current_period,
+ };
+ var new instance.web.CompoundDomain(self.last_domain = new instance.web.CompoundContext(this.last_context, ncontext);
+
+ _.extend(this.dataset.context, ncontext);
+ */
+ //2
+ /*
+ var compoundContext = new instance.web.CompoundContext(self.last_context,{
"journal_id": self.current_journal,
"period_id" :self.current_period,
});
- return self.old_search(compoundDomain, cc, self.last_group_by);
+ */
+ //3
+ self.last_context["journal_id"] = self.current_journal;
+ self.last_context["period_id"] = self.current_period;
+ var compoundContext = self.last_context;
+ return self.old_search(compoundDomain, compoundContext, self.last_group_by);
},
- _next: function (next_record, options) {
+ /*_next: function (next_record, options) {
next_record = next_record || 'succ';
var self = this;
return this.save_edition().then(function (saveInfo) {
saveInfo.record, {wraparound: true});
return self.start_edition(record, options);
});
- },
+ },*/
});
};
openerp.account = function (instance) {
+ openerp.account.quickadd(instance);
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
- instance.web.account = {};
+ instance.web.account = instance.web.account || {};
instance.web.views.add('tree_account_reconciliation', 'instance.web.account.ReconciliationListView');
instance.web.account.ReconciliationListView = instance.web.ListView.extend({
this.last_group_by = group_by;
this.old_search = _.bind(this._super, this);
var mod = new instance.web.Model("account.move.line", context, domain);
- return mod.call("list_partners_to_reconcile", []).pipe(function(result) {
+ return mod.call("list_partners_to_reconcile", []).then(function(result) {
var current = self.current_partner !== null ? self.partners[self.current_partner][0] : null;
self.partners = result;
var index = _.find(_.range(self.partners.length), function(el) {
return fct();
} else {
return new instance.web.Model("res.partner").call("read",
- [self.partners[self.current_partner][0], ["last_reconciliation_date"]]).pipe(function(res) {
+ [self.partners[self.current_partner][0], ["last_reconciliation_date"]]).then(function(res) {
self.last_reconciliation_date =
instance.web.format_value(res.last_reconciliation_date, {"type": "datetime"}, _t("Never"));
return fct();
return false;
}
- new instance.web.Model("ir.model.data").call("get_object_reference", ["account", "action_view_account_move_line_reconcile"]).pipe(function(result) {
+ new instance.web.Model("ir.model.data").call("get_object_reference", ["account", "action_view_account_move_line_reconcile"]).then(function(result) {
var additional_context = _.extend({
active_id: ids[0],
active_ids: ids,
return self.rpc("/web/action/load", {
action_id: result[1],
context: additional_context
- }).then(function (result) {
+ }).done(function (result) {
result.context = _.extend(result.context || {}, additional_context);
result.flags = result.flags || {};
result.flags.new_window = true;
mark_as_reconciled: function() {
var self = this;
var id = self.partners[self.current_partner][0];
- new instance.web.Model("res.partner").call("mark_as_reconciled", [[id]]).pipe(function() {
+ new instance.web.Model("res.partner").call("mark_as_reconciled", [[id]]).then(function() {
self.do_search(self.last_domain, self.last_context, self.last_group_by);
});
},
this._super.apply(this, arguments);
},
});
+
};
<templates id="template" xml:space="preserve">
<t t-name="AccountMoveLineQuickAdd">
- <div class="oe_account_quickadd">
+ <div class="select2-container oe_account_quickadd">
<div>
Journal :
- <select id="oe_account_select_journal">
+ <select class="oe_account_select_journal select2-choice" >
<t t-foreach="widget.journals" t-as="journal">
<option t-if=" journal[0] === widget.current_journal" t-att-value="journal[0]" selected="selected">
<t t-esc="journal[1]"/>
</t>
</select>
Period :
- <select id="oe_account_select_period">
+ <select class="oe_account_select_period select2-choice">
<t t-foreach="widget.periods" t-as="period">
<option t-if=" period[0] === widget.current_period" t-att-value="period[0]" selected="selected">
<t t-esc="period[1]"/>