Merge lp:~openerp-dev/openerp-web/trunk-popup-alertbox-cod into lp:~openerp-dev/openerp-web/trunk-improve-translation

Proposed by Chirag Dodiya(OpenERP)
Status: Merged
Merged at revision: 3929
Proposed branch: lp:~openerp-dev/openerp-web/trunk-popup-alertbox-cod
Merge into: lp:~openerp-dev/openerp-web/trunk-improve-translation
Diff against target: 60 lines (+32/-0)
2 files modified
addons/web/static/src/js/view_form.js (+26/-0)
addons/web/static/src/xml/base.xml (+6/-0)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-popup-alertbox-cod
Reviewer Review Type Date Requested Status
Vidhin Mehta (OpenERP) Pending
Review via email: mp+204209@code.launchpad.net

Description of the change

Hello,

    i have added translation alertbox, for translatable field,
     when record save then it will popup.

Thanks,
Chirag Dodiya(cod).

To post a comment you must log in.
3929. By Vidhin Mehta (OpenERP)

[MERGE]cod's branch improvments for alert.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/view_form.js'
2--- addons/web/static/src/js/view_form.js 2014-01-31 00:52:02 +0000
3+++ addons/web/static/src/js/view_form.js 2014-01-31 12:10:48 +0000
4@@ -731,6 +731,7 @@
5 var self = this;
6 return this.save().done(function(result) {
7 self.trigger("save", result);
8+ self.popup_alertbox();
9 self.reload().then(function() {
10 self.to_view_mode();
11 var parent = self.ViewManager.ActionManager.getParent();
12@@ -740,6 +741,31 @@
13 });
14 });
15 },
16+ popup_alertbox: function() {
17+ var self = this;
18+ template = 'alertbox';
19+ var temp = $(QWeb.render(template, {'widget':self}));
20+ this.$el.find('#alertbox').remove();
21+ this.$el.find('.oe_form_sheet').before(temp);
22+ var data = $(this).parent();
23+ var dataset = data.prevObject[0].dataset
24+ this.$el.find('#trans_link').click(function(parent){
25+ var name = dataset.model;
26+ var lang = dataset.context.lang;
27+ var res_id = dataset.context.params.id;
28+ var trans = new instance.web.DataSet(this, 'ir.translation')
29+ return new instance.web.Model("ir.translation").query(["id"]).filter([["res_id", "=", res_id],["lang", "=", lang],["name", "=", name]]).first()
30+ .done(function(res){
31+ self.do_action({
32+ type: 'ir.actions.act_window',
33+ res_model: 'ir.translation',
34+ res_id: res.id,
35+ views: [[false, 'form']],
36+ target: 'current',
37+ });
38+ });
39+ });
40+ },
41 on_button_cancel: function(event) {
42 if (this.can_be_discarded()) {
43 if (this.get('actual_mode') === 'create') {
44
45=== modified file 'addons/web/static/src/xml/base.xml'
46--- addons/web/static/src/xml/base.xml 2014-01-31 11:59:30 +0000
47+++ addons/web/static/src/xml/base.xml 2014-01-31 12:10:48 +0000
48@@ -1888,6 +1888,12 @@
49 Name: <input class="oe_form_m2o_input_name" type="text"/>
50 </div>
51 </t>
52+<t t-name="alertbox">
53+ <div id="alertbox" class="alert alert-warning" style="line-height: 40%;">You have updated the <b>Product Name</b> for [A1090] iMac in <b>French</b>.
54+ <a id="trans_link" href="#">Update translations</a>
55+ <a class="close" data-dismiss="alert" href="#" aria-hidden="true" style=" line-height: 40%;">x</a>
56+ </div>
57+</t>
58 <t t-name="M2ODialog.buttons">
59 <button class="oe_form_m2o_qc_button oe_button oe_highlight">Quick Add</button>
60 <button class="oe_form_m2o_sc_button oe_button">Add All Info...</button>

Subscribers

People subscribed via source and target branches

to all changes: