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

Proposed by jftempo
Status: Merged
Merged at revision: 5292
Proposed branch: lp:~julie-w/unifield-server/US-5724
Merge into: lp:unifield-server
Diff against target: 278 lines (+184/-0)
9 files modified
bin/addons/msf_profile/data/patches.xml (+4/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+40/-0)
bin/addons/msf_profile/msf_profile.py (+10/-0)
bin/addons/msf_tools/msf_tools.py (+16/-0)
bin/addons/unifield_setup/__openerp__.py (+1/-0)
bin/addons/unifield_setup/installer/__init__.py (+1/-0)
bin/addons/unifield_setup/installer/previous_fy_dates_setup.py (+62/-0)
bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml (+48/-0)
bin/addons/unifield_setup/setup_configuration.py (+2/-0)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-5724
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+363468@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/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2019-02-06 13:36:14 +0000
+++ bin/addons/msf_profile/data/patches.xml 2019-02-21 09:14:56 +0000
@@ -2,6 +2,10 @@
2<openerp>2<openerp>
3 <data>3 <data>
4 <!-- UF12.0 -->4 <!-- UF12.0 -->
5 <record id="us_5724_set_previous_fy_dates_allowed" model="patch.scripts">
6 <field name="method">us_5724_set_previous_fy_dates_allowed</field>
7 </record>
8
5 <record id="us_2896_volume_ocbprod" model="patch.scripts">9 <record id="us_2896_volume_ocbprod" model="patch.scripts">
6 <field name="method">us_2896_volume_ocbprod</field>10 <field name="method">us_2896_volume_ocbprod</field>
7 </record>11 </record>
812
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2019-02-15 10:46:11 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2019-02-21 09:14:56 +0000
@@ -105270,3 +105270,43 @@
105270#: field:wizard.pick.import,import_file:0105270#: field:wizard.pick.import,import_file:0
105271msgid "PICK import file"105271msgid "PICK import file"
105272msgstr "Fichier d'import de PICK"105272msgstr "Fichier d'import de PICK"
105273
105274#. module: unifield_setup
105275#: field:previous.fy.dates.setup,previous_fy_dates_allowed:0
105276#: field:unifield.setup.configuration,previous_fy_dates_allowed:0
105277msgid "Does the system allow document dates on previous Fiscal Year?"
105278msgstr "Le système autorise-t-il les dates des documents sur l'Exercice Comptable précédent ?"
105279
105280#. module: unifield_setup
105281#: code:addons/unifield_setup/installer/previous_fy_dates_setup.py:52
105282#, python-format
105283msgid "An error has occurred with the item retrieved from the form. Please contact an administrator if the problem persists."
105284msgstr "Une erreur est survenue avec l'élément récupéré depuis le formulaire. Veuillez contacter un administrateur si le problème persiste."
105285
105286#. module: unifield_setup
105287#: view:previous.fy.dates.setup:0
105288#: model:ir.actions.act_window,name:unifield_setup.action_previous_fy_dates_setup
105289msgid "Allow previous Fiscal Year dates"
105290msgstr "Autoriser les dates de l'Exercice Comptable précédent"
105291
105292#. module: unifield_setup
105293#: view:previous.fy.dates.setup:0
105294msgid "Allow document dates on previous Fiscal Year"
105295msgstr "Autoriser les dates des documents sur l'Exercice Comptable précédent"
105296
105297#. module: unifield_setup
105298#: view:previous.fy.dates.setup:0
105299msgid "Determines whether document dates and posting dates can be on different Fiscal Years."
105300msgstr "Détermine si les dates des documents et les dates de comptabilisation peuvent être sur des Exercices Comptables différents."
105301
105302#. module: msf_tools
105303#: code:addons/msf_tools/msf_tools.py:909
105304#, python-format
105305msgid "Document date should be in posting date FY"
105306msgstr "La date du document doit être dans le même exercice comptable que la date de comptabilisation"
105307
105308#. module: msf_tools
105309#: code:addons/msf_tools/msf_tools.py:907
105310#, python-format
105311msgid "Document date (%s) should be in posting date FY"
105312msgstr "La date du document (%s) doit être dans le même exercice comptable que la date de comptabilisation"
105273105313
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2019-02-06 13:36:14 +0000
+++ bin/addons/msf_profile/msf_profile.py 2019-02-21 09:14:56 +0000
@@ -53,6 +53,16 @@
53 }53 }
5454
55 # UF12.055 # UF12.0
56 def us_5724_set_previous_fy_dates_allowed(self, cr, uid, *a, **b):
57 """
58 Sets the field "previous_fy_dates_allowed" to True in the UniField Setup Configuration for all OCB and OCP instances
59 """
60 user_obj = self.pool.get('res.users')
61 current_instance = user_obj.browse(cr, uid, uid, fields_to_fetch=['company_id']).company_id.instance_id
62 if current_instance and (current_instance.name.startswith('OCB') or current_instance.name.startswith('OCP')):
63 cr.execute("UPDATE unifield_setup_configuration SET previous_fy_dates_allowed = 't';")
64 return True
65
56 def us_2896_volume_ocbprod(self, cr, uid, *a, **b):66 def us_2896_volume_ocbprod(self, cr, uid, *a, **b):
57 ''' OCBHQ: volume has not been converted to dm3 on instances '''67 ''' OCBHQ: volume has not been converted to dm3 on instances '''
58 instance = self.pool.get('res.users').browse(cr, uid, uid).company_id.instance_id68 instance = self.pool.get('res.users').browse(cr, uid, uid).company_id.instance_id
5969
=== modified file 'bin/addons/msf_tools/msf_tools.py'
--- bin/addons/msf_tools/msf_tools.py 2018-12-10 14:01:47 +0000
+++ bin/addons/msf_tools/msf_tools.py 2019-02-21 09:14:56 +0000
@@ -871,6 +871,8 @@
871 show_date=False, custom_msg=False, context=None):871 show_date=False, custom_msg=False, context=None):
872 """872 """
873 Checks that posting date >= document date873 Checks that posting date >= document date
874 Depending on the config made in the Reconfigure Wizard, can also check that the document date is included
875 in the same FY as the related posting date.
874876
875 :type document_date: orm date877 :type document_date: orm date
876 :type posting_date: orm date878 :type posting_date: orm date
@@ -895,6 +897,20 @@
895 'Posting date should be later than Document Date.')897 'Posting date should be later than Document Date.')
896 raise osv.except_osv(_('Error'), msg)898 raise osv.except_osv(_('Error'), msg)
897899
900 # if the system doesn't allow doc dates from previous FY, check that this condition is met
901 setup = self.pool.get('unifield.setup.configuration').get_config(cr, uid)
902 if not setup or not setup.previous_fy_dates_allowed:
903 # 01/01/FY <= document date <= 31/12/FY
904 posting_date_obj = self.pool.get('date.tools').orm2date(posting_date)
905 check_range_start = self.get_orm_date(1, 1, year=posting_date_obj.year)
906 check_range_end = self.get_orm_date(31, 12, year=posting_date_obj.year)
907 if not (check_range_start <= document_date <= check_range_end):
908 if show_date:
909 msg = _('Document date (%s) should be in posting date FY') % (document_date, )
910 else:
911 msg = _('Document date should be in posting date FY')
912 raise osv.except_osv(_('Error'), msg)
913
898 def truncate_amount(self, amount, digits):914 def truncate_amount(self, amount, digits):
899 stepper = pow(10.0, digits)915 stepper = pow(10.0, digits)
900 return math.trunc(stepper * amount) / stepper916 return math.trunc(stepper * amount) / stepper
901917
=== modified file 'bin/addons/unifield_setup/__openerp__.py'
--- bin/addons/unifield_setup/__openerp__.py 2014-05-13 11:58:37 +0000
+++ bin/addons/unifield_setup/__openerp__.py 2019-02-21 09:14:56 +0000
@@ -59,6 +59,7 @@
59 "installer/payroll_view.xml",59 "installer/payroll_view.xml",
60 "installer/commitment_import_view.xml",60 "installer/commitment_import_view.xml",
61 "installer/vat_setup_view.xml",61 "installer/vat_setup_view.xml",
62 "installer/previous_fy_dates_setup_view.xml",
62 # Security and access rights63 # Security and access rights
63 "security/ir.model.access.csv",64 "security/ir.model.access.csv",
64 "view/product_view.xml",65 "view/product_view.xml",
6566
=== modified file 'bin/addons/unifield_setup/installer/__init__.py'
--- bin/addons/unifield_setup/installer/__init__.py 2014-05-13 11:58:37 +0000
+++ bin/addons/unifield_setup/installer/__init__.py 2019-02-21 09:14:56 +0000
@@ -32,3 +32,4 @@
32import payroll32import payroll
33import commitment_import33import commitment_import
34import vat_setup34import vat_setup
35import previous_fy_dates_setup
3536
=== added file 'bin/addons/unifield_setup/installer/previous_fy_dates_setup.py'
--- bin/addons/unifield_setup/installer/previous_fy_dates_setup.py 1970-01-01 00:00:00 +0000
+++ bin/addons/unifield_setup/installer/previous_fy_dates_setup.py 2019-02-21 09:14:56 +0000
@@ -0,0 +1,62 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2019 TeMPO Consulting, MSF
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from osv import osv
23from osv import fields
24
25from tools.translate import _
26
27
28class previous_fy_dates_setup(osv.osv_memory):
29 _name = 'previous.fy.dates.setup'
30 _inherit = 'res.config'
31
32 _columns = {
33 'previous_fy_dates_allowed': fields.boolean(string='Does the system allow document dates on previous Fiscal Year?'),
34 }
35
36 def default_get(self, cr, uid, fields, context=None):
37 """
38 Display the default/current value regarding the allowing of previous FY dates
39 """
40 if context is None:
41 context = {}
42 setup = self.pool.get('unifield.setup.configuration').get_config(cr, uid)
43 res = super(previous_fy_dates_setup, self).default_get(cr, uid, fields, context=context)
44 res['previous_fy_dates_allowed'] = setup.previous_fy_dates_allowed
45 return res
46
47 def execute(self, cr, uid, ids, context=None):
48 """
49 Fills in the previous_fy_dates_allowed field and activate/de-activate the allowing of Doc dates booked in previous FY
50 """
51 if context is None:
52 context = {}
53 if not isinstance(ids, list) or len(ids) != 1:
54 raise osv.except_osv(_('Error'), _('An error has occurred with the item retrieved from the form. Please contact an administrator if the problem persists.'))
55 payload = self.browse(cr, uid, ids[0], fields_to_fetch=['previous_fy_dates_allowed'], context=context)
56 setup_obj = self.pool.get('unifield.setup.configuration')
57 setup = setup_obj.get_config(cr, uid)
58 if setup:
59 setup_obj.write(cr, uid, [setup.id], {'previous_fy_dates_allowed': payload.previous_fy_dates_allowed}, context=context)
60
61
62previous_fy_dates_setup()
063
=== added file 'bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml'
--- bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml 1970-01-01 00:00:00 +0000
+++ bin/addons/unifield_setup/installer/previous_fy_dates_setup_view.xml 2019-02-21 09:14:56 +0000
@@ -0,0 +1,48 @@
1<openerp>
2 <data>
3 <record id="view_previous_fy_dates_setup" model="ir.ui.view">
4 <field name="name">Allow previous Fiscal Year dates</field>
5 <field name="model">previous.fy.dates.setup</field>
6 <field name="type">form</field>
7 <field name="inherit_id" ref="base.res_config_view_base"/>
8 <field name="arch" type="xml">
9 <data>
10 <form position="attributes">
11 <attribute name="string">Allow previous Fiscal Year dates</attribute>
12 </form>
13 <xpath expr="//label[@string='description']" position="attributes">
14 <attribute name="string">Determines whether document dates and posting dates can be on different Fiscal Years.</attribute>
15 </xpath>
16 <xpath expr='//separator[@string="title"]' position='attributes'>
17 <attribute name='string'>Allow document dates on previous Fiscal Year</attribute>
18 </xpath>
19 <xpath expr='//separator[@string="vsep"]' position='attributes'>
20 <attribute name='rowspan'>25</attribute>
21 <attribute name='string'></attribute>
22 </xpath>
23 <group string="res_config_contents" position="replace">
24 <group colspan="5">
25 <field name="previous_fy_dates_allowed"/>
26 </group>
27 </group>
28 </data>
29 </field>
30 </record>
31
32 <record id="action_previous_fy_dates_setup" model="ir.actions.act_window">
33 <field name="name">Allow previous Fiscal Year dates</field>
34 <field name="type">ir.actions.act_window</field>
35 <field name="res_model">previous.fy.dates.setup</field>
36 <field name="view_id" ref="view_previous_fy_dates_setup"/>
37 <field name="view_type">form</field>
38 <field name="view_mode">form</field>
39 <field name="target">new</field>
40 </record>
41
42 <record id="previous_fy_dates_setup_todo" model="ir.actions.todo">
43 <field name="action_id" ref="action_previous_fy_dates_setup"/>
44 <field name="sequence">30</field>
45 <field name="restart">always</field>
46 </record>
47 </data>
48</openerp>
049
=== modified file 'bin/addons/unifield_setup/setup_configuration.py'
--- bin/addons/unifield_setup/setup_configuration.py 2017-09-28 14:58:54 +0000
+++ bin/addons/unifield_setup/setup_configuration.py 2019-02-21 09:14:56 +0000
@@ -59,6 +59,7 @@
59 'payroll_ok': fields.boolean(string='System manages payrolls ?'),59 'payroll_ok': fields.boolean(string='System manages payrolls ?'),
60 'import_commitments': fields.boolean(string='Manage commitments corresponding to international order through specific import ?'),60 'import_commitments': fields.boolean(string='Manage commitments corresponding to international order through specific import ?'),
61 'vat_ok': fields.boolean(string='System manages VAT locally ?'),61 'vat_ok': fields.boolean(string='System manages VAT locally ?'),
62 'previous_fy_dates_allowed': fields.boolean(string='Does the system allow document dates on previous Fiscal Year?'),
62 }63 }
6364
64 _defaults = {65 _defaults = {
@@ -73,6 +74,7 @@
73 'payroll_ok': lambda *a: True,74 'payroll_ok': lambda *a: True,
74 'import_commitments': lambda *a: True,75 'import_commitments': lambda *a: True,
75 'vat_ok': lambda *a: True,76 'vat_ok': lambda *a: True,
77 'previous_fy_dates_allowed': lambda *a: False,
76 }78 }
7779
78 _constraints = [80 _constraints = [

Subscribers

People subscribed via source and target branches