[FIX]Review checks bugs
authorDenis Ledoux dle@openerp.com <>
Mon, 12 Nov 2012 09:36:09 +0000 (10:36 +0100)
committerDenis Ledoux dle@openerp.com <>
Mon, 12 Nov 2012 09:36:09 +0000 (10:36 +0100)
bzr revid: dle@openerp.com-20121112093609-a8xy1yi364r5w9tn

addons/account/account_view.xml
addons/account/static/src/js/account_move_line_quickadd.js
addons/account/static/src/js/account_move_reconciliation.js
addons/account/static/src/xml/account_move_line_quickadd.xml

index 73980ae..354614e 100644 (file)
             <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"/>
index 70cb5fb..c12a2d8 100644 (file)
@@ -1,4 +1,5 @@
-openerp.account = function (instance) {
+
+openerp.account.quickadd = function (instance) {
     var _t = instance.web._t,
         _lt = instance.web._lt;
     var QWeb = instance.web.qweb;
@@ -23,11 +24,11 @@ openerp.account = function (instance) {
 
             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);
                 });
@@ -40,8 +41,7 @@ openerp.account = function (instance) {
             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;
@@ -59,13 +59,29 @@ openerp.account = function (instance) {
                 ["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) {
@@ -76,6 +92,6 @@ openerp.account = function (instance) {
                         saveInfo.record, {wraparound: true});
                 return self.start_edition(record, options);
             });
-        },
+        },*/
     });
 };
index eed5663..19c1941 100644 (file)
@@ -1,9 +1,10 @@
 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({
@@ -48,7 +49,7 @@ openerp.account = function (instance) {
             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) {
@@ -74,7 +75,7 @@ openerp.account = function (instance) {
                 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();
@@ -92,7 +93,7 @@ openerp.account = function (instance) {
                 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,
@@ -101,7 +102,7 @@ openerp.account = function (instance) {
                 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;
@@ -116,7 +117,7 @@ openerp.account = function (instance) {
         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);
             });
         },
@@ -125,4 +126,5 @@ openerp.account = function (instance) {
             this._super.apply(this, arguments);
         },
     });
+    
 };
index 8023ff4..4aa24d3 100644 (file)
@@ -3,10 +3,10 @@
 <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]"/>
@@ -17,7 +17,7 @@
                     </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]"/>