Merge lp:~openerp-dev/openobject-addons/trunk-hr_timesheet-aja into lp:openobject-addons

Proposed by ajay javiya (OpenERP)
Status: Work in progress
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-hr_timesheet-aja
Merge into: lp:openobject-addons
Diff against target: 318 lines (+69/-72)
9 files modified
analytic/analytic.py (+0/-1)
hr_timesheet_sheet/hr_timesheet_sheet.py (+5/-1)
hr_timesheet_sheet/hr_timesheet_sheet_demo.xml (+3/-4)
hr_timesheet_sheet/static/src/css/timesheet.css (+3/-1)
hr_timesheet_sheet/static/src/css/timesheet.sass (+4/-0)
hr_timesheet_sheet/static/src/js/timesheet.js (+44/-13)
hr_timesheet_sheet/static/src/xml/timesheet.xml (+10/-2)
web_shortcuts/i18n/bs.po (+0/-25)
web_shortcuts/i18n/fi.po (+0/-25)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-hr_timesheet-aja
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+166179@code.launchpad.net

Description of the change

Hello,
  Improve code for:
  > the time fields should be a float time, not a simple float.
  > add a descritpion field after the analytic account.
  > add a line should be a link.
  >there shouldn't be a [add]. when adding a line, it should directly create the line.
Thank You.

To post a comment you must log in.
8734. By ajay javiya (OpenERP)

[FIX]:on change textarea value lost

8735. By ajay javiya (OpenERP)

[IMP]: on change of global description change line name(description)

8736. By ajay javiya (OpenERP)

[IMP] : code on_change hours change all description of each line

8737. By ajay javiya (OpenERP)

[IMP]: code and remove unwanted rpc call

8738. By ajay javiya (OpenERP)

[REM]: unwanted variables

8739. By ajay javiya (OpenERP)

[MERG]: with trunk

8740. By ajay javiya (OpenERP)

[IMP] : call sync after change and code cleaning

8741. By Vidhin Mehta (OpenERP)

[MERGE]Trunk.

8742. By Paramjit Singh Sahota(OpenERP)

[MERGE] Sync with lp:openobject-addons.

8743. By Vidhin Mehta (OpenERP)

[IMP] Changes to timesheet.

8744. By Paramjit Singh Sahota(OpenERP)

[MERGE] Sync with lp:openobject-addons.

8745. By Paramjit Singh Sahota(OpenERP)

[IMP]Solved the issue of FALSE in global description and added demo data for hr_timesheet_sheet.

8746. By Paramjit Singh Sahota(OpenERP)

[MERGE] Sync with lp:openobject-addons.

8747. By Paramjit Singh Sahota(OpenERP)

[IMP] Now the global description will be different for days from where it is changed.

8748. By Paramjit Singh Sahota(OpenERP)

[IMP] Revert the code of if condition as present in rev no 8743.

8749. By Paramjit Singh Sahota(OpenERP)

[MERGE] Merged lp:openobject-addons.

8750. By ajay javiya (OpenERP)

[MERGE]: with trunk

8751. By ajay javiya (OpenERP)

[IMP]: Rename from global_desc to sheet_note
-> remove unwanted demo data

8752. By ajay javiya (OpenERP)

[FIX]: traceback : null value in column 'name' violates not-null constraint

8753. By ajay javiya (OpenERP)

[MERGE]: with trunk

8754. By ajay javiya (OpenERP)

[MERGE]: with trunk

Unmerged revisions

8754. By ajay javiya (OpenERP)

[MERGE]: with trunk

8753. By ajay javiya (OpenERP)

[MERGE]: with trunk

8752. By ajay javiya (OpenERP)

[FIX]: traceback : null value in column 'name' violates not-null constraint

8751. By ajay javiya (OpenERP)

[IMP]: Rename from global_desc to sheet_note
-> remove unwanted demo data

8750. By ajay javiya (OpenERP)

[MERGE]: with trunk

