Merge lp:~julie-w/unifield-server/US-1293 into lp:unifield-server
- US-1293
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4201 |
Proposed branch: | lp:~julie-w/unifield-server/US-1293 |
Merge into: | lp:unifield-server |
Diff against target: |
194 lines (+96/-6) (has conflicts) 7 files modified
bin/addons/account_override/account.py (+20/-2) bin/addons/finance/account_view.xml (+1/-0) bin/addons/msf_doc_import/account.py (+21/-1) bin/addons/msf_profile/i18n/fr_MF.po (+45/-0) bin/addons/register_accounting/account_bank_statement.py (+1/-1) bin/addons/register_accounting/account_move_line.py (+4/-1) bin/addons/register_accounting/account_view.xml (+4/-1) Text conflict in bin/addons/msf_profile/i18n/fr_MF.po |
To merge this branch: | bzr merge lp:~julie-w/unifield-server/US-1293 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+316860@code.launchpad.net |
Commit message
Description of the change
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
1 | === modified file 'bin/addons/account_override/account.py' |
2 | --- bin/addons/account_override/account.py 2017-02-01 10:13:31 +0000 |
3 | +++ bin/addons/account_override/account.py 2017-02-09 15:23:17 +0000 |
4 | @@ -1027,10 +1027,28 @@ |
5 | raise osv.except_osv(_('Warning'), _('You cannot post entries in a non-opened period: %s') % (m.period_id.name)) |
6 | prev_currency_id = False |
7 | for ml in m.line_id: |
8 | + # Check that the currency and type of the (journal) third party is correct |
9 | + # in case of an "Internal Transfer" account |
10 | + type_for_reg = ml.account_id.type_for_register |
11 | + curr_aml = ml.currency_id |
12 | + partner_journal = ml.transfer_journal_id |
13 | + is_liquidity = partner_journal and partner_journal.type in ['cash', 'bank', 'cheque'] and partner_journal.currency |
14 | + if type_for_reg == 'transfer_same' and (not is_liquidity or partner_journal.currency.id != curr_aml.id): |
15 | + raise osv.except_osv(_('Warning'), |
16 | + _('Account: %s - %s. The Third Party must be a liquidity journal with the same ' |
17 | + 'currency as the booking one.') % (ml.account_id.code, ml.account_id.name)) |
18 | + elif type_for_reg == 'transfer' and (not is_liquidity or partner_journal.currency.id == curr_aml.id): |
19 | + raise osv.except_osv(_('Warning'), |
20 | + _('Account: %s - %s. The Third Party must be a liquidity journal with a currency ' |
21 | + 'different from the booking one.') % (ml.account_id.code, ml.account_id.name)) |
22 | + if is_liquidity and m.journal_id and m.journal_id.id == partner_journal.id: |
23 | + raise osv.except_osv(_('Warning'), |
24 | + _('Account: %s - %s. The journal used for the internal transfer must be different from the ' |
25 | + 'Journal Entry Journal.') % (ml.account_id.code, ml.account_id.name)) |
26 | if not prev_currency_id: |
27 | - prev_currency_id = ml.currency_id.id |
28 | + prev_currency_id = curr_aml.id |
29 | continue |
30 | - if ml.currency_id.id != prev_currency_id: |
31 | + if curr_aml.id != prev_currency_id: |
32 | raise osv.except_osv(_('Warning'), _('You cannot have two different currencies for the same Journal Entry!')) |
33 | return super(account_move, self).button_validate(cr, uid, ids, context=context) |
34 | |
35 | |
36 | === modified file 'bin/addons/finance/account_view.xml' |
37 | --- bin/addons/finance/account_view.xml 2017-01-17 13:31:02 +0000 |
38 | +++ bin/addons/finance/account_view.xml 2017-02-09 15:23:17 +0000 |
39 | @@ -100,6 +100,7 @@ |
40 | <button name="button_duplicate" string="Duplicate" type="object" icon="gtk-copy" /> |
41 | <field name="name"/> |
42 | <field name="reference"/> |
43 | + <field name="partner_type_mandatory" invisible="1"/> |
44 | <field name="account_id" domain="[('restricted_area', '=', 'account_move_lines')]"/> |
45 | <field name="partner_id" invisible="1"/> |
46 | <field name="debit_currency" sum="Total Booking Debit" string="Book. Debit"/> |
47 | |
48 | === modified file 'bin/addons/msf_doc_import/account.py' |
49 | --- bin/addons/msf_doc_import/account.py 2016-11-17 09:34:23 +0000 |
50 | +++ bin/addons/msf_doc_import/account.py 2017-02-09 15:23:17 +0000 |
51 | @@ -462,8 +462,11 @@ |
52 | if not partner_needs: |
53 | errors.append(_('Line %s. No info about given account: %s') % (current_line_num, account.code,)) |
54 | continue |
55 | - # Check result |
56 | + # Check partner type compatibility regarding the Account "Type for specific treatment" |
57 | partner_options = partner_needs['value']['partner_type']['options'] |
58 | + partner_type_mandatory = 'partner_type_mandatory' in partner_needs['value'] and \ |
59 | + partner_needs['value']['partner_type_mandatory'] or False |
60 | + type_for_reg = account.type_for_register |
61 | if r_partner and ('res.partner', 'Partner') not in partner_options: |
62 | errors.append(_('Line %s. You cannot use a partner for the given account: %s.') % (current_line_num, account.code)) |
63 | continue |
64 | @@ -472,6 +475,23 @@ |
65 | continue |
66 | if r_journal and ('account.journal', 'Journal') not in partner_options: |
67 | errors.append(_('Line %s. You cannot use a journal for the given account: %s.') % (current_line_num, account.code)) |
68 | + if partner_type_mandatory and not r_partner and not r_employee and not r_journal: |
69 | + errors.append(_('Line %s. A Third Party is mandatory for the given account: %s.') % (current_line_num, account.code)) |
70 | + # Check that the currency and type of the (journal) third party is correct |
71 | + # in case of an "Internal Transfer" account |
72 | + partner_journal = r_journal and aj_obj.browse(cr, uid, r_journal, fields_to_fetch=['currency', 'type'], context=context) |
73 | + is_liquidity = partner_journal and partner_journal.type in ['cash', 'bank', 'cheque'] and partner_journal.currency |
74 | + if type_for_reg == 'transfer_same' and (not is_liquidity or partner_journal.currency.id != r_currency): |
75 | + errors.append(_('Line %s. The Third Party must be a liquidity journal with the same currency ' |
76 | + 'as the booking one for the given account: %s.') % (current_line_num, account.code)) |
77 | + if type_for_reg == 'transfer' and (not is_liquidity or partner_journal.currency.id == r_currency): |
78 | + errors.append(_('Line %s. The Third Party must be a liquidity journal with a currency ' |
79 | + 'different from the booking one for the given account: %s.') % (current_line_num, account.code)) |
80 | + if is_liquidity and file_journal_id == partner_journal.id: |
81 | + raise osv.except_osv(_('Warning'), |
82 | + _('Line %s. The journal used for the internal transfer must be different from the ' |
83 | + 'Journal Entry Journal for the given account: %s.') % (current_line_num, account.code)) |
84 | + |
85 | line_res = self.pool.get('msf.doc.import.accounting.lines').create(cr, uid, vals, context) |
86 | if not line_res: |
87 | errors.append(_('Line %s. A problem occured for line registration. Please contact an Administrator.') % (current_line_num,)) |
88 | |
89 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' |
90 | --- bin/addons/msf_profile/i18n/fr_MF.po 2017-01-31 16:17:06 +0000 |
91 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2017-02-09 15:23:17 +0000 |
92 | @@ -76099,8 +76099,53 @@ |
93 | #, python-format |
94 | msgid "A line was added to the %s %s to re-source the canceled line." |
95 | msgstr "Une ligne a été ajoutée a la %s %s pour 're-sourcer' la ligne annulée." |
96 | +<<<<<<< TREE |
97 | |
98 | #. modules: sale, msf_printed_documents |
99 | #: report:msf.consumption_report:0 |
100 | msgid "Source Location :" |
101 | msgstr "Source Location :" |
102 | +======= |
103 | + |
104 | +#. module: msf_doc_import |
105 | +#: code:addons/msf_doc_import/account.py:478 |
106 | +#, python-format |
107 | +msgid "Line %s. A Third Party is mandatory for the given account: %s." |
108 | +msgstr "Ligne %s. Un Tiers est obligatoire pour le compte donné : %s." |
109 | + |
110 | +#. module: msf_doc_import |
111 | +#: code:addons/msf_doc_import/account.py:488 |
112 | +#, python-format |
113 | +msgid "Line %s. The Third Party must be a liquidity journal with a currency different from the booking one for the given account: %s." |
114 | +msgstr "Ligne %s. Le Tiers doit être un journal de trésorerie avec une devise différente de la devise d'enregistrement pour le compte donné : %s." |
115 | + |
116 | +#. module: msf_doc_import |
117 | +#: code:addons/msf_doc_import/account.py:485 |
118 | +#, python-format |
119 | +msgid "Line %s. The Third Party must be a liquidity journal with the same currency as the booking one for the given account: %s." |
120 | +msgstr "Ligne %s. Le Tiers doit être un journal de trésorerie avec la même devise que la devise d'enregistrement pour le compte donné : %s." |
121 | + |
122 | +#. module: msf_doc_import |
123 | +#: code:addons/msf_doc_import/account.py:492 |
124 | +#, python-format |
125 | +msgid "Line %s. The journal used for the internal transfer must be different from the Journal Entry Journal for the given account: %s." |
126 | +msgstr "Ligne %s. Le journal utilisé pour le transfert interne doit être différent du journal de l'écriture comptable pour le compte donné : %s." |
127 | + |
128 | +#. module: account_override |
129 | +#: code:addons/account_override/account.py:1035 |
130 | +#, python-format |
131 | +msgid "Account: %s - %s. The Third Party must be a liquidity journal with a currency different from the booking one." |
132 | +msgstr "Compte: %s - %s. Le Tiers doit être un journal de trésorerie avec une devise différente de la devise d'enregistrement." |
133 | + |
134 | +#. module: account_override |
135 | +#: code:addons/account_override/account.py:1031 |
136 | +#, python-format |
137 | +msgid "Account: %s - %s. The Third Party must be a liquidity journal with the same currency as the booking one." |
138 | +msgstr "Compte: %s - %s. Le Tiers doit être un journal de trésorerie avec la même devise que la devise d'enregistrement." |
139 | + |
140 | +#. module: account_override |
141 | +#: code:addons/account_override/account.py:1039 |
142 | +#, python-format |
143 | +msgid "Account: %s - %s. The journal used for the internal transfer must be different from the Journal Entry Journal." |
144 | +msgstr "Compte: %s - %s. Le journal utilisé pour le transfert interne doit être différent du journal de l'écriture comptable." |
145 | +>>>>>>> MERGE-SOURCE |
146 | |
147 | === modified file 'bin/addons/register_accounting/account_bank_statement.py' |
148 | --- bin/addons/register_accounting/account_bank_statement.py 2017-01-31 16:17:06 +0000 |
149 | +++ bin/addons/register_accounting/account_bank_statement.py 2017-02-09 15:23:17 +0000 |
150 | @@ -2835,7 +2835,7 @@ |
151 | third_type = [('hr.employee', 'Employee')] |
152 | third_required = True |
153 | third_selection = 'hr.employee,0' |
154 | - elif a['type_for_register'] == 'down_payment': |
155 | + elif a['type_for_register'] in ['down_payment', 'payroll']: |
156 | third_type = [('res.partner', 'Partner')] |
157 | third_required = True |
158 | third_selection = 'res.partner,0' |
159 | |
160 | === modified file 'bin/addons/register_accounting/account_move_line.py' |
161 | --- bin/addons/register_accounting/account_move_line.py 2016-11-17 08:46:41 +0000 |
162 | +++ bin/addons/register_accounting/account_move_line.py 2017-02-09 15:23:17 +0000 |
163 | @@ -300,11 +300,14 @@ |
164 | third_type = [('account.journal', 'Journal')] |
165 | third_required = True |
166 | third_selection = 'account.journal,0' |
167 | - |
168 | elif acc_type == 'advance': |
169 | third_type = [('hr.employee', 'Employee')] |
170 | third_required = True |
171 | third_selection = 'hr.employee,0' |
172 | + elif acc_type in ['down_payment', 'payroll']: |
173 | + third_type = [('res.partner', 'Partner')] |
174 | + third_required = True |
175 | + third_selection = 'res.partner,0' |
176 | val.update({'partner_type_mandatory': third_required, 'partner_type': {'options': third_type, 'selection': third_selection}}) |
177 | return {'value': val} |
178 | |
179 | |
180 | === modified file 'bin/addons/register_accounting/account_view.xml' |
181 | --- bin/addons/register_accounting/account_view.xml 2017-01-23 15:59:58 +0000 |
182 | +++ bin/addons/register_accounting/account_view.xml 2017-02-09 15:23:17 +0000 |
183 | @@ -943,7 +943,10 @@ |
184 | <field name="arch" type="xml"> |
185 | <data> |
186 | <xpath expr="/form//tree//field[@name='partner_id']" position="after"> |
187 | - <field name="partner_type" context="{'journal_fake_name': True, 'search_default_active': True}"/> |
188 | + <field name="partner_type" |
189 | + attrs="{'required': [('partner_type_mandatory', '=', True)]}" |
190 | + domain="[('filter_for_third_party', '=', account_id)]" |
191 | + context="{'journal_fake_name': True, 'search_default_active': True, 'curr': parent.manual_currency_id, 'journal': parent.journal_id}"/> |
192 | </xpath> |
193 | <xpath expr="/form//tree//field[@name='account_id']" position="replace"> |
194 | <field name="account_id" on_change="onchange_account_id(account_id, partner_type)" domain="[('restricted_area', '=', 'account_move_lines')]"/> |