Merge lp:~julie-w/unifield-server/US-1562 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4433
Proposed branch: lp:~julie-w/unifield-server/US-1562
Merge into: lp:unifield-server
Diff against target: 154 lines (+39/-13)
7 files modified
bin/addons/account/account.py (+1/-1)
bin/addons/account_period_closing_level/account_fiscalyear.py (+5/-4)
bin/addons/account_period_closing_level/account_year_end_closing.py (+1/-1)
bin/addons/account_period_closing_level/wizard/account_period_create.py (+8/-6)
bin/addons/msf_doc_import/account.py (+1/-1)
bin/addons/msf_profile/data/patches.xml (+4/-0)
bin/addons/msf_profile/msf_profile.py (+19/-0)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-1562
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+327109@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/account/account.py'
--- bin/addons/account/account.py 2017-05-12 09:58:49 +0000
+++ bin/addons/account/account.py 2017-07-18 08:09:45 +0000
@@ -901,7 +901,7 @@
901 _description = "Account period"901 _description = "Account period"
902 _columns = {902 _columns = {
903 'name': fields.char('Period Name', size=64, required=True),903 'name': fields.char('Period Name', size=64, required=True),
904 'code': fields.char('Code', size=12),904 'code': fields.char('Code', size=24),
905 'special': fields.boolean('Opening/Closing Period', size=12,905 'special': fields.boolean('Opening/Closing Period', size=12,
906 help="These periods can overlap."),906 help="These periods can overlap."),
907 'date_start': fields.date('Start of Period', required=True, states={'done':[('readonly',True)]}),907 'date_start': fields.date('Start of Period', required=True, states={'done':[('readonly',True)]}),
908908
=== modified file 'bin/addons/account_period_closing_level/account_fiscalyear.py'
--- bin/addons/account_period_closing_level/account_fiscalyear.py 2016-11-02 10:05:34 +0000
+++ bin/addons/account_period_closing_level/account_fiscalyear.py 2017-07-18 08:09:45 +0000
@@ -102,6 +102,7 @@
102 }102 }
103103
104 def create_period(self,cr, uid, ids, context=None, interval=1):104 def create_period(self,cr, uid, ids, context=None, interval=1):
105 period_obj = self.pool.get('account.period')
105 for fy in self.browse(cr, uid, ids, context=context):106 for fy in self.browse(cr, uid, ids, context=context):
106 ds = datetime.datetime.strptime(fy.date_start, '%Y-%m-%d')107 ds = datetime.datetime.strptime(fy.date_start, '%Y-%m-%d')
107 i = 0108 i = 0
@@ -112,7 +113,7 @@
112 if de.strftime('%Y-%m-%d')>fy.date_stop:113 if de.strftime('%Y-%m-%d')>fy.date_stop:
113 de = datetime.datetime.strptime(fy.date_stop, '%Y-%m-%d')114 de = datetime.datetime.strptime(fy.date_stop, '%Y-%m-%d')
114115
115 self.pool.get('account.period').create(cr, uid, {116 period_obj.create(cr, uid, {
116 'name': ds.strftime('%b %Y'),117 'name': ds.strftime('%b %Y'),
117 'code': ds.strftime('%b %Y'),118 'code': ds.strftime('%b %Y'),
118 'date_start': ds.strftime('%Y-%m-%d'),119 'date_start': ds.strftime('%Y-%m-%d'),
@@ -125,9 +126,9 @@
125126
126 ds = datetime.datetime.strptime(fy.date_stop, '%Y-%m-%d')127 ds = datetime.datetime.strptime(fy.date_stop, '%Y-%m-%d')
127 for period_nb in (13, 14, 15):128 for period_nb in (13, 14, 15):
128 self.pool.get('account.period').create(cr, uid, {129 period_obj.create(cr, uid, {
129 'name': 'Period %d' % (period_nb),130 'name': 'Period %d %d' % (period_nb, ds.year),
130 'code': 'Period %d' % (period_nb),131 'code': 'Period %d %d' % (period_nb, ds.year),
131 'date_start': '%d-12-01' % (ds.year),132 'date_start': '%d-12-01' % (ds.year),
132 'date_stop': '%d-12-31' % (ds.year),133 'date_stop': '%d-12-31' % (ds.year),
133 'fiscalyear_id': fy.id,134 'fiscalyear_id': fy.id,
134135
=== modified file 'bin/addons/account_period_closing_level/account_year_end_closing.py'
--- bin/addons/account_period_closing_level/account_year_end_closing.py 2016-07-06 10:23:25 +0000
+++ bin/addons/account_period_closing_level/account_year_end_closing.py 2017-07-18 08:09:45 +0000
@@ -233,7 +233,7 @@
233233
234 for pn in period_numbers:234 for pn in period_numbers:
235 period_year_month = (fy_year, self._period_month_map[pn], )235 period_year_month = (fy_year, self._period_month_map[pn], )
236 code = "Period %d" % (pn, )236 code = "Period %d %s" % (pn, fy_year)
237 if not period_obj.search(cr, uid, [('fiscalyear_id', '=', fy_id), ('number', '=', pn), ('active', 'in', ['t', 'f'])],237 if not period_obj.search(cr, uid, [('fiscalyear_id', '=', fy_id), ('number', '=', pn), ('active', 'in', ['t', 'f'])],
238 order='NO_ORDER', context=context):238 order='NO_ORDER', context=context):
239 vals = {239 vals = {
240240
=== modified file 'bin/addons/account_period_closing_level/wizard/account_period_create.py'
--- bin/addons/account_period_closing_level/wizard/account_period_create.py 2016-11-02 10:14:39 +0000
+++ bin/addons/account_period_closing_level/wizard/account_period_create.py 2017-07-18 08:09:45 +0000
@@ -44,6 +44,7 @@
44 end_date = datetime.date(year, 12, 31)44 end_date = datetime.date(year, 12, 31)
4545
46 fiscalyear_obj = self.pool.get('account.fiscalyear')46 fiscalyear_obj = self.pool.get('account.fiscalyear')
47 period_obj = self.pool.get('account.period')
4748
48 ds = start_date49 ds = start_date
49 while ds < end_date:50 while ds < end_date:
@@ -60,8 +61,8 @@
60 'date_start': ds,61 'date_start': ds,
61 'date_stop': end_date})62 'date_stop': end_date})
6263
63 if not self.pool.get('account.period').name_search(cr, uid, ds.strftime('%b %Y'), [('fiscalyear_id', '=', fiscalyear_id)]):64 if not period_obj.name_search(cr, uid, ds.strftime('%b %Y'), [('fiscalyear_id', '=', fiscalyear_id)]):
64 self.pool.get('account.period').create(cr, uid, {65 period_obj.create(cr, uid, {
65 'name': ds.strftime('%b %Y'),66 'name': ds.strftime('%b %Y'),
66 'code': ds.strftime('%b %Y'),67 'code': ds.strftime('%b %Y'),
67 'date_start': ds.strftime('%Y-%m-%d'),68 'date_start': ds.strftime('%Y-%m-%d'),
@@ -73,10 +74,11 @@
7374
74 fiscalyear_id = fiscalyear_obj.find(cr, uid, start_date, exception=False, context=context)75 fiscalyear_id = fiscalyear_obj.find(cr, uid, start_date, exception=False, context=context)
75 for period_nb in (13, 14, 15):76 for period_nb in (13, 14, 15):
76 if not self.pool.get('account.period').name_search(cr, uid, 'Period %d' % (period_nb), [('fiscalyear_id', '=', fiscalyear_id)]):77 if not period_obj.name_search(cr, uid, 'Period %d' % (period_nb),
77 self.pool.get('account.period').create(cr, uid, {78 [('fiscalyear_id', '=', fiscalyear_id)], operator='ilike'):
78 'name': 'Period %d' % (period_nb),79 period_obj.create(cr, uid, {
79 'code': 'Period %d' % (period_nb),80 'name': 'Period %d %d' % (period_nb, start_date.year),
81 'code': 'Period %d %d' % (period_nb, start_date.year),
80 'date_start': '%d-12-01' % (start_date.year),82 'date_start': '%d-12-01' % (start_date.year),
81 'date_stop': '%d-12-31' % (start_date.year),83 'date_stop': '%d-12-31' % (start_date.year),
82 'fiscalyear_id': fiscalyear_id,84 'fiscalyear_id': fiscalyear_id,
8385
=== modified file 'bin/addons/msf_doc_import/account.py'
--- bin/addons/msf_doc_import/account.py 2017-05-22 16:04:34 +0000
+++ bin/addons/msf_doc_import/account.py 2017-07-18 08:09:45 +0000
@@ -421,7 +421,7 @@
421 continue421 continue
422 r_fp = fp_ids[0]422 r_fp = fp_ids[0]
423 # US-937: use period of import file423 # US-937: use period of import file
424 if line[cols['Period']] == 'Period 16':424 if line[cols['Period']].startswith('Period 16'):
425 raise osv.except_osv(_('Warning'), _("You can't import entries in Period 16."))425 raise osv.except_osv(_('Warning'), _("You can't import entries in Period 16."))
426 period_ids = period_obj.search(426 period_ids = period_obj.search(
427 cr, uid, [427 cr, uid, [
428428
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2017-07-10 07:14:10 +0000
+++ bin/addons/msf_profile/data/patches.xml 2017-07-18 08:09:45 +0000
@@ -189,5 +189,9 @@
189 <record id="us_1359_update_move_shipment" model="patch.scripts">189 <record id="us_1359_update_move_shipment" model="patch.scripts">
190 <field name="method">us_1359_update_move_shipment</field>190 <field name="method">us_1359_update_move_shipment</field>
191 </record>191 </record>
192
193 <record id="us_1562_rename_special_periods" model="patch.scripts">
194 <field name="method">us_1562_rename_special_periods</field>
195 </record>
192 </data>196 </data>
193</openerp>197</openerp>
194198
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2017-07-11 10:25:38 +0000
+++ bin/addons/msf_profile/msf_profile.py 2017-07-18 08:09:45 +0000
@@ -1363,6 +1363,25 @@
13631363
1364 return True1364 return True
13651365
1366 def us_1562_rename_special_periods(self, cr, uid, *a, **b):
1367 """
1368 Update the name and code of the special Periods from "Period xx" to "Period xx YYYY" (ex: Period 13 2017)
1369 """
1370 update_name_and_code = """
1371 UPDATE account_period AS p
1372 SET name = name || ' ' || (SELECT SUBSTR(code, 3, 4) FROM account_fiscalyear AS fy WHERE p.fiscalyear_id = fy.id),
1373 code = code || ' ' || (SELECT SUBSTR(code, 3, 4) FROM account_fiscalyear AS fy WHERE p.fiscalyear_id = fy.id)
1374 WHERE name like 'Period %';
1375 """
1376 update_translation = """
1377 UPDATE ir_translation AS t
1378 SET src = (SELECT t.src || ' ' || to_char(date_start,'YYYY') FROM account_period WHERE id=t.res_id),
1379 value = (SELECT t.value || ' ' || to_char(date_start,'YYYY') FROM account_period WHERE id=t.res_id)
1380 WHERE name='account.period,name' AND src LIKE 'Period%' AND type='model';
1381 """
1382 cr.execute(update_name_and_code)
1383 cr.execute(update_translation)
1384
13661385
1367patch_scripts()1386patch_scripts()
13681387

Subscribers

People subscribed via source and target branches