8749. By Paramjit Singh Sahota(OpenERP)

[MERGE] Merged lp:openobject-addons.

8748. By Paramjit Singh Sahota(OpenERP)

[IMP] Revert the code of if condition as present in rev no 8743.

8747. By Paramjit Singh Sahota(OpenERP)

[IMP] Now the global description will be different for days from where it is changed.

8746. By Paramjit Singh Sahota(OpenERP)

[MERGE] Sync with lp:openobject-addons.

8745. By Paramjit Singh Sahota(OpenERP)

[IMP]Solved the issue of FALSE in global description and added demo data for hr_timesheet_sheet.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'analytic/analytic.py'
2--- analytic/analytic.py 2013-09-10 12:48:03 +0000
3+++ analytic/analytic.py 2013-11-11 05:48:01 +0000
4@@ -320,7 +320,6 @@
5 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='restrict', select=True, domain=[('type','<>','view')]),
6 'user_id': fields.many2one('res.users', 'User'),
7 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
8-
9 }
10
11 def _get_default_date(self, cr, uid, context=None):
12
13=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
14--- hr_timesheet_sheet/hr_timesheet_sheet.py 2013-09-17 12:21:02 +0000
15+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2013-11-11 05:48:01 +0000
16@@ -544,6 +544,10 @@
17 'timesheet_max_difference': lambda *args: 0.0
18 }
19
20-
21+class hr_analytic_timesheet(osv.osv):
22+ _inherit = 'hr.analytic.timesheet'
23+ _columns = {
24+ 'sheet_note':fields.text('Sheet Note'),
25+ }
26 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
27
28
29=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet_demo.xml'
30--- hr_timesheet_sheet/hr_timesheet_sheet_demo.xml 2012-11-29 22:26:45 +0000
31+++ hr_timesheet_sheet/hr_timesheet_sheet_demo.xml 2013-11-11 05:48:01 +0000
32@@ -2,11 +2,10 @@
33 <openerp>
34 <data noupdate="1">
35
36-<!-- <record id="sheet1" model="hr_timesheet_sheet.sheet">
37- <field name="name">Sheet 1</field>
38+ <record id="sheet1" model="hr_timesheet_sheet.sheet">
39 <field name="user_id" ref="base.user_root"/>
40 <field name="employee_id" ref="hr.employee_fp" />
41- </record>
42--->
43+ </record>
44+
45 </data>
46 </openerp>
47
48=== modified file 'hr_timesheet_sheet/static/src/css/timesheet.css'
49--- hr_timesheet_sheet/static/src/css/timesheet.css 2012-10-26 10:02:07 +0000
50+++ hr_timesheet_sheet/static/src/css/timesheet.css 2013-11-11 05:48:01 +0000
51@@ -1,4 +1,3 @@
52-@charset "utf-8";
53 .openerp .oe_form_readonly .oe_timesheet_weekly .oe_timesheet_button_add {
54 display: none;
55 }
56@@ -63,3 +62,6 @@
57 .openerp .oe_timesheet_weekly .oe_timesheet_weekly_today {
58 background: #ffddee;
59 }
60+.openerp .oe_form .oe_timesheet_weekly .oe_timesheet_button_add {
61+ font-weight: bold;
62+}
63
64=== modified file 'hr_timesheet_sheet/static/src/css/timesheet.sass'
65--- hr_timesheet_sheet/static/src/css/timesheet.sass 2012-10-26 10:02:07 +0000
66+++ hr_timesheet_sheet/static/src/css/timesheet.sass 2013-11-11 05:48:01 +0000
67@@ -50,3 +50,7 @@
68 width: 200px
69 .oe_timesheet_weekly_today
70 background: #fde
71+ .oe_form
72+ .oe_timesheet_weekly
73+ .oe_timesheet_button_add
74+ font-weight: bold
75
76=== modified file 'hr_timesheet_sheet/static/src/js/timesheet.js'
77--- hr_timesheet_sheet/static/src/js/timesheet.js 2013-06-13 15:03:42 +0000
78+++ hr_timesheet_sheet/static/src/js/timesheet.js 2013-11-11 05:48:01 +0000
79@@ -29,6 +29,7 @@
80 this.res_o2m_drop = new instance.web.DropMisordered();
81 this.render_drop = new instance.web.DropMisordered();
82 this.description_line = _t("/");
83+ this.sheet_note = {};
84 },
85 go_to: function(event) {
86 var id = JSON.parse($(event.target).data("id"));
87@@ -145,7 +146,7 @@
88 accounts = _.sortBy(accounts, function(el) {
89 return account_names[el.account];
90 });
91- });;
92+ });
93 });
94 })).then(function(result) {
95 // we put all the gathered data in self, then we render
96@@ -153,9 +154,16 @@
97 self.accounts = accounts;
98 self.account_names = account_names;
99 self.default_get = default_get;
100+ _.each(self.get('sheets'), function(sheet) {
101+ _.each(accounts, function(account) {
102+ if(sheet.account_id == account.account) {
103+ self.sheet_note[account.account] = sheet['sheet_note'];
104+ }
105+ })
106+ });
107 //real rendering
108 self.display_data();
109- });
110+ });
111 },
112 destroy_content: function() {
113 if (this.dfm) {
114@@ -179,10 +187,12 @@
115 var self = this;
116 self.$el.html(QWeb.render("hr_timesheet_sheet.WeeklyTimesheet", {widget: self}));
117 _.each(self.accounts, function(account) {
118+ self.get_sheet_notes(account);
119 _.each(_.range(account.days.length), function(day_count) {
120 if (!self.get('effective_readonly')) {
121 self.get_box(account, day_count).val(self.sum_box(account, day_count, true)).change(function() {
122 var num = $(this).val();
123+ var desc = self.$el.find('.oe_timesheet_desc[data-account = '+ account.account+']').val();
124 if (self.is_valid_value(num)){
125 num = (num == 0)?0:Number(self.parse_client(num));
126 }
127@@ -190,13 +200,8 @@
128 $(this).val(self.sum_box(account, day_count, true));
129 } else {
130 account.days[day_count].lines[0].unit_amount += num - self.sum_box(account, day_count);
131- var product = (account.days[day_count].lines[0].product_id instanceof Array) ? account.days[day_count].lines[0].product_id[0] : account.days[day_count].lines[0].product_id
132- var journal = (account.days[day_count].lines[0].journal_id instanceof Array) ? account.days[day_count].lines[0].journal_id[0] : account.days[day_count].lines[0].journal_id
133- new instance.web.Model("hr.analytic.timesheet").call("on_change_unit_amount", [[], product, account.days[day_count].lines[0].unit_amount, false, false, journal]).then(function(res) {
134- account.days[day_count].lines[0]['amount'] = res.value.amount || 0;
135- self.display_totals();
136- self.sync();
137- });
138+ self.update_sheet_notes(account.account, self.sheet_note[account.account]);
139+ self.display_totals();
140 if(!isNaN($(this).val())){
141 $(this).val(self.sum_box(account, day_count, true));
142 }
143@@ -208,7 +213,29 @@
144 });
145 });
146 self.display_totals();
147- self.$(".oe_timesheet_weekly_adding button").click(_.bind(this.init_add_account, this));
148+ self.$(".oe_timesheet_weekly_adding a").click(_.bind(this.init_add_account, this));
149+ },
150+ get_sheet_notes: function(account) {
151+ var self = this;
152+ self.get_sheet_note(account).change(function(ev) {
153+ self.update_sheet_notes(parseInt($(this).attr('data-account')), $(this).val())
154+ });
155+ },
156+ update_sheet_notes: function(account_id, current_value){
157+ var self = this;
158+ var account = _.detect(self.accounts, function(account) {
159+ return account.account === account_id;
160+ });
161+ _.each(account.days, function(day) {
162+ _.each(day.lines, function(line) {
163+ if(line.unit_amount && (line.name === self.sheet_note[account.account] || line.name === self.description_line && current_value !== "" && current_value)) {
164+ day.lines[0].name = current_value;
165+ }
166+ if (line.unit_amount) { line.sheet_note = current_value; }
167+ });
168+ });
169+ self.sheet_note[account.account] = current_value;
170+ self.sync();
171 },
172 init_add_account: function() {
173 var self = this;
174@@ -239,7 +266,7 @@
175 },
176 });
177 self.account_m2o.prependTo(self.$(".oe_timesheet_weekly_add_row td"));
178- self.$(".oe_timesheet_weekly_add_row button").click(function() {
179+ self.account_m2o.on("change:value", self, function() {
180 var id = self.account_m2o.get_value();
181 if (id === false) {
182 self.dfm.set({display_invalid_fields: true});
183@@ -250,6 +277,7 @@
184 var def = _.extend({}, self.default_get, res.value, {
185 name: self.description_line,
186 unit_amount: 0,
187+ sheet_note : '',
188 date: instance.web.date_to_str(self.dates[0]),
189 account_id: id,
190 });
191@@ -258,6 +286,9 @@
192 });
193 });
194 },
195+ get_sheet_note: function(account) {
196+ return this.$el.find('.oe_timesheet_desc[data-account = '+ account.account+']');
197+ },
198 get_box: function(account, day_count) {
199 return this.$('[data-account="' + account.account + '"][data-day-count="' + day_count + '"]');
200 },
201@@ -316,11 +347,11 @@
202
203 _.each(self.accounts, function(account) {
204 var auth_keys = _.extend(_.clone(account.account_defaults), {
205- name: true, amount:true, unit_amount: true, date: true, account_id:true,
206+ name: true, amount:true, unit_amount: true, date: true, account_id:true, sheet_note:true
207 });
208 _.each(account.days, function(day) {
209 _.each(day.lines, function(line) {
210- if (line.unit_amount !== 0) {
211+ if (line.unit_amount !== 0 || line.sheet_note) {
212 var tmp = _.clone(line);
213 tmp.id = undefined;
214 _.each(line, function(v, k) {
215
216=== modified file 'hr_timesheet_sheet/static/src/xml/timesheet.xml'
217--- hr_timesheet_sheet/static/src/xml/timesheet.xml 2012-11-26 21:29:03 +0000
218+++ hr_timesheet_sheet/static/src/xml/timesheet.xml 2013-11-11 05:48:01 +0000
219@@ -6,6 +6,7 @@
220 <table>
221 <tr>
222 <th class="oe_timesheet_first_col"> </th>
223+ <th class="oe_timesheet_desc_col"> </th>
224 <t t-foreach="widget.dates" t-as="date">
225 <th t-att-class="'oe_timesheet_weekly_date_head' + (Date.compare(date, Date.today()) === 0 ? ' oe_timesheet_weekly_today' : '')">
226 <t t-esc="date.toString('ddd')"/><br />
227@@ -16,6 +17,10 @@
228 </tr>
229 <tr t-foreach="widget.accounts" t-as="account">
230 <td class="oe_timesheet_weekly_account"><a href="javascript:void(0)" t-att-data-id="JSON.stringify(account.account)"><t t-esc="widget.account_names[account.account]"/></a></td>
231+ <td>
232+ <textarea t-if="!widget.get('effective_readonly')" rows="1" class="oe_timesheet_desc" t-att-data-account="account.account"><t t-esc="widget.sheet_note[account.account] ? widget.sheet_note[account.account] : ''"/></textarea>
233+ <span t-if="widget.get('effective_readonly')" class="oe_timesheet_desc_box" t-att-data-account="account.account"><t t-esc="widget.sheet_note[account.account] ? widget.sheet_note[account.account] : ''"/></span>
234+ </td>
235 <t t-set="day_count" t-value="0"/>
236 <t t-foreach="account.days" t-as="day">
237 <td t-att-class="(Date.compare(day.day, Date.today()) === 0 ? 'oe_timesheet_weekly_today' : '')">
238@@ -30,13 +35,16 @@
239 </tr>
240 <tr class="oe_timesheet_weekly_add_row" style="display: none">
241 <td t-att-colspan="widget.dates.length + 2">
242- <button class="oe_highlight">Add</button>
243 </td>
244 </tr>
245 <tr class="oe_timesheet_total">
246 <td>
247 <div class="oe_timesheet_weekly_adding_tot">
248- <div class="oe_timesheet_weekly_adding"><button class="oe_timesheet_button_add">Add a Line</button></div>
249+ <div class="oe_timesheet_weekly_adding"><a class="oe_timesheet_button_add">Add a Line</a></div>
250+ </div>
251+ </td>
252+ <td>
253+ <div class="oe_timesheet_weekly_adding_tot">
254 <div class="oe_timesheet_weekly_tottot"><span>Total</span></div>
255 </div>
256 </td>
257
258=== removed directory 'web_shortcuts'
259=== removed directory 'web_shortcuts/i18n'
260=== removed file 'web_shortcuts/i18n/bs.po'
261--- web_shortcuts/i18n/bs.po 2013-10-27 05:50:02 +0000
262+++ web_shortcuts/i18n/bs.po 1970-01-01 00:00:00 +0000
263@@ -1,25 +0,0 @@
264-# Bosnian translation for openobject-addons
265-# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013
266-# This file is distributed under the same license as the openobject-addons package.
267-# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
268-#
269-msgid ""
270-msgstr ""
271-"Project-Id-Version: openobject-addons\n"
272-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
273-"POT-Creation-Date: 2012-12-21 17:06+0000\n"
274-"PO-Revision-Date: 2013-10-26 01:19+0000\n"
275-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
276-"Language-Team: Bosnian <bs@li.org>\n"
277-"MIME-Version: 1.0\n"
278-"Content-Type: text/plain; charset=UTF-8\n"
279-"Content-Transfer-Encoding: 8bit\n"
280-"X-Launchpad-Export-Date: 2013-10-27 05:50+0000\n"
281-"X-Generator: Launchpad (build 16810)\n"
282-
283-#. module: web_shortcuts
284-#. openerp-web
285-#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
286-#, python-format
287-msgid "Add / Remove Shortcut..."
288-msgstr "Dodaj / Ukloni pračicu..."
289
290=== removed file 'web_shortcuts/i18n/fi.po'
291--- web_shortcuts/i18n/fi.po 2013-11-10 05:54:20 +0000
292+++ web_shortcuts/i18n/fi.po 1970-01-01 00:00:00 +0000
293@@ -1,25 +0,0 @@
294-# Finnish translation for openobject-addons
295-# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013
296-# This file is distributed under the same license as the openobject-addons package.
297-# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
298-#
299-msgid ""
300-msgstr ""
301-"Project-Id-Version: openobject-addons\n"
302-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
303-"POT-Creation-Date: 2012-12-21 17:06+0000\n"
304-"PO-Revision-Date: 2013-11-08 21:06+0000\n"
305-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
306-"Language-Team: Finnish <fi@li.org>\n"
307-"MIME-Version: 1.0\n"
308-"Content-Type: text/plain; charset=UTF-8\n"
309-"Content-Transfer-Encoding: 8bit\n"
310-"X-Launchpad-Export-Date: 2013-11-10 05:54+0000\n"
311-"X-Generator: Launchpad (build 16820)\n"
312-
313-#. module: web_shortcuts
314-#. openerp-web
315-#: code:addons/web_shortcuts/static/src/xml/web_shortcuts.xml:21
316-#, python-format
317-msgid "Add / Remove Shortcut..."
318-msgstr "Lisää / Poista pikavalinta..."

Subscribers

People subscribed via source and target branches

to all changes: