Merge lp:~julie-w/unifield-server/US-4058 into lp:unifield-server/uf7
- US-4058
- Merge into uf7
Status: | Needs review |
---|---|
Proposed branch: | lp:~julie-w/unifield-server/US-4058 |
Merge into: | lp:unifield-server/uf7 |
Diff against target: |
2496 lines (+524/-392) 21 files modified
bin/addons/account/account_cash_statement.py (+19/-16) bin/addons/account_corrections/account_move_line.py (+10/-2) bin/addons/base/module/module.py (+0/-7) bin/addons/delivery_mechanism/wizard/enter_reason.py (+3/-1) bin/addons/msf_accrual/wizard/wizard_accrual_reversal.py (+1/-1) bin/addons/msf_accrual/wizard/wizard_accrual_validation.py (+2/-2) bin/addons/msf_homere_interface/wizard/hr_payroll_import.py (+3/-0) bin/addons/msf_instance/add_instance.py (+40/-3) bin/addons/msf_outgoing/msf_outgoing.py (+97/-97) bin/addons/msf_outgoing/report/labels.rml (+1/-1) bin/addons/msf_profile/i18n/fr_MF.po (+19/-0) bin/addons/msf_supply_doc_export/wizard/po_follow_up.py (+49/-49) bin/addons/purchase/purchase_workflow.py (+39/-27) bin/addons/register_accounting/report/fully_report_xls.mako (+10/-2) bin/addons/register_accounting/wizard/import_invoice_on_registers.py (+2/-1) bin/addons/register_accounting/wizard/wizard_register_import.py (+93/-70) bin/addons/sale/sale_workflow.py (+42/-27) bin/addons/sync_so/purchase.py (+1/-1) bin/addons/tender_flow/tender_flow.py (+89/-84) bin/release.py (+1/-1) bin/sql_db.py (+3/-0) |
To merge this branch: | bzr merge lp:~julie-w/unifield-server/US-4058 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Dev Team | Pending | ||
Review via email: mp+337538@code.launchpad.net |
Commit message
Description of the change
Unmerged revisions
- 4719. By Julie Nuguet
-
US-4058 [FIX] Accruals: duplications were created when posting accrual & reversal lines
- 4718. By jftempo
-
US-3893 [FIX] C&R IN at header level should set state of stock moves to 'Canceled-r' and FO should remain Confirmed
- 4717. By jftempo
-
US-3944 [FIX] PO/FO: prevent from validating an order with taxes if linked to an intermission partner
- 4716. By jftempo
-
US-3885 [FIX] PO created from Tender are not auto linked to initial IR/FO and AD is not populated from FO
- 4715. By jftempo
-
US-3853 [IMP] Register Lines import: checks on "third party required"
- 4714. By jftempo
-
US-3612 [FIX] Register Full Report: remove duplicates for the use case 'advance return lines linked to Free1/2'
- 4713. By jftempo
-
US-2924 [FIX] Pick pdf labels: print weight
- 4712. By jftempo
-
US-3259 [FIX] PO Follow Up per Supplier: escape html entities
- 4711. By jftempo
-
US-3798 [FIX] Funding Pool: when a FP is created use the current instance_id by default
- 4710. By jftempo
-
US-3493 [IMP] Payroll import: strip spaces in all entries
Preview Diff
1 | === modified file 'bin/addons/account/account_cash_statement.py' | |||
2 | --- bin/addons/account/account_cash_statement.py 2016-08-18 08:32:03 +0000 | |||
3 | +++ bin/addons/account/account_cash_statement.py 2018-02-12 10:19:50 +0000 | |||
4 | @@ -61,7 +61,7 @@ | |||
5 | 61 | 'subtotal': fields.function(_sub_total, method=True, string='Sub Total', type='float', digits_compute=dp.get_precision('Account')), | 61 | 'subtotal': fields.function(_sub_total, method=True, string='Sub Total', type='float', digits_compute=dp.get_precision('Account')), |
6 | 62 | 'starting_id': fields.many2one('account.bank.statement', ondelete='cascade'), | 62 | 'starting_id': fields.many2one('account.bank.statement', ondelete='cascade'), |
7 | 63 | 'ending_id': fields.many2one('account.bank.statement', ondelete='cascade'), | 63 | 'ending_id': fields.many2one('account.bank.statement', ondelete='cascade'), |
9 | 64 | } | 64 | } |
10 | 65 | 65 | ||
11 | 66 | account_cashbox_line() | 66 | account_cashbox_line() |
12 | 67 | 67 | ||
13 | @@ -115,7 +115,7 @@ | |||
14 | 115 | for statement in self.browse(cr, uid, ids, context=context): | 115 | for statement in self.browse(cr, uid, ids, context=context): |
15 | 116 | encoding_total=0.0 | 116 | encoding_total=0.0 |
16 | 117 | for line in statement.line_ids: | 117 | for line in statement.line_ids: |
18 | 118 | encoding_total += line.amount | 118 | encoding_total += line.amount |
19 | 119 | res2[statement.id] = encoding_total | 119 | res2[statement.id] = encoding_total |
20 | 120 | return res2 | 120 | return res2 |
21 | 121 | 121 | ||
22 | @@ -125,7 +125,7 @@ | |||
23 | 125 | res = {} | 125 | res = {} |
24 | 126 | 126 | ||
25 | 127 | company_currency_id = res_users_obj.browse(cursor, user, user, | 127 | company_currency_id = res_users_obj.browse(cursor, user, user, |
27 | 128 | context=context).company_id.currency_id.id | 128 | context=context).company_id.currency_id.id |
28 | 129 | 129 | ||
29 | 130 | statements = self.browse(cursor, user, ids, context=context) | 130 | statements = self.browse(cursor, user, ids, context=context) |
30 | 131 | for statement in statements: | 131 | for statement in statements: |
31 | @@ -136,14 +136,14 @@ | |||
32 | 136 | if line.account_id.id == \ | 136 | if line.account_id.id == \ |
33 | 137 | statement.journal_id.default_debit_account_id.id: | 137 | statement.journal_id.default_debit_account_id.id: |
34 | 138 | res[statement.id] += res_currency_obj.compute(cursor, | 138 | res[statement.id] += res_currency_obj.compute(cursor, |
37 | 139 | user, company_currency_id, currency_id, | 139 | user, company_currency_id, currency_id, |
38 | 140 | line.debit, context=context) | 140 | line.debit, context=context) |
39 | 141 | else: | 141 | else: |
40 | 142 | if line.account_id.id == \ | 142 | if line.account_id.id == \ |
41 | 143 | statement.journal_id.default_credit_account_id.id: | 143 | statement.journal_id.default_credit_account_id.id: |
42 | 144 | res[statement.id] -= res_currency_obj.compute(cursor, | 144 | res[statement.id] -= res_currency_obj.compute(cursor, |
45 | 145 | user, company_currency_id, currency_id, | 145 | user, company_currency_id, currency_id, |
46 | 146 | line.credit, context=context) | 146 | line.credit, context=context) |
47 | 147 | 147 | ||
48 | 148 | if statement.state in ('draft', 'open'): | 148 | if statement.state in ('draft', 'open'): |
49 | 149 | for line in statement.line_ids: | 149 | for line in statement.line_ids: |
50 | @@ -221,8 +221,8 @@ | |||
51 | 221 | 'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm': [('readonly', True)]}, help="closing balance entered by the cashbox verifier"), | 221 | 'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm': [('readonly', True)]}, help="closing balance entered by the cashbox verifier"), |
52 | 222 | 'state': fields.selection( | 222 | 'state': fields.selection( |
53 | 223 | [('draft', 'Draft'), | 223 | [('draft', 'Draft'), |
56 | 224 | ('confirm', 'Closed'), | 224 | ('confirm', 'Closed'), |
57 | 225 | ('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"), | 225 | ('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"), |
58 | 226 | 'total_entry_encoding': fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"), | 226 | 'total_entry_encoding': fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"), |
59 | 227 | 'closing_date': fields.datetime("Closed On"), | 227 | 'closing_date': fields.datetime("Closed On"), |
60 | 228 | 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"), | 228 | 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"), |
61 | @@ -238,12 +238,12 @@ | |||
62 | 238 | 'user_id': lambda self, cr, uid, context=None: uid, | 238 | 'user_id': lambda self, cr, uid, context=None: uid, |
63 | 239 | 'starting_details_ids': _get_cash_open_box_lines, | 239 | 'starting_details_ids': _get_cash_open_box_lines, |
64 | 240 | 'ending_details_ids': _get_default_cash_close_box_lines | 240 | 'ending_details_ids': _get_default_cash_close_box_lines |
66 | 241 | } | 241 | } |
67 | 242 | 242 | ||
68 | 243 | def create(self, cr, uid, vals, context=None): | 243 | def create(self, cr, uid, vals, context=None): |
69 | 244 | sql = [ | 244 | sql = [ |
72 | 245 | ('journal_id', '=', vals.get('journal_id', False)), | 245 | ('journal_id', '=', vals.get('journal_id', False)), |
73 | 246 | ('state', '=', 'open') | 246 | ('state', '=', 'open') |
74 | 247 | ] | 247 | ] |
75 | 248 | open_jrnl = self.search(cr, uid, sql) | 248 | open_jrnl = self.search(cr, uid, sql) |
76 | 249 | if open_jrnl: | 249 | if open_jrnl: |
77 | @@ -255,10 +255,10 @@ | |||
78 | 255 | for start in vals.get('starting_details_ids'): | 255 | for start in vals.get('starting_details_ids'): |
79 | 256 | dict_val = start[2] | 256 | dict_val = start[2] |
80 | 257 | for end in open_close['end']: | 257 | for end in open_close['end']: |
83 | 258 | if end[2]['pieces'] == dict_val['pieces']: | 258 | if end[2]['pieces'] == dict_val['pieces']: |
84 | 259 | end[2]['number'] += dict_val['number'] | 259 | end[2]['number'] += dict_val['number'] |
85 | 260 | vals.update({ | 260 | vals.update({ |
87 | 261 | # 'ending_details_ids': open_close['start'], | 261 | # 'ending_details_ids': open_close['start'], |
88 | 262 | 'starting_details_ids': open_close['end'] | 262 | 'starting_details_ids': open_close['end'] |
89 | 263 | }) | 263 | }) |
90 | 264 | else: | 264 | else: |
91 | @@ -308,8 +308,11 @@ | |||
92 | 308 | return super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context) | 308 | return super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context) |
93 | 309 | 309 | ||
94 | 310 | def _equal_balance(self, cr, uid, cash_id, context=None): | 310 | def _equal_balance(self, cr, uid, cash_id, context=None): |
95 | 311 | if context is None: | ||
96 | 312 | context = {} | ||
97 | 311 | statement = self.browse(cr, uid, cash_id, context=context) | 313 | statement = self.browse(cr, uid, cash_id, context=context) |
99 | 312 | self.write(cr, uid, [cash_id], {'balance_end_real': statement.balance_end}) | 314 | context.update({'from_cash_statement_equal_balance': True}) |
100 | 315 | self.write(cr, uid, [cash_id], {'balance_end_real': statement.balance_end}, context=context) | ||
101 | 313 | statement.balance_end_real = statement.balance_end | 316 | statement.balance_end_real = statement.balance_end |
102 | 314 | if abs(statement.balance_end - statement.balance_end_cash) > 10**-4: | 317 | if abs(statement.balance_end - statement.balance_end_cash) > 10**-4: |
103 | 315 | return False | 318 | return False |
104 | 316 | 319 | ||
105 | === modified file 'bin/addons/account_corrections/account_move_line.py' | |||
106 | --- bin/addons/account_corrections/account_move_line.py 2017-10-27 12:10:07 +0000 | |||
107 | +++ bin/addons/account_corrections/account_move_line.py 2018-02-12 10:19:50 +0000 | |||
108 | @@ -527,6 +527,9 @@ | |||
109 | 527 | j_extra_ids = j_obj.search(cr, uid, [('type', '=', 'extra'), | 527 | j_extra_ids = j_obj.search(cr, uid, [('type', '=', 'extra'), |
110 | 528 | ('is_current_instance', '=', True)]) | 528 | ('is_current_instance', '=', True)]) |
111 | 529 | j_extra_id = j_extra_ids and j_extra_ids[0] or False | 529 | j_extra_id = j_extra_ids and j_extra_ids[0] or False |
112 | 530 | j_ana_extra_ids = ana_j_obj.search(cr, uid, [('type', '=', 'extra'), ('is_current_instance', '=', True)], context=context) | ||
113 | 531 | j_ana_extra_id = j_ana_extra_ids and j_ana_extra_ids[0] or False | ||
114 | 532 | |||
115 | 530 | # Search attached period | 533 | # Search attached period |
116 | 531 | period_ids = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)], context=context, | 534 | period_ids = self.pool.get('account.period').search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)], context=context, |
117 | 532 | limit=1, order='date_start, name') | 535 | limit=1, order='date_start, name') |
118 | @@ -555,8 +558,13 @@ | |||
119 | 555 | journal_id = j_corr_id | 558 | journal_id = j_corr_id |
120 | 556 | if is_inkind: | 559 | if is_inkind: |
121 | 557 | journal_id = j_extra_id | 560 | journal_id = j_extra_id |
124 | 558 | if not journal_id and is_inkind: | 561 | j_ana_corr_id = j_ana_extra_id |
125 | 559 | raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!')) | 562 | |
126 | 563 | if is_inkind: | ||
127 | 564 | if not journal_id: | ||
128 | 565 | raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Journal found!')) | ||
129 | 566 | elif not j_ana_extra_id: | ||
130 | 567 | raise osv.except_osv(_('Error'), _('No OD-Extra Accounting Analytic Journal found!')) | ||
131 | 560 | elif not journal_id: | 568 | elif not journal_id: |
132 | 561 | raise osv.except_osv(_('Error'), _('No correction journal found!')) | 569 | raise osv.except_osv(_('Error'), _('No correction journal found!')) |
133 | 562 | 570 | ||
134 | 563 | 571 | ||
135 | === modified file 'bin/addons/base/module/module.py' | |||
136 | --- bin/addons/base/module/module.py 2017-10-04 05:23:42 +0000 | |||
137 | +++ bin/addons/base/module/module.py 2018-02-12 10:19:50 +0000 | |||
138 | @@ -538,13 +538,6 @@ | |||
139 | 538 | if not mod.description: | 538 | if not mod.description: |
140 | 539 | logger.warn('module %s: description is empty !', mod.name) | 539 | logger.warn('module %s: description is empty !', mod.name) |
141 | 540 | 540 | ||
142 | 541 | if not mod.certificate or not mod.certificate.isdigit(): | ||
143 | 542 | logger.info('module %s: no quality certificate', mod.name) | ||
144 | 543 | else: | ||
145 | 544 | val = long(mod.certificate[2:]) % 97 == 29 | ||
146 | 545 | if not val: | ||
147 | 546 | logger.critical('module %s: invalid quality certificate: %s', mod.name, mod.certificate) | ||
148 | 547 | raise osv.except_osv(_('Error'), _('Module %s: Invalid Quality Certificate') % (mod.name,)) | ||
149 | 548 | 541 | ||
150 | 549 | def list_web(self, cr, uid, context=None): | 542 | def list_web(self, cr, uid, context=None): |
151 | 550 | """ list_web(cr, uid, context) -> [(module_name, module_version)] | 543 | """ list_web(cr, uid, context) -> [(module_name, module_version)] |
152 | 551 | 544 | ||
153 | === modified file 'bin/addons/delivery_mechanism/wizard/enter_reason.py' | |||
154 | --- bin/addons/delivery_mechanism/wizard/enter_reason.py 2017-11-03 10:59:21 +0000 | |||
155 | +++ bin/addons/delivery_mechanism/wizard/enter_reason.py 2018-02-12 10:19:50 +0000 | |||
156 | @@ -66,6 +66,8 @@ | |||
157 | 66 | # set the reason | 66 | # set the reason |
158 | 67 | obj.write({'change_reason': change_reason}, context=context) | 67 | obj.write({'change_reason': change_reason}, context=context) |
159 | 68 | 68 | ||
160 | 69 | if context.get('do_resource', False): | ||
161 | 70 | self.pool.get('stock.move').write(cr, uid, [move.id for move in obj.move_lines], {'has_to_be_resourced': True}, context=context) | ||
162 | 69 | self.pool.get('stock.move').action_cancel(cr, uid, [move.id for move in obj.move_lines], context=context) | 71 | self.pool.get('stock.move').action_cancel(cr, uid, [move.id for move in obj.move_lines], context=context) |
163 | 70 | 72 | ||
164 | 71 | # cancel the IN | 73 | # cancel the IN |
165 | @@ -74,7 +76,7 @@ | |||
166 | 74 | # correct the corresponding po manually if exists - should be in shipping exception | 76 | # correct the corresponding po manually if exists - should be in shipping exception |
167 | 75 | if obj.purchase_id: | 77 | if obj.purchase_id: |
168 | 76 | wf_service.trg_validate(uid, 'purchase.order', obj.purchase_id.id, 'picking_ok', cr) | 78 | wf_service.trg_validate(uid, 'purchase.order', obj.purchase_id.id, 'picking_ok', cr) |
170 | 77 | purchase_obj.log(cr, uid, obj.purchase_id.id, _('The Purchase Order %s is %s%% received')%(obj.purchase_id.name, round(obj.purchase_id.shipped_rate,2))) | 79 | purchase_obj.log(cr, uid, obj.purchase_id.id, _('The Purchase Order %s is %s%% received') % (obj.purchase_id.name, round(obj.purchase_id.shipped_rate, 2))) |
171 | 78 | 80 | ||
172 | 79 | self.infolog(cr, uid, "The Incoming shipment id:%s (%s) has been canceled%s." % ( | 81 | self.infolog(cr, uid, "The Incoming shipment id:%s (%s) has been canceled%s." % ( |
173 | 80 | obj.id, obj.name, cancel_type != 'update_out' and ' and resourced' or '', | 82 | obj.id, obj.name, cancel_type != 'update_out' and ' and resourced' or '', |
174 | 81 | 83 | ||
175 | === modified file 'bin/addons/msf_accrual/wizard/wizard_accrual_reversal.py' | |||
176 | --- bin/addons/msf_accrual/wizard/wizard_accrual_reversal.py 2016-02-19 13:23:15 +0000 | |||
177 | +++ bin/addons/msf_accrual/wizard/wizard_accrual_reversal.py 2018-02-12 10:19:50 +0000 | |||
178 | @@ -70,7 +70,7 @@ | |||
179 | 70 | raise osv.except_osv(_('Warning !'), _("The reversal period '%s' is not open!" % reversal_period.name)) | 70 | raise osv.except_osv(_('Warning !'), _("The reversal period '%s' is not open!" % reversal_period.name)) |
180 | 71 | 71 | ||
181 | 72 | # post the accrual reversal | 72 | # post the accrual reversal |
183 | 73 | accrual_line_obj.accrual_reversal_post(cr, uid, context['active_ids'], document_date, | 73 | accrual_line_obj.accrual_reversal_post(cr, uid, [accrual_line.id], document_date, |
184 | 74 | posting_date, context=context) | 74 | posting_date, context=context) |
185 | 75 | 75 | ||
186 | 76 | # close the wizard | 76 | # close the wizard |
187 | 77 | 77 | ||
188 | === modified file 'bin/addons/msf_accrual/wizard/wizard_accrual_validation.py' | |||
189 | --- bin/addons/msf_accrual/wizard/wizard_accrual_validation.py 2016-05-24 08:44:23 +0000 | |||
190 | +++ bin/addons/msf_accrual/wizard/wizard_accrual_validation.py 2018-02-12 10:19:50 +0000 | |||
191 | @@ -62,11 +62,11 @@ | |||
192 | 62 | raise osv.except_osv(_('Warning !'), _("The reversal period '%s' is not open!" % reversal_period.name)) | 62 | raise osv.except_osv(_('Warning !'), _("The reversal period '%s' is not open!" % reversal_period.name)) |
193 | 63 | 63 | ||
194 | 64 | # post the accrual | 64 | # post the accrual |
196 | 65 | accrual_line_obj.accrual_post(cr, uid, context['active_ids'], context=context) | 65 | accrual_line_obj.accrual_post(cr, uid, [accrual_line.id], context=context) |
197 | 66 | # post its reversal only if it is a reversing accrual | 66 | # post its reversal only if it is a reversing accrual |
198 | 67 | if accrual_line.accrual_type == 'reversing_accrual': | 67 | if accrual_line.accrual_type == 'reversing_accrual': |
199 | 68 | reversal_date = (datetime.datetime.strptime(accrual_line.date, '%Y-%m-%d') + relativedelta(days=1)).strftime('%Y-%m-%d') | 68 | reversal_date = (datetime.datetime.strptime(accrual_line.date, '%Y-%m-%d') + relativedelta(days=1)).strftime('%Y-%m-%d') |
201 | 69 | accrual_line_obj.accrual_reversal_post(cr, uid, context['active_ids'], reversal_date, | 69 | accrual_line_obj.accrual_reversal_post(cr, uid, [accrual_line.id], reversal_date, |
202 | 70 | reversal_date, context=context) | 70 | reversal_date, context=context) |
203 | 71 | 71 | ||
204 | 72 | # close the wizard | 72 | # close the wizard |
205 | 73 | 73 | ||
206 | === modified file 'bin/addons/msf_homere_interface/wizard/hr_payroll_import.py' | |||
207 | --- bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2017-10-06 14:55:12 +0000 | |||
208 | +++ bin/addons/msf_homere_interface/wizard/hr_payroll_import.py 2018-02-12 10:19:50 +0000 | |||
209 | @@ -136,6 +136,9 @@ | |||
210 | 136 | error_message = "" | 136 | error_message = "" |
211 | 137 | partner_obj = self.pool.get('res.partner') | 137 | partner_obj = self.pool.get('res.partner') |
212 | 138 | 138 | ||
213 | 139 | # strip spaces in all columns | ||
214 | 140 | for i in range(len(data)): | ||
215 | 141 | data[i] = data[i].strip() | ||
216 | 139 | if len(data) == 13: | 142 | if len(data) == 13: |
217 | 140 | accounting_code, description, second_description, third, expense, receipt, project, financing_line, \ | 143 | accounting_code, description, second_description, third, expense, receipt, project, financing_line, \ |
218 | 141 | financing_contract, date, currency, project, analytic_line = zip(data) | 144 | financing_contract, date, currency, project, analytic_line = zip(data) |
219 | 142 | 145 | ||
220 | === modified file 'bin/addons/msf_instance/add_instance.py' | |||
221 | --- bin/addons/msf_instance/add_instance.py 2016-10-28 09:07:17 +0000 | |||
222 | +++ bin/addons/msf_instance/add_instance.py 2018-02-12 10:19:50 +0000 | |||
223 | @@ -425,10 +425,27 @@ | |||
224 | 425 | def write(self, cr, uid, ids, vals, context=None): | 425 | def write(self, cr, uid, ids, vals, context=None): |
225 | 426 | if not ids: | 426 | if not ids: |
226 | 427 | return True | 427 | return True |
227 | 428 | if context is None: | ||
228 | 429 | context = {} | ||
229 | 428 | if 'journal_id' in vals: | 430 | if 'journal_id' in vals: |
230 | 429 | journal = self.pool.get('account.journal').read(cr, uid, vals['journal_id'], ['instance_id'], context=context) | 431 | journal = self.pool.get('account.journal').read(cr, uid, vals['journal_id'], ['instance_id'], context=context) |
231 | 430 | vals['instance_id'] = journal.get('instance_id')[0] | 432 | vals['instance_id'] = journal.get('instance_id')[0] |
233 | 431 | return super(account_bank_statement, self).write(cr, uid, ids, vals, context=context) | 433 | res = True |
234 | 434 | for reg in self.browse(cr, uid, ids, fields_to_fetch=['closing_balance_frozen'], context=context): | ||
235 | 435 | # if the End-of-the-Month Balance has already been confirmed for a register, ignore changes on fields that | ||
236 | 436 | # should be read-only in that case (cover the use case of concurrent changes by 2 users) | ||
237 | 437 | newvals = vals.copy() | ||
238 | 438 | if reg.closing_balance_frozen: | ||
239 | 439 | # remove the values for each register with a confirmed balance | ||
240 | 440 | # Note: at Cashbox closing the balance_end_real is set to the reg.balance_end value: keep this change | ||
241 | 441 | if 'balance_end_real' in newvals and not context.get('from_cash_statement_equal_balance', False): | ||
242 | 442 | del newvals['balance_end_real'] | ||
243 | 443 | if 'balance_start' in newvals: | ||
244 | 444 | del newvals['balance_start'] | ||
245 | 445 | if 'ending_details_ids' in newvals: | ||
246 | 446 | del newvals['ending_details_ids'] | ||
247 | 447 | res = res and super(account_bank_statement, self).write(cr, uid, [reg.id], newvals, context=context) | ||
248 | 448 | return res | ||
249 | 432 | 449 | ||
250 | 433 | account_bank_statement() | 450 | account_bank_statement() |
251 | 434 | 451 | ||
252 | @@ -499,8 +516,25 @@ | |||
253 | 499 | vals['instance_id'] = register.get('instance_id')[0] | 516 | vals['instance_id'] = register.get('instance_id')[0] |
254 | 500 | return super(account_cashbox_line, self).write(cr, uid, ids, vals, context=context) | 517 | return super(account_cashbox_line, self).write(cr, uid, ids, vals, context=context) |
255 | 501 | 518 | ||
256 | 519 | def unlink(self, cr, uid, ids, context=None): | ||
257 | 520 | """ | ||
258 | 521 | CashBox Line Deletion method | ||
259 | 522 | The deletion isn't triggered for Closing Balance Lines linked to a reg. with a Confirmed month-end cash count | ||
260 | 523 | (covers the use case of concurrent changes by 2 users) | ||
261 | 524 | """ | ||
262 | 525 | if context is None: | ||
263 | 526 | context = {} | ||
264 | 527 | if isinstance(ids, (int, long)): | ||
265 | 528 | ids = [ids] | ||
266 | 529 | res = True | ||
267 | 530 | for line in self.browse(cr, uid, ids, fields_to_fetch=['ending_id'], context=context): | ||
268 | 531 | if not line.ending_id or not line.ending_id.closing_balance_frozen: | ||
269 | 532 | res = res and super(account_cashbox_line, self).unlink(cr, uid, [line.id], context=context) | ||
270 | 533 | return res | ||
271 | 534 | |||
272 | 502 | account_cashbox_line() | 535 | account_cashbox_line() |
273 | 503 | 536 | ||
274 | 537 | |||
275 | 504 | class account_analytic_account(osv.osv): | 538 | class account_analytic_account(osv.osv): |
276 | 505 | _name = 'account.analytic.account' | 539 | _name = 'account.analytic.account' |
277 | 506 | _inherit = 'account.analytic.account' | 540 | _inherit = 'account.analytic.account' |
278 | @@ -534,10 +568,11 @@ | |||
279 | 534 | 'current_instance_type': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.instance_id.level, | 568 | 'current_instance_type': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.instance_id.level, |
280 | 535 | } | 569 | } |
281 | 536 | 570 | ||
283 | 537 | def check_fp(self, cr, uid, vals, context=None): | 571 | def check_fp(self, cr, uid, vals, to_update=False, context=None): |
284 | 538 | """ | 572 | """ |
285 | 539 | Check that FP have an instance_id | 573 | Check that FP have an instance_id |
286 | 540 | Check that the given instance is not section level! | 574 | Check that the given instance is not section level! |
287 | 575 | If to_update is True and no instance_id is in vals: update vals with the id of the current instance | ||
288 | 541 | """ | 576 | """ |
289 | 542 | if context is None: | 577 | if context is None: |
290 | 543 | context = {} | 578 | context = {} |
291 | @@ -554,6 +589,8 @@ | |||
292 | 554 | if not current_instance or current_instance.level == 'section': | 589 | if not current_instance or current_instance.level == 'section': |
293 | 555 | raise osv.except_osv(_('Error'), _('Proprietary Instance is mandatory for FP accounts!')) | 590 | raise osv.except_osv(_('Error'), _('Proprietary Instance is mandatory for FP accounts!')) |
294 | 556 | instance_id = current_instance.id | 591 | instance_id = current_instance.id |
295 | 592 | if to_update: | ||
296 | 593 | vals.update({'instance_id': instance_id}) | ||
297 | 557 | instance_level = self.pool.get('msf.instance').browse(cr, uid, instance_id).level | 594 | instance_level = self.pool.get('msf.instance').browse(cr, uid, instance_id).level |
298 | 558 | if instance_level == 'section': | 595 | if instance_level == 'section': |
299 | 559 | raise osv.except_osv(_('Warning'), _('Proprietary Instance for FP accounts should be only COORDO and/or MISSION')) | 596 | raise osv.except_osv(_('Warning'), _('Proprietary Instance for FP accounts should be only COORDO and/or MISSION')) |
300 | @@ -567,7 +604,7 @@ | |||
301 | 567 | context = {} | 604 | context = {} |
302 | 568 | # Check that instance_id is filled in for FP | 605 | # Check that instance_id is filled in for FP |
303 | 569 | if context.get('from_web', False) is True: | 606 | if context.get('from_web', False) is True: |
305 | 570 | self.check_fp(cr, uid, vals, context=context) | 607 | self.check_fp(cr, uid, vals, to_update=True, context=context) |
306 | 571 | return super(account_analytic_account, self).create(cr, uid, vals, context=context) | 608 | return super(account_analytic_account, self).create(cr, uid, vals, context=context) |
307 | 572 | 609 | ||
308 | 573 | def write(self, cr, uid, ids, vals, context=None): | 610 | def write(self, cr, uid, ids, vals, context=None): |
309 | 574 | 611 | ||
310 | === modified file 'bin/addons/msf_outgoing/msf_outgoing.py' | |||
311 | --- bin/addons/msf_outgoing/msf_outgoing.py 2017-12-14 17:30:55 +0000 | |||
312 | +++ bin/addons/msf_outgoing/msf_outgoing.py 2018-02-12 10:19:50 +0000 | |||
313 | @@ -613,7 +613,7 @@ | |||
314 | 613 | shipment_name = '%s-%s' % (shipment.name, shipment_number) | 613 | shipment_name = '%s-%s' % (shipment.name, shipment_number) |
315 | 614 | source_shipment_address_id = shipment.address_id.id if shipment.address_id else False | 614 | source_shipment_address_id = shipment.address_id.id if shipment.address_id else False |
316 | 615 | 615 | ||
318 | 616 | if context.get('rw_shipment_name', False) and context.get('sync_message_execution', False): # RW Sync - update the shipment name same as on RW instance | 616 | if context.get('rw_shipment_name', False) and context.get('sync_message_execution', False): # RW Sync - update the shipment name same as on RW instance |
319 | 617 | shipment_name = context.get('rw_shipment_name') | 617 | shipment_name = context.get('rw_shipment_name') |
320 | 618 | del context['rw_shipment_name'] | 618 | del context['rw_shipment_name'] |
321 | 619 | 619 | ||
322 | @@ -659,7 +659,7 @@ | |||
323 | 659 | del context['description_ppl'] | 659 | del context['description_ppl'] |
324 | 660 | 660 | ||
325 | 661 | for family in wizard.family_ids: | 661 | for family in wizard.family_ids: |
327 | 662 | if not family.selected_number: # UTP-1015 fix from Quentin | 662 | if not family.selected_number: # UTP-1015 fix from Quentin |
328 | 663 | continue | 663 | continue |
329 | 664 | 664 | ||
330 | 665 | picking = family.draft_packing_id | 665 | picking = family.draft_packing_id |
331 | @@ -674,7 +674,7 @@ | |||
332 | 674 | 'backorder_id': picking.id, | 674 | 'backorder_id': picking.id, |
333 | 675 | 'shipment_id': False, | 675 | 'shipment_id': False, |
334 | 676 | 'move_lines': [], | 676 | 'move_lines': [], |
336 | 677 | 'description_ppl': description_ppl or picking.description_ppl, # US-803: added the description | 677 | 'description_ppl': description_ppl or picking.description_ppl, # US-803: added the description |
337 | 678 | } | 678 | } |
338 | 679 | # Update context for copy | 679 | # Update context for copy |
339 | 680 | context.update({ | 680 | context.update({ |
340 | @@ -709,8 +709,8 @@ | |||
341 | 709 | 709 | ||
342 | 710 | # Log creation message | 710 | # Log creation message |
343 | 711 | message = _('The new Shipment id:%s (%s) has been created.') | 711 | message = _('The new Shipment id:%s (%s) has been created.') |
346 | 712 | self.log(cr, uid, shipment.id, message%(shipment.id, shipment_name,)) | 712 | self.log(cr, uid, shipment.id, message % (shipment.id, shipment_name,)) |
347 | 713 | self.infolog(cr, uid, message%(shipment.id, shipment.name)) | 713 | self.infolog(cr, uid, message % (shipment.id, shipment.name)) |
348 | 714 | # The shipment is automatically shipped, no more pack states in between. | 714 | # The shipment is automatically shipped, no more pack states in between. |
349 | 715 | self.ship(cr, uid, [shipment_id], context=context) | 715 | self.ship(cr, uid, [shipment_id], context=context) |
350 | 716 | 716 | ||
351 | @@ -729,7 +729,7 @@ | |||
352 | 729 | }) | 729 | }) |
353 | 730 | 730 | ||
354 | 731 | return { | 731 | return { |
356 | 732 | 'name':_("Shipment"), | 732 | 'name': _("Shipment"), |
357 | 733 | 'type': 'ir.actions.act_window', | 733 | 'type': 'ir.actions.act_window', |
358 | 734 | 'res_model': 'shipment', | 734 | 'res_model': 'shipment', |
359 | 735 | 'view_mode': 'form,tree', | 735 | 'view_mode': 'form,tree', |
360 | @@ -881,7 +881,7 @@ | |||
361 | 881 | 'from_pack': family.to_pack - family.selected_number + 1, | 881 | 'from_pack': family.to_pack - family.selected_number + 1, |
362 | 882 | 'to_pack': family.to_pack, | 882 | 'to_pack': family.to_pack, |
363 | 883 | 'state': 'done', | 883 | 'state': 'done', |
365 | 884 | 'not_shipped': True, #BKLG-13: set the pack returned to stock also as not_shipped, for showing to view ship draft | 884 | 'not_shipped': True, # BKLG-13: set the pack returned to stock also as not_shipped, for showing to view ship draft |
366 | 885 | } | 885 | } |
367 | 886 | context['non_stock_noupdate'] = True | 886 | context['non_stock_noupdate'] = True |
368 | 887 | 887 | ||
369 | @@ -902,12 +902,12 @@ | |||
370 | 902 | ('wizard_id', '=', picking_processor_wiz.id), | 902 | ('wizard_id', '=', picking_processor_wiz.id), |
371 | 903 | ('move_id', '=', draft_move.id), | 903 | ('move_id', '=', draft_move.id), |
372 | 904 | ], context=context) | 904 | ], context=context) |
374 | 905 | if not save_as_draft_move: # then create the SaD line: | 905 | if not save_as_draft_move: # then create the SaD line: |
375 | 906 | move_data = self.pool.get('create.picking.move.processor')._get_line_data(cr, uid, wizard=picking_processor_wiz, move=draft_move, context=context) | 906 | move_data = self.pool.get('create.picking.move.processor')._get_line_data(cr, uid, wizard=picking_processor_wiz, move=draft_move, context=context) |
376 | 907 | move_data.update({'quantity': return_qty}) | 907 | move_data.update({'quantity': return_qty}) |
377 | 908 | save_as_draft_move = self.pool.get('create.picking.move.processor').create(cr, uid, move_data, context=context) | 908 | save_as_draft_move = self.pool.get('create.picking.move.processor').create(cr, uid, move_data, context=context) |
378 | 909 | save_as_draft_move = [save_as_draft_move] | 909 | save_as_draft_move = [save_as_draft_move] |
380 | 910 | else: # update Sad line | 910 | else: # update Sad line |
381 | 911 | for sad_move in self.pool.get('create.picking.move.processor').browse(cr, uid, save_as_draft_move, context=context): | 911 | for sad_move in self.pool.get('create.picking.move.processor').browse(cr, uid, save_as_draft_move, context=context): |
382 | 912 | self.pool.get('create.picking.move.processor').write(cr, uid, sad_move.id, { | 912 | self.pool.get('create.picking.move.processor').write(cr, uid, sad_move.id, { |
383 | 913 | 'ordered_quantity': sad_move.ordered_quantity + return_qty, | 913 | 'ordered_quantity': sad_move.ordered_quantity + return_qty, |
384 | @@ -935,13 +935,13 @@ | |||
385 | 935 | # If everything is allright (all draft packing are finished) the shipment is done also | 935 | # If everything is allright (all draft packing are finished) the shipment is done also |
386 | 936 | self.complete_finished(cr, uid, shipment_ids, context=context) | 936 | self.complete_finished(cr, uid, shipment_ids, context=context) |
387 | 937 | 937 | ||
389 | 938 | #UF-2531: Create manually the message for the return pack of the ship | 938 | # UF-2531: Create manually the message for the return pack of the ship |
390 | 939 | if shipment and shipment.id: | 939 | if shipment and shipment.id: |
391 | 940 | self._manual_create_rw_shipment_message(cr, uid, shipment.id, return_info, 'usb_shipment_return_packs_shipment_draft', context=context) | 940 | self._manual_create_rw_shipment_message(cr, uid, shipment.id, return_info, 'usb_shipment_return_packs_shipment_draft', context=context) |
392 | 941 | 941 | ||
393 | 942 | view_id = data_obj.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form') | 942 | view_id = data_obj.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form') |
394 | 943 | return { | 943 | return { |
396 | 944 | 'name':_("Picking Ticket"), | 944 | 'name': _("Picking Ticket"), |
397 | 945 | 'view_mode': 'form,tree', | 945 | 'view_mode': 'form,tree', |
398 | 946 | 'view_id': [view_id and view_id[1] or False], | 946 | 'view_id': [view_id and view_id[1] or False], |
399 | 947 | 'view_type': 'form', | 947 | 'view_type': 'form', |
400 | @@ -1207,13 +1207,13 @@ | |||
401 | 1207 | # if everything is allright (all draft packing are finished) the shipment is done also | 1207 | # if everything is allright (all draft packing are finished) the shipment is done also |
402 | 1208 | self.complete_finished(cr, uid, shipment_ids, context=context) | 1208 | self.complete_finished(cr, uid, shipment_ids, context=context) |
403 | 1209 | 1209 | ||
405 | 1210 | #UF-2531: Create manually the message for the return pack of the ship | 1210 | # UF-2531: Create manually the message for the return pack of the ship |
406 | 1211 | if shipment and shipment.id: | 1211 | if shipment and shipment.id: |
407 | 1212 | self._manual_create_rw_shipment_message(cr, uid, shipment.id, return_info, 'usb_shipment_return_packs', context=context) | 1212 | self._manual_create_rw_shipment_message(cr, uid, shipment.id, return_info, 'usb_shipment_return_packs', context=context) |
408 | 1213 | 1213 | ||
409 | 1214 | view_id = data_obj.get_object_reference(cr, uid, 'msf_outgoing', 'view_shipment_form') | 1214 | view_id = data_obj.get_object_reference(cr, uid, 'msf_outgoing', 'view_shipment_form') |
410 | 1215 | return { | 1215 | return { |
412 | 1216 | 'name':_("Shipment"), | 1216 | 'name': _("Shipment"), |
413 | 1217 | 'view_mode': 'form,tree', | 1217 | 'view_mode': 'form,tree', |
414 | 1218 | 'view_id': [view_id and view_id[1] or False], | 1218 | 'view_id': [view_id and view_id[1] or False], |
415 | 1219 | 'view_type': 'form', | 1219 | 'view_type': 'form', |
416 | @@ -1279,7 +1279,7 @@ | |||
417 | 1279 | # the state does not need to be updated - function | 1279 | # the state does not need to be updated - function |
418 | 1280 | # update actual ship date (shipment_actual_date) to today + time | 1280 | # update actual ship date (shipment_actual_date) to today + time |
419 | 1281 | today = time.strftime(db_datetime_format) | 1281 | today = time.strftime(db_datetime_format) |
421 | 1282 | vals = {'shipment_actual_date': today,} | 1282 | vals = {'shipment_actual_date': today, } |
422 | 1283 | if context.get('source_shipment_address_id', False): | 1283 | if context.get('source_shipment_address_id', False): |
423 | 1284 | vals['address_id'] = context['source_shipment_address_id'] | 1284 | vals['address_id'] = context['source_shipment_address_id'] |
424 | 1285 | 1285 | ||
425 | @@ -1308,7 +1308,7 @@ | |||
426 | 1308 | pick_obj.write(cr, uid, [new_packing_id], ({'claim': True}), context=context) | 1308 | pick_obj.write(cr, uid, [new_packing_id], ({'claim': True}), context=context) |
427 | 1309 | new_packing = pick_obj.browse(cr, uid, new_packing_id, context=context) | 1309 | new_packing = pick_obj.browse(cr, uid, new_packing_id, context=context) |
428 | 1310 | 1310 | ||
430 | 1311 | if new_packing.move_lines and pick_obj._get_usb_entity_type(cr, uid) == pick_obj.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): # RW Sync - set the replicated to True for not syncing it again | 1311 | if new_packing.move_lines and pick_obj._get_usb_entity_type(cr, uid) == pick_obj.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): # RW Sync - set the replicated to True for not syncing it again |
431 | 1312 | pick_obj.write(cr, uid, [new_packing_id], {'for_shipment_replicate': True}, context=context) | 1312 | pick_obj.write(cr, uid, [new_packing_id], {'for_shipment_replicate': True}, context=context) |
432 | 1313 | 1313 | ||
433 | 1314 | # update the shipment_date of the corresponding sale order if the date is not set yet - with current date | 1314 | # update the shipment_date of the corresponding sale order if the date is not set yet - with current date |
434 | @@ -1490,7 +1490,7 @@ | |||
435 | 1490 | 'payment_term': payment_term_id, | 1490 | 'payment_term': payment_term_id, |
436 | 1491 | 'fiscal_position': partner.property_account_position.id, | 1491 | 'fiscal_position': partner.property_account_position.id, |
437 | 1492 | 'date_invoice': context.get('date_inv', False) or today, | 1492 | 'date_invoice': context.get('date_inv', False) or today, |
439 | 1493 | 'user_id':uid, | 1493 | 'user_id': uid, |
440 | 1494 | } | 1494 | } |
441 | 1495 | 1495 | ||
442 | 1496 | cur_id = shipment.pack_family_memory_ids[0].currency_id.id | 1496 | cur_id = shipment.pack_family_memory_ids[0].currency_id.id |
443 | @@ -1826,8 +1826,8 @@ | |||
444 | 1826 | _name = 'stock.picking' | 1826 | _name = 'stock.picking' |
445 | 1827 | 1827 | ||
446 | 1828 | # For use only in Remote Warehouse | 1828 | # For use only in Remote Warehouse |
449 | 1829 | CENTRAL_PLATFORM="central_platform" | 1829 | CENTRAL_PLATFORM = "central_platform" |
450 | 1830 | REMOTE_WAREHOUSE="remote_warehouse" | 1830 | REMOTE_WAREHOUSE = "remote_warehouse" |
451 | 1831 | 1831 | ||
452 | 1832 | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): | 1832 | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): |
453 | 1833 | ''' | 1833 | ''' |
454 | @@ -1855,8 +1855,8 @@ | |||
455 | 1855 | pass | 1855 | pass |
456 | 1856 | 1856 | ||
457 | 1857 | res = super(stock_picking, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu) | 1857 | res = super(stock_picking, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu) |
460 | 1858 | #US-688 Do not show the button new, duplicate in the tree and form view of picking | 1858 | # US-688 Do not show the button new, duplicate in the tree and form view of picking |
461 | 1859 | if view_type in ['tree','form'] and res['name'] in ['picking.ticket.form', 'picking.ticket.tree']: | 1859 | if view_type in ['tree', 'form'] and res['name'] in ['picking.ticket.form', 'picking.ticket.tree']: |
462 | 1860 | root = etree.fromstring(res['arch']) | 1860 | root = etree.fromstring(res['arch']) |
463 | 1861 | root.set('hide_new_button', 'True') | 1861 | root.set('hide_new_button', 'True') |
464 | 1862 | root.set('hide_delete_button', 'True') | 1862 | root.set('hide_delete_button', 'True') |
465 | @@ -1906,7 +1906,7 @@ | |||
466 | 1906 | context.update({'picking_type': 'incoming_shipment'}) | 1906 | context.update({'picking_type': 'incoming_shipment'}) |
467 | 1907 | else: | 1907 | else: |
468 | 1908 | context.update({'picking_type': 'internal_move'}) | 1908 | context.update({'picking_type': 'internal_move'}) |
470 | 1909 | context.update({'_terp_view_name': 'Internal Moves'}) # REF-92: Update also the Form view name, otherwise Products to Process | 1909 | context.update({'_terp_view_name': 'Internal Moves'}) # REF-92: Update also the Form view name, otherwise Products to Process |
471 | 1910 | 1910 | ||
472 | 1911 | return super(stock_picking, self)._hook_picking_get_view(cr, uid, ids, context=context, *args, **kwargs) | 1911 | return super(stock_picking, self)._hook_picking_get_view(cr, uid, ids, context=context, *args, **kwargs) |
473 | 1912 | 1912 | ||
474 | @@ -2702,7 +2702,7 @@ | |||
475 | 2702 | res = cr.dictfetchone() | 2702 | res = cr.dictfetchone() |
476 | 2703 | if res and res['id']: | 2703 | if res and res['id']: |
477 | 2704 | seq = 'ir_sequence_%03d' % res['id'] | 2704 | seq = 'ir_sequence_%03d' % res['id'] |
479 | 2705 | cr.execute("ALTER SEQUENCE " + seq +" RESTART WITH " + str(value_to_force)) | 2705 | cr.execute("ALTER SEQUENCE " + seq + " RESTART WITH " + str(value_to_force)) |
480 | 2706 | return | 2706 | return |
481 | 2707 | 2707 | ||
482 | 2708 | def create(self, cr, uid, vals, context=None): | 2708 | def create(self, cr, uid, vals, context=None): |
483 | @@ -2734,12 +2734,12 @@ | |||
484 | 2734 | # The following lines are to re-enter explicitly the values, even if they are already set to False | 2734 | # The following lines are to re-enter explicitly the values, even if they are already set to False |
485 | 2735 | vals['backorder_id'] = vals.get('backorder_id', False) | 2735 | vals['backorder_id'] = vals.get('backorder_id', False) |
486 | 2736 | vals['shipment_id'] = vals.get('shipment_id', False) | 2736 | vals['shipment_id'] = vals.get('shipment_id', False) |
488 | 2737 | else: # if it is a CONSO-OUT --_> set the state for replicating back to CP | 2737 | else: # if it is a CONSO-OUT --_> set the state for replicating back to CP |
489 | 2738 | if 'name' in vals and 'OUT-CONSO' in vals['name']: | 2738 | if 'name' in vals and 'OUT-CONSO' in vals['name']: |
490 | 2739 | vals.update(already_replicated=False,) | 2739 | vals.update(already_replicated=False,) |
494 | 2740 | #UF-2531: When the INT from scratch created in RW, just set it for sync to CP | 2740 | # UF-2531: When the INT from scratch created in RW, just set it for sync to CP |
495 | 2741 | if usb_entity == self.REMOTE_WAREHOUSE and (('type' in vals and vals['type']=='internal') or | 2741 | if usb_entity == self.REMOTE_WAREHOUSE and (('type' in vals and vals['type'] == 'internal') or |
496 | 2742 | ('origin' not in vals or vals['origin']==False)): #US-702 Sync also the OUT from scratch in RW | 2742 | ('origin' not in vals or vals['origin'] == False)): # US-702 Sync also the OUT from scratch in RW |
497 | 2743 | vals.update(already_replicated=False,) | 2743 | vals.update(already_replicated=False,) |
498 | 2744 | 2744 | ||
499 | 2745 | # the action adds subtype in the context depending from which screen it is created | 2745 | # the action adds subtype in the context depending from which screen it is created |
500 | @@ -2771,10 +2771,10 @@ | |||
501 | 2771 | 2771 | ||
502 | 2772 | if not vals['backorder_id']: | 2772 | if not vals['backorder_id']: |
503 | 2773 | # creation of *draft* picking ticket | 2773 | # creation of *draft* picking ticket |
508 | 2774 | vals.update(sequence_id=self.create_sequence(cr, uid, {'name':vals['name'], | 2774 | vals.update(sequence_id=self.create_sequence(cr, uid, {'name': vals['name'], |
509 | 2775 | 'code':vals['name'], | 2775 | 'code': vals['name'], |
510 | 2776 | 'prefix':'', | 2776 | 'prefix': '', |
511 | 2777 | 'padding':2}, context=context)) | 2777 | 'padding': 2}, context=context)) |
512 | 2778 | 2778 | ||
513 | 2779 | if 'subtype' in vals and vals['subtype'] == 'packing': | 2779 | if 'subtype' in vals and vals['subtype'] == 'packing': |
514 | 2780 | # creation of a new packing | 2780 | # creation of a new packing |
515 | @@ -2783,10 +2783,10 @@ | |||
516 | 2783 | 2783 | ||
517 | 2784 | if not vals['backorder_id']: | 2784 | if not vals['backorder_id']: |
518 | 2785 | # creation of *draft* picking ticket | 2785 | # creation of *draft* picking ticket |
523 | 2786 | vals.update(sequence_id=self.create_sequence(cr, uid, {'name':vals['name'], | 2786 | vals.update(sequence_id=self.create_sequence(cr, uid, {'name': vals['name'], |
524 | 2787 | 'code':vals['name'], | 2787 | 'code': vals['name'], |
525 | 2788 | 'prefix':'', | 2788 | 'prefix': '', |
526 | 2789 | 'padding':2, | 2789 | 'padding': 2, |
527 | 2790 | }, context=context)) | 2790 | }, context=context)) |
528 | 2791 | 2791 | ||
529 | 2792 | # create packing object | 2792 | # create packing object |
530 | @@ -2797,7 +2797,7 @@ | |||
531 | 2797 | if new_packing and ((new_packing.type == 'out' and new_packing.subtype == 'picking' and new_packing.name.find('-') == -1) or | 2797 | if new_packing and ((new_packing.type == 'out' and new_packing.subtype == 'picking' and new_packing.name.find('-') == -1) or |
532 | 2798 | (new_packing.type == 'in' and new_packing.subtype == 'standard') or | 2798 | (new_packing.type == 'in' and new_packing.subtype == 'standard') or |
533 | 2799 | (new_packing.type == 'internal' and new_packing.subtype == 'standard' and new_packing.sale_id)): | 2799 | (new_packing.type == 'internal' and new_packing.subtype == 'standard' and new_packing.sale_id)): |
535 | 2800 | for_update = {'already_replicated':False} | 2800 | for_update = {'already_replicated': False} |
536 | 2801 | 2801 | ||
537 | 2802 | ''' | 2802 | ''' |
538 | 2803 | Only get the current sequence for the IN object at the moment, as we still have problem with the naming of documents functionally | 2803 | Only get the current sequence for the IN object at the moment, as we still have problem with the naming of documents functionally |
539 | @@ -2911,7 +2911,7 @@ | |||
540 | 2911 | shipment_ids = [n['id']] | 2911 | shipment_ids = [n['id']] |
541 | 2912 | found = True | 2912 | found = True |
542 | 2913 | break | 2913 | break |
544 | 2914 | if not found: # If the name is new, then create a new Shipment | 2914 | if not found: # If the name is new, then create a new Shipment |
545 | 2915 | shipment_ids = [] | 2915 | shipment_ids = [] |
546 | 2916 | 2916 | ||
547 | 2917 | # only one 'draft' shipment should be available | 2917 | # only one 'draft' shipment should be available |
548 | @@ -2946,10 +2946,10 @@ | |||
549 | 2946 | 'shipment_actual_date': rts, | 2946 | 'shipment_actual_date': rts, |
550 | 2947 | 'sale_id': vals.get('sale_id', False), | 2947 | 'sale_id': vals.get('sale_id', False), |
551 | 2948 | 'transport_type': sale_id and sale_order_obj.read(cr, uid, sale_id, ['transport_type'], context=context)['transport_type'] or False, | 2948 | 'transport_type': sale_id and sale_order_obj.read(cr, uid, sale_id, ['transport_type'], context=context)['transport_type'] or False, |
556 | 2949 | 'sequence_id': self.create_sequence(cr, uid, {'name':name, | 2949 | 'sequence_id': self.create_sequence(cr, uid, {'name': name, |
557 | 2950 | 'code':name, | 2950 | 'code': name, |
558 | 2951 | 'prefix':'', | 2951 | 'prefix': '', |
559 | 2952 | 'padding':2}, context=context)} | 2952 | 'padding': 2}, context=context)} |
560 | 2953 | 2953 | ||
561 | 2954 | shipment_id = shipment_obj.create(cr, uid, values, context=context) | 2954 | shipment_id = shipment_obj.create(cr, uid, values, context=context) |
562 | 2955 | shipment_obj.log(cr, uid, shipment_id, _('The new Draft Shipment %s has been created.') % (name,)) | 2955 | shipment_obj.log(cr, uid, shipment_id, _('The new Draft Shipment %s has been created.') % (name,)) |
563 | @@ -3225,7 +3225,7 @@ | |||
564 | 3225 | search_view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'view_picking_out_search') | 3225 | search_view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'view_picking_out_search') |
565 | 3226 | search_view_id = search_view_id and search_view_id[1] or False | 3226 | search_view_id = search_view_id and search_view_id[1] or False |
566 | 3227 | context.update({'picking_type': 'delivery_order', 'view_id': view_id, 'search_view_id': search_view_id}) | 3227 | context.update({'picking_type': 'delivery_order', 'view_id': view_id, 'search_view_id': search_view_id}) |
568 | 3228 | return {'name':_("Delivery Orders"), | 3228 | return {'name': _("Delivery Orders"), |
569 | 3229 | 'view_mode': 'form,tree', | 3229 | 'view_mode': 'form,tree', |
570 | 3230 | 'view_id': [view_id, tree_view_id], | 3230 | 'view_id': [view_id, tree_view_id], |
571 | 3231 | 'search_view_id': search_view_id, | 3231 | 'search_view_id': search_view_id, |
572 | @@ -3287,10 +3287,10 @@ | |||
573 | 3287 | 'subtype': 'picking', | 3287 | 'subtype': 'picking', |
574 | 3288 | 'converted_to_standard': False, | 3288 | 'converted_to_standard': False, |
575 | 3289 | 'state': 'draft', | 3289 | 'state': 'draft', |
580 | 3290 | 'sequence_id': self.create_sequence(cr, uid, {'name':new_name, | 3290 | 'sequence_id': self.create_sequence(cr, uid, {'name': new_name, |
581 | 3291 | 'code':new_name, | 3291 | 'code': new_name, |
582 | 3292 | 'prefix':'', | 3292 | 'prefix': '', |
583 | 3293 | 'padding':2}, context=context) | 3293 | 'padding': 2}, context=context) |
584 | 3294 | } | 3294 | } |
585 | 3295 | 3295 | ||
586 | 3296 | self.write(cr, uid, [out.id], default_vals, context=context) | 3296 | self.write(cr, uid, [out.id], default_vals, context=context) |
587 | @@ -3465,13 +3465,13 @@ | |||
588 | 3465 | if need_new_picking and not rw_full_process: | 3465 | if need_new_picking and not rw_full_process: |
589 | 3466 | cp_vals = { | 3466 | cp_vals = { |
590 | 3467 | 'name': sequence_obj.get(cr, uid, 'stock.picking.%s' % (picking.type)), | 3467 | 'name': sequence_obj.get(cr, uid, 'stock.picking.%s' % (picking.type)), |
593 | 3468 | 'move_lines' : [], | 3468 | 'move_lines': [], |
594 | 3469 | 'state':'draft', | 3469 | 'state': 'draft', |
595 | 3470 | } | 3470 | } |
596 | 3471 | context['allow_copy'] = True | 3471 | context['allow_copy'] = True |
597 | 3472 | 3472 | ||
598 | 3473 | new_picking_id = picking_obj.copy(cr, uid, picking.id, cp_vals, context=context) | 3473 | new_picking_id = picking_obj.copy(cr, uid, picking.id, cp_vals, context=context) |
600 | 3474 | # US-327: if it's an internal picking and in partial process, then set the already_replicated to True, so no replicate needed | 3474 | # US-327: if it's an internal picking and in partial process, then set the already_replicated to True, so no replicate needed |
601 | 3475 | if picking.type == 'internal' and (usb_entity == self.REMOTE_WAREHOUSE or context.get('sync_message_execution', False)): | 3475 | if picking.type == 'internal' and (usb_entity == self.REMOTE_WAREHOUSE or context.get('sync_message_execution', False)): |
602 | 3476 | to_be_replicated = False | 3476 | to_be_replicated = False |
603 | 3477 | self.write(cr, uid, [new_picking_id], {'already_replicated': True}, context=context) | 3477 | self.write(cr, uid, [new_picking_id], {'already_replicated': True}, context=context) |
604 | @@ -3646,14 +3646,14 @@ | |||
605 | 3646 | # Create the new picking object | 3646 | # Create the new picking object |
606 | 3647 | # A sequence for each draft picking ticket is used for the picking ticket | 3647 | # A sequence for each draft picking ticket is used for the picking ticket |
607 | 3648 | 3648 | ||
609 | 3649 | #UF-2531: Use the name of the PICK sent from the RW sync if it's the case | 3649 | # UF-2531: Use the name of the PICK sent from the RW sync if it's the case |
610 | 3650 | pick_name = False | 3650 | pick_name = False |
611 | 3651 | already_replicated = False | 3651 | already_replicated = False |
612 | 3652 | if 'associate_pick_name' in context: | 3652 | if 'associate_pick_name' in context: |
613 | 3653 | pick_name = context.get('associate_pick_name', False) | 3653 | pick_name = context.get('associate_pick_name', False) |
614 | 3654 | del context['associate_pick_name'] | 3654 | del context['associate_pick_name'] |
615 | 3655 | already_replicated = True | 3655 | already_replicated = True |
617 | 3656 | #US-803: Set the pick name that given from sync | 3656 | # US-803: Set the pick name that given from sync |
618 | 3657 | elif 'rw_backorder_name' in context: | 3657 | elif 'rw_backorder_name' in context: |
619 | 3658 | pick_name = context.get('rw_backorder_name', False) | 3658 | pick_name = context.get('rw_backorder_name', False) |
620 | 3659 | del context['rw_backorder_name'] | 3659 | del context['rw_backorder_name'] |
621 | @@ -3767,7 +3767,7 @@ | |||
622 | 3767 | if usb_entity == self.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): | 3767 | if usb_entity == self.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): |
623 | 3768 | self._manual_create_rw_messages(cr, uid, context=context) | 3768 | self._manual_create_rw_messages(cr, uid, context=context) |
624 | 3769 | 3769 | ||
626 | 3770 | return {'name':_("Picking Ticket"), | 3770 | return {'name': _("Picking Ticket"), |
627 | 3771 | 'view_mode': 'form,tree', | 3771 | 'view_mode': 'form,tree', |
628 | 3772 | 'view_id': [view_id], | 3772 | 'view_id': [view_id], |
629 | 3773 | 'view_type': 'form', | 3773 | 'view_type': 'form', |
630 | @@ -3864,7 +3864,7 @@ | |||
631 | 3864 | }) | 3864 | }) |
632 | 3865 | 3865 | ||
633 | 3866 | # Create the new ppl object | 3866 | # Create the new ppl object |
635 | 3867 | #US-702: If the PPL is from RW, then add the suffix RW, if it is created via RW Sync in CP, then use the one from the context (name sent by RW instance) | 3867 | # US-702: If the PPL is from RW, then add the suffix RW, if it is created via RW Sync in CP, then use the one from the context (name sent by RW instance) |
636 | 3868 | ppl_number = 'PPL/%s' % picking.name.split("/")[1] | 3868 | ppl_number = 'PPL/%s' % picking.name.split("/")[1] |
637 | 3869 | if context.get('rw_backorder_name', False): | 3869 | if context.get('rw_backorder_name', False): |
638 | 3870 | ppl_number = context.get('rw_backorder_name') | 3870 | ppl_number = context.get('rw_backorder_name') |
639 | @@ -3979,7 +3979,7 @@ | |||
640 | 3979 | diff_qty = move_vals['initial_qty'] - move_vals['processed_qty'] | 3979 | diff_qty = move_vals['initial_qty'] - move_vals['processed_qty'] |
641 | 3980 | if diff_qty != 0.00: | 3980 | if diff_qty != 0.00: |
642 | 3981 | # Original move from the draft picking ticket which will be updated | 3981 | # Original move from the draft picking ticket which will be updated |
644 | 3982 | if move_vals['move'].backmove_id: #2531: Added a check to make sure the following code can be run correctly | 3982 | if move_vals['move'].backmove_id: # 2531: Added a check to make sure the following code can be run correctly |
645 | 3983 | original_move_id = move_vals['move'].backmove_id.id | 3983 | original_move_id = move_vals['move'].backmove_id.id |
646 | 3984 | original_vals = move_obj.browse(cr, uid, original_move_id, context=context) | 3984 | original_vals = move_obj.browse(cr, uid, original_move_id, context=context) |
647 | 3985 | if original_vals.product_uom.id != move_vals['move'].product_uom.id: | 3985 | if original_vals.product_uom.id != move_vals['move'].product_uom.id: |
648 | @@ -4020,7 +4020,7 @@ | |||
649 | 4020 | if usb_entity == self.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): | 4020 | if usb_entity == self.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): |
650 | 4021 | self._manual_create_rw_messages(cr, uid, context=context) | 4021 | self._manual_create_rw_messages(cr, uid, context=context) |
651 | 4022 | 4022 | ||
653 | 4023 | return {'name':_("Pre-Packing List"), | 4023 | return {'name': _("Pre-Packing List"), |
654 | 4024 | 'view_mode': 'form,tree', | 4024 | 'view_mode': 'form,tree', |
655 | 4025 | 'view_id': [view_id], | 4025 | 'view_id': [view_id], |
656 | 4026 | 'view_type': 'form', | 4026 | 'view_type': 'form', |
657 | @@ -4225,7 +4225,7 @@ | |||
658 | 4225 | 'shipment_id': False, | 4225 | 'shipment_id': False, |
659 | 4226 | 'origin': picking.origin, | 4226 | 'origin': picking.origin, |
660 | 4227 | 'move_lines': [], | 4227 | 'move_lines': [], |
662 | 4228 | 'date': today, # Set date as today for the new PACK object | 4228 | 'date': today, # Set date as today for the new PACK object |
663 | 4229 | } | 4229 | } |
664 | 4230 | 4230 | ||
665 | 4231 | # Change the context for copy | 4231 | # Change the context for copy |
666 | @@ -4239,7 +4239,7 @@ | |||
667 | 4239 | new_packing_id = self.copy(cr, uid, picking.id, pack_values, context=context) | 4239 | new_packing_id = self.copy(cr, uid, picking.id, pack_values, context=context) |
668 | 4240 | if picking.claim: | 4240 | if picking.claim: |
669 | 4241 | self.write(cr, uid, new_packing_id, ({'claim': True}), context=context) | 4241 | self.write(cr, uid, new_packing_id, ({'claim': True}), context=context) |
671 | 4242 | if usb_entity == self.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): # RW Sync - set the replicated to True for not syncing it again | 4242 | if usb_entity == self.REMOTE_WAREHOUSE and not context.get('sync_message_execution', False): # RW Sync - set the replicated to True for not syncing it again |
672 | 4243 | self.write(cr, uid, new_packing_id, {'already_replicated': False}, context=context) | 4243 | self.write(cr, uid, new_packing_id, {'already_replicated': False}, context=context) |
673 | 4244 | 4244 | ||
674 | 4245 | # Reset context values | 4245 | # Reset context values |
675 | @@ -4336,7 +4336,7 @@ | |||
676 | 4336 | shipment_id = obj.shipment_id.id | 4336 | shipment_id = obj.shipment_id.id |
677 | 4337 | shipment_name = obj.shipment_id.name | 4337 | shipment_name = obj.shipment_id.name |
678 | 4338 | 4338 | ||
680 | 4339 | if context.get('rw_shipment_name', False) and context.get('sync_message_execution', False): # RW Sync - update the shipment name same as on RW instance | 4339 | if context.get('rw_shipment_name', False) and context.get('sync_message_execution', False): # RW Sync - update the shipment name same as on RW instance |
681 | 4340 | new_name = context.get('rw_shipment_name') | 4340 | new_name = context.get('rw_shipment_name') |
682 | 4341 | if new_name != obj.shipment_id.name: | 4341 | if new_name != obj.shipment_id.name: |
683 | 4342 | del context['rw_shipment_name'] | 4342 | del context['rw_shipment_name'] |
684 | @@ -4356,7 +4356,7 @@ | |||
685 | 4356 | 4356 | ||
686 | 4357 | view_id = data_obj.get_object_reference(cr, uid, 'msf_outgoing', 'view_shipment_form') | 4357 | view_id = data_obj.get_object_reference(cr, uid, 'msf_outgoing', 'view_shipment_form') |
687 | 4358 | view_id = view_id and view_id[1] or False | 4358 | view_id = view_id and view_id[1] or False |
689 | 4359 | return {'name':_("Shipment"), | 4359 | return {'name': _("Shipment"), |
690 | 4360 | 'view_mode': 'form,tree', | 4360 | 'view_mode': 'form,tree', |
691 | 4361 | 'view_id': [view_id], | 4361 | 'view_id': [view_id], |
692 | 4362 | 'view_type': 'form', | 4362 | 'view_type': 'form', |
693 | @@ -4490,12 +4490,12 @@ | |||
694 | 4490 | ('wizard_id', '=', picking_processor_wiz.id), | 4490 | ('wizard_id', '=', picking_processor_wiz.id), |
695 | 4491 | ('move_id', '=', draft_move_id), | 4491 | ('move_id', '=', draft_move_id), |
696 | 4492 | ], context=context) | 4492 | ], context=context) |
698 | 4493 | if not save_as_draft_move: # then create the SaD line: | 4493 | if not save_as_draft_move: # then create the SaD line: |
699 | 4494 | move_data = self.pool.get('create.picking.move.processor')._get_line_data(cr, uid, wizard=picking_processor_wiz, move=line.move_id.backmove_id, context=context) | 4494 | move_data = self.pool.get('create.picking.move.processor')._get_line_data(cr, uid, wizard=picking_processor_wiz, move=line.move_id.backmove_id, context=context) |
700 | 4495 | move_data.update({'quantity': return_qty}) | 4495 | move_data.update({'quantity': return_qty}) |
701 | 4496 | save_as_draft_move = self.pool.get('create.picking.move.processor').create(cr, uid, move_data, context=context) | 4496 | save_as_draft_move = self.pool.get('create.picking.move.processor').create(cr, uid, move_data, context=context) |
702 | 4497 | save_as_draft_move = [save_as_draft_move] | 4497 | save_as_draft_move = [save_as_draft_move] |
704 | 4498 | else: # update Sad line | 4498 | else: # update Sad line |
705 | 4499 | for sad_move in self.pool.get('create.picking.move.processor').browse(cr, uid, save_as_draft_move, context=context): | 4499 | for sad_move in self.pool.get('create.picking.move.processor').browse(cr, uid, save_as_draft_move, context=context): |
706 | 4500 | self.pool.get('create.picking.move.processor').write(cr, uid, sad_move.id, { | 4500 | self.pool.get('create.picking.move.processor').write(cr, uid, sad_move.id, { |
707 | 4501 | 'ordered_quantity': sad_move.ordered_quantity + return_qty, | 4501 | 'ordered_quantity': sad_move.ordered_quantity + return_qty, |
708 | @@ -4537,17 +4537,17 @@ | |||
709 | 4537 | view_id = view_id and view_id[1] or False | 4537 | view_id = view_id and view_id[1] or False |
710 | 4538 | context['picking_type'] = 'picking_ticket' | 4538 | context['picking_type'] = 'picking_ticket' |
711 | 4539 | 4539 | ||
713 | 4540 | #UF-2531: Create manually the message for the return pack of the ship | 4540 | # UF-2531: Create manually the message for the return pack of the ship |
714 | 4541 | self._manual_create_rw_picking_message(cr, uid, picking.id, return_info, 'usb_picking_return_products', context=context) | 4541 | self._manual_create_rw_picking_message(cr, uid, picking.id, return_info, 'usb_picking_return_products', context=context) |
715 | 4542 | 4542 | ||
716 | 4543 | context.update({'picking_type': 'picking_ticket'}) | 4543 | context.update({'picking_type': 'picking_ticket'}) |
717 | 4544 | return { | 4544 | return { |
719 | 4545 | 'name':_("Picking Ticket"), | 4545 | 'name': _("Picking Ticket"), |
720 | 4546 | 'view_mode': 'form,tree', | 4546 | 'view_mode': 'form,tree', |
721 | 4547 | 'view_id': [view_id], | 4547 | 'view_id': [view_id], |
722 | 4548 | 'view_type': 'form', | 4548 | 'view_type': 'form', |
723 | 4549 | 'res_model': 'stock.picking', | 4549 | 'res_model': 'stock.picking', |
725 | 4550 | 'res_id': draft_picking_id , | 4550 | 'res_id': draft_picking_id, |
726 | 4551 | 'type': 'ir.actions.act_window', | 4551 | 'type': 'ir.actions.act_window', |
727 | 4552 | 'target': 'crush', | 4552 | 'target': 'crush', |
728 | 4553 | 'context': context, | 4553 | 'context': context, |
729 | @@ -4641,12 +4641,12 @@ | |||
730 | 4641 | ('wizard_id', '=', picking_processor_wiz.id), | 4641 | ('wizard_id', '=', picking_processor_wiz.id), |
731 | 4642 | ('move_id', '=', draft_move.id), | 4642 | ('move_id', '=', draft_move.id), |
732 | 4643 | ], context=context) | 4643 | ], context=context) |
734 | 4644 | if not save_as_draft_move: # then create the SaD line: | 4644 | if not save_as_draft_move: # then create the SaD line: |
735 | 4645 | move_data = self.pool.get('create.picking.move.processor')._get_line_data(cr, uid, wizard=picking_processor_wiz, move=move, context=context) | 4645 | move_data = self.pool.get('create.picking.move.processor')._get_line_data(cr, uid, wizard=picking_processor_wiz, move=move, context=context) |
736 | 4646 | move_data.update({'quantity': move.product_qty}) | 4646 | move_data.update({'quantity': move.product_qty}) |
737 | 4647 | save_as_draft_move = self.pool.get('create.picking.move.processor').create(cr, uid, move_data, context=context) | 4647 | save_as_draft_move = self.pool.get('create.picking.move.processor').create(cr, uid, move_data, context=context) |
738 | 4648 | save_as_draft_move = [save_as_draft_move] | 4648 | save_as_draft_move = [save_as_draft_move] |
740 | 4649 | else: # update Sad line | 4649 | else: # update Sad line |
741 | 4650 | for sad_move in self.pool.get('create.picking.move.processor').browse(cr, uid, save_as_draft_move, context=context): | 4650 | for sad_move in self.pool.get('create.picking.move.processor').browse(cr, uid, save_as_draft_move, context=context): |
742 | 4651 | self.pool.get('create.picking.move.processor').write(cr, uid, sad_move.id, { | 4651 | self.pool.get('create.picking.move.processor').write(cr, uid, sad_move.id, { |
743 | 4652 | 'ordered_quantity': sad_move.ordered_quantity + move.product_qty, | 4652 | 'ordered_quantity': sad_move.ordered_quantity + move.product_qty, |
744 | @@ -4982,10 +4982,10 @@ | |||
745 | 4982 | _columns = {'from_pack': fields.integer(string='From p.'), | 4982 | _columns = {'from_pack': fields.integer(string='From p.'), |
746 | 4983 | 'to_pack': fields.integer(string='To p.'), | 4983 | 'to_pack': fields.integer(string='To p.'), |
747 | 4984 | 'pack_type': fields.many2one('pack.type', string='Pack Type'), | 4984 | 'pack_type': fields.many2one('pack.type', string='Pack Type'), |
752 | 4985 | 'length' : fields.float(digits=(16, 2), string='Length [cm]'), | 4985 | 'length': fields.float(digits=(16, 2), string='Length [cm]'), |
753 | 4986 | 'width' : fields.float(digits=(16, 2), string='Width [cm]'), | 4986 | 'width': fields.float(digits=(16, 2), string='Width [cm]'), |
754 | 4987 | 'height' : fields.float(digits=(16, 2), string='Height [cm]'), | 4987 | 'height': fields.float(digits=(16, 2), string='Height [cm]'), |
755 | 4988 | 'weight' : fields.float(digits=(16, 2), string='Weight p.p [kg]'), | 4988 | 'weight': fields.float(digits=(16, 2), string='Weight p.p [kg]'), |
756 | 4989 | # 'pack_family_id': fields.many2one('pack.family', string='Pack Family'), | 4989 | # 'pack_family_id': fields.many2one('pack.family', string='Pack Family'), |
757 | 4990 | 'initial_location': fields.many2one('stock.location', string='Initial Picking Location'), | 4990 | 'initial_location': fields.many2one('stock.location', string='Initial Picking Location'), |
758 | 4991 | # relation to the corresponding move from draft **picking** ticket object | 4991 | # relation to the corresponding move from draft **picking** ticket object |
759 | @@ -5015,7 +5015,7 @@ | |||
760 | 5015 | 'stock.move': (lambda obj, cr, uid, ids, c={}: ids, ['picking_id'], 10), | 5015 | 'stock.move': (lambda obj, cr, uid, ids, c={}: ids, ['picking_id'], 10), |
761 | 5016 | 'stock.picking': (_get_picking, ['shipment_id'], 10), | 5016 | 'stock.picking': (_get_picking, ['shipment_id'], 10), |
762 | 5017 | } | 5017 | } |
764 | 5018 | ), | 5018 | ), |
765 | 5019 | # Fields used for domain | 5019 | # Fields used for domain |
766 | 5020 | 'location_virtual_id': fields.many2one('stock.location', string='Virtual location'), | 5020 | 'location_virtual_id': fields.many2one('stock.location', string='Virtual location'), |
767 | 5021 | 'location_output_id': fields.many2one('stock.location', string='Output location'), | 5021 | 'location_output_id': fields.many2one('stock.location', string='Output location'), |
768 | @@ -5090,26 +5090,6 @@ | |||
769 | 5090 | signal = 'cancel_r' if resource else 'cancel' | 5090 | signal = 'cancel_r' if resource else 'cancel' |
770 | 5091 | wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.id, signal, cr) | 5091 | wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.id, signal, cr) |
771 | 5092 | 5092 | ||
772 | 5093 | not_done_moves = self.pool.get('stock.move').search(cr, uid, [ | ||
773 | 5094 | ('purchase_line_id', '=', move.purchase_line_id.id), | ||
774 | 5095 | ('state', 'not in', ['cancel', 'cancel_r', 'done']), | ||
775 | 5096 | ('picking_id.type', '=', 'in'), | ||
776 | 5097 | ], context=context) | ||
777 | 5098 | if (not not_done_moves) or all([x in ids for x in not_done_moves]): | ||
778 | 5099 | # all in lines processed or will be processed for this po line | ||
779 | 5100 | wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.id, 'done', cr) | ||
780 | 5101 | |||
781 | 5102 | if move.purchase_line_id.is_line_split and move.purchase_line_id.original_line_id: | ||
782 | 5103 | # check if the original PO line can be set to done | ||
783 | 5104 | not_done_moves = self.pool.get('stock.move').search(cr, uid, [ | ||
784 | 5105 | ('purchase_line_id', '=', move.purchase_line_id.original_line_id.id), | ||
785 | 5106 | ('state', 'not in', ['cancel', 'cancel_r', 'done']), | ||
786 | 5107 | ('picking_id.type', '=', 'in'), | ||
787 | 5108 | ], context=context) | ||
788 | 5109 | if (not not_done_moves) or all([x in ids for x in not_done_moves]): | ||
789 | 5110 | # all in lines processed or will be processed for this po line | ||
790 | 5111 | wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.original_line_id.id, 'done', cr) | ||
791 | 5112 | |||
792 | 5113 | sol_ids = pol_obj.get_sol_ids_from_pol_ids(cr, uid, [move.purchase_line_id.id], context=context) | 5093 | sol_ids = pol_obj.get_sol_ids_from_pol_ids(cr, uid, [move.purchase_line_id.id], context=context) |
793 | 5114 | for sol in sol_obj.browse(cr, uid, sol_ids, context=context): | 5094 | for sol in sol_obj.browse(cr, uid, sol_ids, context=context): |
794 | 5115 | # If the line will be sourced in another way, do not cancel the OUT move | 5095 | # If the line will be sourced in another way, do not cancel the OUT move |
795 | @@ -5118,15 +5098,15 @@ | |||
796 | 5118 | continue | 5098 | continue |
797 | 5119 | 5099 | ||
798 | 5120 | diff_qty = uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, sol.product_uom.id) | 5100 | diff_qty = uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, sol.product_uom.id) |
801 | 5121 | if move.picking_id.partner_id2.partner_type not in ['internal','section','intermission']: | 5101 | if move.picking_id.partner_id2.partner_type not in ['internal', 'section', 'intermission']: |
802 | 5122 | sol_obj.update_or_cancel_line(cr, uid, sol.id, diff_qty, resource=resource,context=context) | 5102 | sol_obj.update_or_cancel_line(cr, uid, sol.id, diff_qty, resource=resource, context=context) |
803 | 5123 | # Cancel the remaining OUT line | 5103 | # Cancel the remaining OUT line |
804 | 5124 | if diff_qty < sol.product_uom_qty: | 5104 | if diff_qty < sol.product_uom_qty: |
805 | 5125 | data_back = self.create_data_back(move) | 5105 | data_back = self.create_data_back(move) |
806 | 5126 | out_move = self.get_mirror_move(cr, uid, [move.id], data_back, context=context)[move.id] | 5106 | out_move = self.get_mirror_move(cr, uid, [move.id], data_back, context=context)[move.id] |
807 | 5127 | out_move_id = False | 5107 | out_move_id = False |
808 | 5128 | if out_move['moves']: | 5108 | if out_move['moves']: |
810 | 5129 | out_move_id = sorted(out_move['moves'], key=lambda x: abs(x.product_qty-diff_qty))[0].id | 5109 | out_move_id = sorted(out_move['moves'], key=lambda x: abs(x.product_qty - diff_qty))[0].id |
811 | 5130 | elif out_move['move_id']: | 5110 | elif out_move['move_id']: |
812 | 5131 | out_move_id = out_move['move_id'] | 5111 | out_move_id = out_move['move_id'] |
813 | 5132 | 5112 | ||
814 | @@ -5134,6 +5114,26 @@ | |||
815 | 5134 | context.setdefault('not_resource_move', []).append(out_move_id) | 5114 | context.setdefault('not_resource_move', []).append(out_move_id) |
816 | 5135 | self.action_cancel(cr, uid, [out_move_id], context=context) | 5115 | self.action_cancel(cr, uid, [out_move_id], context=context) |
817 | 5136 | 5116 | ||
818 | 5117 | not_done_moves = self.pool.get('stock.move').search(cr, uid, [ | ||
819 | 5118 | ('purchase_line_id', '=', move.purchase_line_id.id), | ||
820 | 5119 | ('state', 'not in', ['cancel', 'cancel_r', 'done']), | ||
821 | 5120 | ('picking_id.type', '=', 'in'), | ||
822 | 5121 | ], context=context) | ||
823 | 5122 | if (not not_done_moves) or all([x in ids for x in not_done_moves]): | ||
824 | 5123 | # all in lines processed or will be processed for this po line | ||
825 | 5124 | wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.id, 'done', cr) | ||
826 | 5125 | |||
827 | 5126 | if move.purchase_line_id.is_line_split and move.purchase_line_id.original_line_id: | ||
828 | 5127 | # check if the original PO line can be set to done | ||
829 | 5128 | not_done_moves = self.pool.get('stock.move').search(cr, uid, [ | ||
830 | 5129 | ('purchase_line_id', '=', move.purchase_line_id.original_line_id.id), | ||
831 | 5130 | ('state', 'not in', ['cancel', 'cancel_r', 'done']), | ||
832 | 5131 | ('picking_id.type', '=', 'in'), | ||
833 | 5132 | ], context=context) | ||
834 | 5133 | if (not not_done_moves) or all([x in ids for x in not_done_moves]): | ||
835 | 5134 | # all in lines processed or will be processed for this po line | ||
836 | 5135 | wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.original_line_id.id, 'done', cr) | ||
837 | 5136 | |||
838 | 5137 | self.pool.get('purchase.order.line').update_fo_lines(cr, uid, [move.purchase_line_id.id], context=context) | 5137 | self.pool.get('purchase.order.line').update_fo_lines(cr, uid, [move.purchase_line_id.id], context=context) |
839 | 5138 | 5138 | ||
840 | 5139 | elif move.sale_line_id and (pick_type == 'internal' or (pick_type == 'out' and subtype_ok)): | 5139 | elif move.sale_line_id and (pick_type == 'internal' or (pick_type == 'out' and subtype_ok)): |
841 | @@ -5306,10 +5306,10 @@ | |||
842 | 5306 | 'from_pack': fields.integer(string='From p.'), | 5306 | 'from_pack': fields.integer(string='From p.'), |
843 | 5307 | 'to_pack': fields.integer(string='To p.'), | 5307 | 'to_pack': fields.integer(string='To p.'), |
844 | 5308 | 'pack_type': fields.many2one('pack.type', string='Pack Type'), | 5308 | 'pack_type': fields.many2one('pack.type', string='Pack Type'), |
849 | 5309 | 'length' : fields.float(digits=(16, 2), string='Length [cm]'), | 5309 | 'length': fields.float(digits=(16, 2), string='Length [cm]'), |
850 | 5310 | 'width' : fields.float(digits=(16, 2), string='Width [cm]'), | 5310 | 'width': fields.float(digits=(16, 2), string='Width [cm]'), |
851 | 5311 | 'height' : fields.float(digits=(16, 2), string='Height [cm]'), | 5311 | 'height': fields.float(digits=(16, 2), string='Height [cm]'), |
852 | 5312 | 'weight' : fields.float(digits=(16, 2), string='Weight p.p [kg]'), | 5312 | 'weight': fields.float(digits=(16, 2), string='Weight p.p [kg]'), |
853 | 5313 | # functions | 5313 | # functions |
854 | 5314 | 'move_lines': fields.function(_vals_get, method=True, type='one2many', relation='stock.move', string='Stock Moves', multi='get_vals',), | 5314 | 'move_lines': fields.function(_vals_get, method=True, type='one2many', relation='stock.move', string='Stock Moves', multi='get_vals',), |
855 | 5315 | 'fake_state': fields.function(_vals_get, method=True, type='char', String='Fake state', multi='get_vals'), | 5315 | 'fake_state': fields.function(_vals_get, method=True, type='char', String='Fake state', multi='get_vals'), |
856 | 5316 | 5316 | ||
857 | === modified file 'bin/addons/msf_outgoing/report/labels.rml' | |||
858 | --- bin/addons/msf_outgoing/report/labels.rml 2017-04-24 13:16:28 +0000 | |||
859 | +++ bin/addons/msf_outgoing/report/labels.rml 2018-02-12 10:19:50 +0000 | |||
860 | @@ -137,7 +137,7 @@ | |||
861 | 137 | <para style="P4">[[ stock_picking.ppl_customize_label.weight and translate('Weight:') or ' ' ]]</para> | 137 | <para style="P4">[[ stock_picking.ppl_customize_label.weight and translate('Weight:') or ' ' ]]</para> |
862 | 138 | </td> | 138 | </td> |
863 | 139 | <td> | 139 | <td> |
865 | 140 | <para style="P3">[[ stock_picking.ppl_customize_label.weight and str(pack_family.weight or '0.0') + ' kg' or ' ' ]]</para> | 140 | <para style="P3">[[ stock_picking.ppl_customize_label.weight and str(stock_picking.total_weight or '0.0') + ' kg' or ' ' ]]</para> |
866 | 141 | </td> | 141 | </td> |
867 | 142 | </tr> | 142 | </tr> |
868 | 143 | <tr> | 143 | <tr> |
869 | 144 | 144 | ||
870 | === modified file 'bin/addons/msf_profile/i18n/fr_MF.po' | |||
871 | --- bin/addons/msf_profile/i18n/fr_MF.po 2017-12-12 10:23:48 +0000 | |||
872 | +++ bin/addons/msf_profile/i18n/fr_MF.po 2018-02-12 10:19:50 +0000 | |||
873 | @@ -101136,3 +101136,22 @@ | |||
874 | 101136 | #, python-format | 101136 | #, python-format |
875 | 101137 | msgid "You must select at least one currency of transfers." | 101137 | msgid "You must select at least one currency of transfers." |
876 | 101138 | msgstr "Vous devez sélectionner au moins une devise de virement." | 101138 | msgstr "Vous devez sélectionner au moins une devise de virement." |
877 | 101139 | |||
878 | 101140 | #. module: account_corrections | ||
879 | 101141 | #: code:addons/account_corrections/account_move_line.py:567 | ||
880 | 101142 | #, python-format | ||
881 | 101143 | msgid "No OD-Extra Accounting Analytic Journal found!" | ||
882 | 101144 | msgstr "Aucun Journal Analytique de type OD-Extra Accounting n'a été trouvé !" | ||
883 | 101145 | |||
884 | 101146 | #. module: register_accounting | ||
885 | 101147 | #: code:addons/register_accounting/wizard/wizard_register_import.py:490 | ||
886 | 101148 | #, python-format | ||
887 | 101149 | msgid "Line %s. Third Party %s not found or not compatible with the Type for specific treatment of the account '%s - %s'." | ||
888 | 101150 | msgstr "Ligne %s. Tiers %s non trouvé ou non compatible avec le Type pour traitement spécifique du compte '%s - %s'." | ||
889 | 101151 | |||
890 | 101152 | #. modules: purchase, sale | ||
891 | 101153 | #: code:addons/purchase/purchase_workflow.py:413 | ||
892 | 101154 | #: code:addons/sale/sale_workflow.py:491 | ||
893 | 101155 | #, python-format | ||
894 | 101156 | msgid "You can't use taxes with an intermission partner." | ||
895 | 101157 | msgstr "Vous ne pouvez pas utiliser de taxes avec un partenaire intermission." | ||
896 | 101139 | 101158 | ||
897 | === modified file 'bin/addons/msf_supply_doc_export/wizard/po_follow_up.py' | |||
898 | --- bin/addons/msf_supply_doc_export/wizard/po_follow_up.py 2016-01-29 15:34:00 +0000 | |||
899 | +++ bin/addons/msf_supply_doc_export/wizard/po_follow_up.py 2018-02-12 10:19:50 +0000 | |||
900 | @@ -22,7 +22,7 @@ | |||
901 | 22 | from osv import osv | 22 | from osv import osv |
902 | 23 | from osv import fields | 23 | from osv import fields |
903 | 24 | from tools.translate import _ | 24 | from tools.translate import _ |
905 | 25 | from lxml import etree | 25 | from urllib import quote_plus |
906 | 26 | 26 | ||
907 | 27 | import time | 27 | import time |
908 | 28 | from datetime import datetime | 28 | from datetime import datetime |
909 | @@ -42,116 +42,116 @@ | |||
910 | 42 | _description = 'PO Follow up report wizard' | 42 | _description = 'PO Follow up report wizard' |
911 | 43 | 43 | ||
912 | 44 | _columns = { | 44 | _columns = { |
921 | 45 | 'po_id':fields.many2one('purchase.order',string="Order Reference", help="Unique number of the Purchase Order. Optional", required=False), | 45 | 'po_id': fields.many2one('purchase.order', string="Order Reference", help="Unique number of the Purchase Order. Optional", required=False), |
922 | 46 | 'state': fields.selection(PURCHASE_ORDER_STATE_SELECTION, 'State', help="The state of the purchase order. Optional", select=True, required=False), | 46 | 'state': fields.selection(PURCHASE_ORDER_STATE_SELECTION, 'State', help="The state of the purchase order. Optional", select=True, required=False), |
923 | 47 | 'po_date_from':fields.date("PO date from", required="False"), | 47 | 'po_date_from': fields.date("PO date from", required="False"), |
924 | 48 | 'po_date_thru':fields.date("PO date to", required="False"), | 48 | 'po_date_thru': fields.date("PO date to", required="False"), |
925 | 49 | 'partner_id':fields.many2one('res.partner', 'Supplier', required=False), | 49 | 'partner_id': fields.many2one('res.partner', 'Supplier', required=False), |
926 | 50 | 'project_ref':fields.char('Supplier reference', size=64, required=False), | 50 | 'project_ref': fields.char('Supplier reference', size=64, required=False), |
927 | 51 | 'export_format': fields.selection([('xls', 'Excel'), ('pdf', 'PDF')], string="Export format", required=True), | 51 | 'export_format': fields.selection([('xls', 'Excel'), ('pdf', 'PDF')], string="Export format", required=True), |
928 | 52 | 'background_time': fields.integer('Number of second before background processing'), | 52 | 'background_time': fields.integer('Number of second before background processing'), |
929 | 53 | } | 53 | } |
931 | 54 | 54 | ||
932 | 55 | _defaults = { | 55 | _defaults = { |
933 | 56 | 'export_format': lambda *a: 'xls', | 56 | 'export_format': lambda *a: 'xls', |
934 | 57 | 'background_time': lambda *a: 20, | 57 | 'background_time': lambda *a: 20, |
935 | 58 | } | 58 | } |
937 | 59 | 59 | ||
938 | 60 | def button_validate(self, cr, uid, ids, context=None): | 60 | def button_validate(self, cr, uid, ids, context=None): |
940 | 61 | wiz = self.browse(cr,uid,ids)[0] | 61 | wiz = self.browse(cr, uid, ids)[0] |
941 | 62 | 62 | ||
942 | 63 | domain = [('rfq_ok', '=', False)] | 63 | domain = [('rfq_ok', '=', False)] |
943 | 64 | states = {} | 64 | states = {} |
944 | 65 | for state_val, state_string in PURCHASE_ORDER_STATE_SELECTION: | 65 | for state_val, state_string in PURCHASE_ORDER_STATE_SELECTION: |
945 | 66 | states[state_val] = state_string | 66 | states[state_val] = state_string |
947 | 67 | report_parms = { | 67 | report_parms = { |
948 | 68 | 'title': 'PO Follow Up per Supplier', | 68 | 'title': 'PO Follow Up per Supplier', |
949 | 69 | 'run_date': time.strftime("%d/%m/%Y"), | 69 | 'run_date': time.strftime("%d/%m/%Y"), |
950 | 70 | 'date_from': '', | 70 | 'date_from': '', |
951 | 71 | 'date_thru': '', | 71 | 'date_thru': '', |
952 | 72 | 'state': '', | 72 | 'state': '', |
954 | 73 | 'supplier':'' | 73 | 'supplier': '' |
955 | 74 | } | 74 | } |
957 | 75 | 75 | ||
958 | 76 | # PO number | 76 | # PO number |
959 | 77 | if wiz.po_id: | 77 | if wiz.po_id: |
962 | 78 | domain.append(('id','=', wiz.po_id.id)) | 78 | domain.append(('id', '=', wiz.po_id.id)) |
963 | 79 | 79 | ||
964 | 80 | # Status | 80 | # Status |
965 | 81 | if wiz.state: | 81 | if wiz.state: |
967 | 82 | domain.append(('state','=', wiz.state)) | 82 | domain.append(('state', '=', wiz.state)) |
968 | 83 | report_parms['state'] = states[wiz.state] | 83 | report_parms['state'] = states[wiz.state] |
970 | 84 | 84 | ||
971 | 85 | # Dates | 85 | # Dates |
972 | 86 | if wiz.po_date_from: | 86 | if wiz.po_date_from: |
975 | 87 | domain.append(('date_order','>=',wiz.po_date_from)) | 87 | domain.append(('date_order', '>=', wiz.po_date_from)) |
976 | 88 | tmp = datetime.strptime(wiz.po_date_from,"%Y-%m-%d") | 88 | tmp = datetime.strptime(wiz.po_date_from, "%Y-%m-%d") |
977 | 89 | report_parms['date_from'] = tmp.strftime("%d/%m/%Y") | 89 | report_parms['date_from'] = tmp.strftime("%d/%m/%Y") |
978 | 90 | 90 | ||
979 | 91 | if wiz.po_date_thru: | 91 | if wiz.po_date_thru: |
982 | 92 | domain.append(('date_order','<=',wiz.po_date_thru)) | 92 | domain.append(('date_order', '<=', wiz.po_date_thru)) |
983 | 93 | tmp = datetime.strptime(wiz.po_date_thru,"%Y-%m-%d") | 93 | tmp = datetime.strptime(wiz.po_date_thru, "%Y-%m-%d") |
984 | 94 | report_parms['date_thru'] = tmp.strftime("%d/%m/%Y") | 94 | report_parms['date_thru'] = tmp.strftime("%d/%m/%Y") |
985 | 95 | 95 | ||
986 | 96 | # Supplier | 96 | # Supplier |
987 | 97 | if wiz.partner_id: | 97 | if wiz.partner_id: |
991 | 98 | domain.append(('partner_id','=', wiz.partner_id.id)) | 98 | domain.append(('partner_id', '=', wiz.partner_id.id)) |
992 | 99 | report_parms['supplier'] = wiz.partner_id.name | 99 | report_parms['supplier'] = quote_plus(wiz.partner_id.name) |
993 | 100 | 100 | ||
994 | 101 | # Supplier Reference | 101 | # Supplier Reference |
995 | 102 | if wiz.project_ref: | 102 | if wiz.project_ref: |
998 | 103 | domain.append(('project_ref','like',wiz.project_ref)) | 103 | domain.append(('project_ref', 'like', wiz.project_ref)) |
999 | 104 | 104 | ||
1000 | 105 | # get the PO ids based on the selected criteria | 105 | # get the PO ids based on the selected criteria |
1001 | 106 | po_obj = self.pool.get('purchase.order') | 106 | po_obj = self.pool.get('purchase.order') |
1002 | 107 | po_ids = po_obj.search(cr, uid, domain) | 107 | po_ids = po_obj.search(cr, uid, domain) |
1004 | 108 | 108 | ||
1005 | 109 | if not po_ids: | 109 | if not po_ids: |
1006 | 110 | raise osv.except_osv(_('Error'), _('No Purchase Orders match the specified criteria.')) | 110 | raise osv.except_osv(_('Error'), _('No Purchase Orders match the specified criteria.')) |
1007 | 111 | return True | 111 | return True |
1009 | 112 | 112 | ||
1010 | 113 | report_header = [] | 113 | report_header = [] |
1011 | 114 | report_header.append(report_parms['title']) | 114 | report_header.append(report_parms['title']) |
1013 | 115 | 115 | ||
1014 | 116 | report_header_line2 = '' | 116 | report_header_line2 = '' |
1015 | 117 | if wiz.partner_id: | 117 | if wiz.partner_id: |
1016 | 118 | report_header_line2 += wiz.partner_id.name | 118 | report_header_line2 += wiz.partner_id.name |
1018 | 119 | report_header_line2 += ' Report run date: ' + time.strftime("%d/%m/%Y") #TODO to be removed | 119 | report_header_line2 += ' Report run date: ' + time.strftime("%d/%m/%Y") # TODO to be removed |
1019 | 120 | if wiz.po_date_from: | 120 | if wiz.po_date_from: |
1020 | 121 | report_header_line2 += wiz.po_date_from | 121 | report_header_line2 += wiz.po_date_from |
1022 | 122 | #UF-2496: Minor fix to append the "date from" correctly into header | 122 | # UF-2496: Minor fix to append the "date from" correctly into header |
1023 | 123 | if wiz.po_date_thru: | 123 | if wiz.po_date_thru: |
1024 | 124 | if wiz.po_date_from: | 124 | if wiz.po_date_from: |
1025 | 125 | report_header_line2 += ' - ' | 125 | report_header_line2 += ' - ' |
1026 | 126 | report_header_line2 += wiz.po_date_thru | 126 | report_header_line2 += wiz.po_date_thru |
1030 | 127 | report_header.append(report_header_line2) | 127 | report_header.append(quote_plus(report_header_line2)) |
1031 | 128 | 128 | ||
1032 | 129 | datas = {'ids': po_ids, 'report_header': report_header, 'report_parms': report_parms} | 129 | datas = {'ids': po_ids, 'report_header': report_header, 'report_parms': report_parms} |
1033 | 130 | if wiz.export_format == 'xls': | 130 | if wiz.export_format == 'xls': |
1034 | 131 | report_name = 'po.follow.up_xls' | 131 | report_name = 'po.follow.up_xls' |
1035 | 132 | else: | 132 | else: |
1036 | 133 | report_name = 'po.follow.up_rml' | 133 | report_name = 'po.follow.up_rml' |
1038 | 134 | 134 | ||
1039 | 135 | if wiz.po_date_from: | 135 | if wiz.po_date_from: |
1042 | 136 | domain.append(('date_order','>=',wiz.po_date_from)) | 136 | domain.append(('date_order', '>=', wiz.po_date_from)) |
1043 | 137 | 137 | ||
1044 | 138 | background_id = self.pool.get('memory.background.report').create(cr, uid, {'file_name': report_name, 'report_name': report_name}, context=context) | 138 | background_id = self.pool.get('memory.background.report').create(cr, uid, {'file_name': report_name, 'report_name': report_name}, context=context) |
1045 | 139 | context['background_id'] = background_id | 139 | context['background_id'] = background_id |
1046 | 140 | context['background_time'] = wiz.background_time | 140 | context['background_time'] = wiz.background_time |
1054 | 141 | 141 | ||
1055 | 142 | return { | 142 | return { |
1056 | 143 | 'type': 'ir.actions.report.xml', | 143 | 'type': 'ir.actions.report.xml', |
1057 | 144 | 'report_name': report_name, | 144 | 'report_name': report_name, |
1058 | 145 | 'datas': datas, | 145 | 'datas': datas, |
1059 | 146 | 'nodestroy': True, | 146 | 'nodestroy': True, |
1060 | 147 | 'context': context, | 147 | 'context': context, |
1061 | 148 | } | 148 | } |
1063 | 149 | 149 | ||
1064 | 150 | po_follow_up() | 150 | po_follow_up() |
1065 | 151 | 151 | ||
1066 | 152 | 152 | ||
1067 | 153 | # already defined in account_mcdb/wizard/output_currency_for_export.py | 153 | # already defined in account_mcdb/wizard/output_currency_for_export.py |
1069 | 154 | #class background_report(osv.osv_memory): | 154 | # class background_report(osv.osv_memory): |
1070 | 155 | # _name = 'memory.background.report' | 155 | # _name = 'memory.background.report' |
1071 | 156 | # _description = 'Report result' | 156 | # _description = 'Report result' |
1072 | 157 | # | 157 | # |
1073 | @@ -164,4 +164,4 @@ | |||
1074 | 164 | # } | 164 | # } |
1075 | 165 | # def update_percent(self, cr, uid, ids, percent, context=None): | 165 | # def update_percent(self, cr, uid, ids, percent, context=None): |
1076 | 166 | # self.write(cr, uid, ids, {'percent': percent}) | 166 | # self.write(cr, uid, ids, {'percent': percent}) |
1078 | 167 | #background_report() | 167 | # background_report() |
1079 | 168 | 168 | ||
1080 | === modified file 'bin/addons/purchase/purchase_workflow.py' | |||
1081 | --- bin/addons/purchase/purchase_workflow.py 2017-12-14 17:30:55 +0000 | |||
1082 | +++ bin/addons/purchase/purchase_workflow.py 2018-02-12 10:19:50 +0000 | |||
1083 | @@ -49,7 +49,7 @@ | |||
1084 | 49 | ''' | 49 | ''' |
1085 | 50 | if context is None: | 50 | if context is None: |
1086 | 51 | context = {} | 51 | context = {} |
1088 | 52 | if isinstance(ids, (int,long)): | 52 | if isinstance(ids, (int, long)): |
1089 | 53 | ids = [ids] | 53 | ids = [ids] |
1090 | 54 | 54 | ||
1091 | 55 | for pol in self.browse(cr, uid, ids, context=context): | 55 | for pol in self.browse(cr, uid, ids, context=context): |
1092 | @@ -73,7 +73,7 @@ | |||
1093 | 73 | domain = [('purchase_line_id', '=', pol.id), ('type', '=', 'in'), ('state', '=', 'assigned')] | 73 | domain = [('purchase_line_id', '=', pol.id), ('type', '=', 'in'), ('state', '=', 'assigned')] |
1094 | 74 | linked_in_move = self.pool.get('stock.move').search(cr, uid, domain, context=context) | 74 | linked_in_move = self.pool.get('stock.move').search(cr, uid, domain, context=context) |
1095 | 75 | if linked_in_move: | 75 | if linked_in_move: |
1097 | 76 | self.pool.get('stock.move').action_cancel(cr, uid, linked_in_move, context=context) | 76 | self.pool.get('stock.move').action_cancel(cr, uid, linked_in_move, context=context) |
1098 | 77 | 77 | ||
1099 | 78 | return True | 78 | return True |
1100 | 79 | 79 | ||
1101 | @@ -84,7 +84,7 @@ | |||
1102 | 84 | ''' | 84 | ''' |
1103 | 85 | if context is None: | 85 | if context is None: |
1104 | 86 | context = {} | 86 | context = {} |
1106 | 87 | if isinstance(ids, (int,long)): | 87 | if isinstance(ids, (int, long)): |
1107 | 88 | ids = [ids] | 88 | ids = [ids] |
1108 | 89 | 89 | ||
1109 | 90 | for pol in self.browse(cr, uid, ids, fields_to_fetch=['price_unit'], context=context): | 90 | for pol in self.browse(cr, uid, ids, fields_to_fetch=['price_unit'], context=context): |
1110 | @@ -99,7 +99,7 @@ | |||
1111 | 99 | ''' | 99 | ''' |
1112 | 100 | if context is None: | 100 | if context is None: |
1113 | 101 | context = {} | 101 | context = {} |
1115 | 102 | if isinstance(ids, (int,long)): | 102 | if isinstance(ids, (int, long)): |
1116 | 103 | ids = [ids] | 103 | ids = [ids] |
1117 | 104 | 104 | ||
1118 | 105 | for pol in self.browse(cr, uid, ids, context=context): | 105 | for pol in self.browse(cr, uid, ids, context=context): |
1119 | @@ -117,7 +117,7 @@ | |||
1120 | 117 | ], context=context) | 117 | ], context=context) |
1121 | 118 | so_id = so_id and so_id[0] or False | 118 | so_id = so_id and so_id[0] or False |
1122 | 119 | if not so_id: | 119 | if not so_id: |
1124 | 120 | continue # no sale order linked to our PO line | 120 | continue # no sale order linked to our PO line |
1125 | 121 | sale_order = self.pool.get('sale.order').browse(cr, uid, so_id, context=context) | 121 | sale_order = self.pool.get('sale.order').browse(cr, uid, so_id, context=context) |
1126 | 122 | if sale_order.state == 'cancel' and sale_order.procurement_request: | 122 | if sale_order.state == 'cancel' and sale_order.procurement_request: |
1127 | 123 | to_trigger = True | 123 | to_trigger = True |
1128 | @@ -126,7 +126,7 @@ | |||
1129 | 126 | sale_order = pol.linked_sol_id.order_id | 126 | sale_order = pol.linked_sol_id.order_id |
1130 | 127 | else: | 127 | else: |
1131 | 128 | # case of PO line from scratch, nothing to update | 128 | # case of PO line from scratch, nothing to update |
1133 | 129 | continue | 129 | continue |
1134 | 130 | 130 | ||
1135 | 131 | # convert from currency of pol to currency of sol | 131 | # convert from currency of pol to currency of sol |
1136 | 132 | price_unit_converted = self.pool.get('res.currency').compute(cr, uid, pol.currency_id.id, sale_order.currency_id.id, pol.price_unit or 0.0, | 132 | price_unit_converted = self.pool.get('res.currency').compute(cr, uid, pol.currency_id.id, sale_order.currency_id.id, pol.price_unit or 0.0, |
1137 | @@ -204,14 +204,14 @@ | |||
1138 | 204 | # the right OUT move (moves are already splits at this level): | 204 | # the right OUT move (moves are already splits at this level): |
1139 | 205 | if sol_values['is_line_split']: | 205 | if sol_values['is_line_split']: |
1140 | 206 | linked_out_moves = self.pool.get('stock.move').search(cr, uid, [ | 206 | linked_out_moves = self.pool.get('stock.move').search(cr, uid, [ |
1143 | 207 | ('sale_line_id', '=', sol_values['original_line_id']), | 207 | ('sale_line_id', '=', sol_values['original_line_id']), |
1144 | 208 | ('type', '=', 'out')], | 208 | ('type', '=', 'out')], |
1145 | 209 | context=context) | 209 | context=context) |
1146 | 210 | if len(linked_out_moves) > 1: | 210 | if len(linked_out_moves) > 1: |
1147 | 211 | for out_move in self.pool.get('stock.move').browse(cr, uid, linked_out_moves, context=context): | 211 | for out_move in self.pool.get('stock.move').browse(cr, uid, linked_out_moves, context=context): |
1148 | 212 | if out_move.state in ('assigned', 'confirmed') and out_move.product_qty == sol_values['product_uom_qty']: | 212 | if out_move.state in ('assigned', 'confirmed') and out_move.product_qty == sol_values['product_uom_qty']: |
1149 | 213 | self.pool.get('stock.move').write(cr, uid, [out_move.id], {'sale_line_id': new_sol}, context=context) | 213 | self.pool.get('stock.move').write(cr, uid, [out_move.id], {'sale_line_id': new_sol}, context=context) |
1151 | 214 | else: # update FO line | 214 | else: # update FO line |
1152 | 215 | self.pool.get('sale.order.line').write(cr, uid, [pol.linked_sol_id.id], sol_values, context=context) | 215 | self.pool.get('sale.order.line').write(cr, uid, [pol.linked_sol_id.id], sol_values, context=context) |
1153 | 216 | 216 | ||
1154 | 217 | 217 | ||
1155 | @@ -226,7 +226,7 @@ | |||
1156 | 226 | ''' | 226 | ''' |
1157 | 227 | if context is None: | 227 | if context is None: |
1158 | 228 | context = {} | 228 | context = {} |
1160 | 229 | if isinstance(ids, (int,long)): | 229 | if isinstance(ids, (int, long)): |
1161 | 230 | ids = [ids] | 230 | ids = [ids] |
1162 | 231 | if not fo_id: | 231 | if not fo_id: |
1163 | 232 | raise Exception, "No parent Sale Order given for the new Sale Order line" | 232 | raise Exception, "No parent Sale Order given for the new Sale Order line" |
1164 | @@ -305,10 +305,10 @@ | |||
1165 | 305 | ''' | 305 | ''' |
1166 | 306 | if context is None: | 306 | if context is None: |
1167 | 307 | context = {} | 307 | context = {} |
1169 | 308 | if isinstance(ids, (int,long)): | 308 | if isinstance(ids, (int, long)): |
1170 | 309 | ids = [ids] | 309 | ids = [ids] |
1171 | 310 | if not ids: | 310 | if not ids: |
1173 | 311 | raise Exception , "No PO line given" | 311 | raise Exception, "No PO line given" |
1174 | 312 | 312 | ||
1175 | 313 | #Â load common data into context: | 313 | #Â load common data into context: |
1176 | 314 | self.pool.get('data.tools').load_common_data(cr, uid, ids, context=context) | 314 | self.pool.get('data.tools').load_common_data(cr, uid, ids, context=context) |
1177 | @@ -332,7 +332,7 @@ | |||
1178 | 332 | pick_id = self.pool.get('stock.picking').create(cr, uid, pick_values, context=context) | 332 | pick_id = self.pool.get('stock.picking').create(cr, uid, pick_values, context=context) |
1179 | 333 | 333 | ||
1180 | 334 | # log picking creation | 334 | # log picking creation |
1182 | 335 | self.pool.get('stock.picking').log(cr, uid, pick_id, _('The new internal Picking %s has been created.')%name) | 335 | self.pool.get('stock.picking').log(cr, uid, pick_id, _('The new internal Picking %s has been created.') % name) |
1183 | 336 | 336 | ||
1184 | 337 | return pick_id | 337 | return pick_id |
1185 | 338 | 338 | ||
1186 | @@ -343,7 +343,7 @@ | |||
1187 | 343 | ''' | 343 | ''' |
1188 | 344 | if context is None: | 344 | if context is None: |
1189 | 345 | context = {} | 345 | context = {} |
1191 | 346 | if isinstance(ids, (int,long)): | 346 | if isinstance(ids, (int, long)): |
1192 | 347 | ids = [ids] | 347 | ids = [ids] |
1193 | 348 | wf_service = netsvc.LocalService("workflow") | 348 | wf_service = netsvc.LocalService("workflow") |
1194 | 349 | 349 | ||
1195 | @@ -383,7 +383,7 @@ | |||
1196 | 383 | ''' | 383 | ''' |
1197 | 384 | if context is None: | 384 | if context is None: |
1198 | 385 | context = {} | 385 | context = {} |
1200 | 386 | if isinstance(ids, (int,long)): | 386 | if isinstance(ids, (int, long)): |
1201 | 387 | ids = [ids] | 387 | ids = [ids] |
1202 | 388 | self.write(cr, uid, ids, {'state': 'validated_n'}, context=context) | 388 | self.write(cr, uid, ids, {'state': 'validated_n'}, context=context) |
1203 | 389 | 389 | ||
1204 | @@ -400,6 +400,17 @@ | |||
1205 | 400 | 400 | ||
1206 | 401 | return True | 401 | return True |
1207 | 402 | 402 | ||
1208 | 403 | def check_po_tax(self, cr, uid, ids, context=None): | ||
1209 | 404 | """ | ||
1210 | 405 | Prevents from validating a PO with taxes when using an Intermission partner | ||
1211 | 406 | """ | ||
1212 | 407 | if context is None: | ||
1213 | 408 | context = {} | ||
1214 | 409 | if isinstance(ids, (int, long)): | ||
1215 | 410 | ids = [ids] | ||
1216 | 411 | for po_line in self.browse(cr, uid, ids, fields_to_fetch=['order_id', 'taxes_id'], context=context): | ||
1217 | 412 | if po_line.taxes_id and po_line.order_id.partner_type == 'intermission': | ||
1218 | 413 | raise osv.except_osv(_('Error'), _("You can't use taxes with an intermission partner.")) | ||
1219 | 403 | 414 | ||
1220 | 404 | def action_validate(self, cr, uid, ids, context=None): | 415 | def action_validate(self, cr, uid, ids, context=None): |
1221 | 405 | ''' | 416 | ''' |
1222 | @@ -407,7 +418,7 @@ | |||
1223 | 407 | ''' | 418 | ''' |
1224 | 408 | if context is None: | 419 | if context is None: |
1225 | 409 | context = {} | 420 | context = {} |
1227 | 410 | if isinstance(ids, (int,long)): | 421 | if isinstance(ids, (int, long)): |
1228 | 411 | ids = [ids] | 422 | ids = [ids] |
1229 | 412 | wf_service = netsvc.LocalService("workflow") | 423 | wf_service = netsvc.LocalService("workflow") |
1230 | 413 | 424 | ||
1231 | @@ -415,6 +426,7 @@ | |||
1232 | 415 | self.check_analytic_distribution(cr, uid, ids, context=context) | 426 | self.check_analytic_distribution(cr, uid, ids, context=context) |
1233 | 416 | self.check_if_stock_take_date_with_esc_partner(cr, uid, ids, context=context) | 427 | self.check_if_stock_take_date_with_esc_partner(cr, uid, ids, context=context) |
1234 | 417 | self.check_unit_price(cr, uid, ids, context=context) | 428 | self.check_unit_price(cr, uid, ids, context=context) |
1235 | 429 | self.check_po_tax(cr, uid, ids, context=context) | ||
1236 | 418 | 430 | ||
1237 | 419 | # update FO lines: | 431 | # update FO lines: |
1238 | 420 | self.update_fo_lines(cr, uid, ids, context=context) | 432 | self.update_fo_lines(cr, uid, ids, context=context) |
1239 | @@ -451,7 +463,7 @@ | |||
1240 | 451 | ''' | 463 | ''' |
1241 | 452 | if context is None: | 464 | if context is None: |
1242 | 453 | context = {} | 465 | context = {} |
1244 | 454 | if isinstance(ids, (int,long)): | 466 | if isinstance(ids, (int, long)): |
1245 | 455 | ids = [ids] | 467 | ids = [ids] |
1246 | 456 | wf_service = netsvc.LocalService("workflow") | 468 | wf_service = netsvc.LocalService("workflow") |
1247 | 457 | 469 | ||
1248 | @@ -472,13 +484,13 @@ | |||
1249 | 472 | ''' | 484 | ''' |
1250 | 473 | if context is None: | 485 | if context is None: |
1251 | 474 | context = {} | 486 | context = {} |
1253 | 475 | if isinstance(ids, (int,long)): | 487 | if isinstance(ids, (int, long)): |
1254 | 476 | ids = [ids] | 488 | ids = [ids] |
1255 | 477 | wf_service = netsvc.LocalService("workflow") | 489 | wf_service = netsvc.LocalService("workflow") |
1256 | 478 | 490 | ||
1257 | 479 | self.write(cr, uid, ids, {'state': 'sourced_v'}, context=context) | 491 | self.write(cr, uid, ids, {'state': 'sourced_v'}, context=context) |
1258 | 480 | 492 | ||
1260 | 481 | #update linked sol (same instance) to sourced-v (if has) | 493 | # update linked sol (same instance) to sourced-v (if has) |
1261 | 482 | for po in self.browse(cr, uid, ids, context=context): | 494 | for po in self.browse(cr, uid, ids, context=context): |
1262 | 483 | if po.linked_sol_id: | 495 | if po.linked_sol_id: |
1263 | 484 | wf_service.trg_validate(uid, 'sale.order.line', po.linked_sol_id.id, 'sourced_v', cr) | 496 | wf_service.trg_validate(uid, 'sale.order.line', po.linked_sol_id.id, 'sourced_v', cr) |
1264 | @@ -492,7 +504,7 @@ | |||
1265 | 492 | ''' | 504 | ''' |
1266 | 493 | if context is None: | 505 | if context is None: |
1267 | 494 | context = {} | 506 | context = {} |
1269 | 495 | if isinstance(ids, (int,long)): | 507 | if isinstance(ids, (int, long)): |
1270 | 496 | ids = [ids] | 508 | ids = [ids] |
1271 | 497 | 509 | ||
1272 | 498 | self.write(cr, uid, ids, {'state': 'sourced_n'}, context=context) | 510 | self.write(cr, uid, ids, {'state': 'sourced_n'}, context=context) |
1273 | @@ -547,9 +559,9 @@ | |||
1274 | 547 | self.pool.get('stock.move').in_action_confirm(cr, uid, incoming_move_id, context) | 559 | self.pool.get('stock.move').in_action_confirm(cr, uid, incoming_move_id, context) |
1275 | 548 | 560 | ||
1276 | 549 | # create internal moves (INT): | 561 | # create internal moves (INT): |
1278 | 550 | if pol.order_id.location_id.input_ok and pol.product_id.type not in ('service_recep', 'consu'): | 562 | if pol.order_id.location_id.input_ok and pol.product_id.type not in ('service_recep', 'consu'): |
1279 | 551 | internal_pick = self.pool.get('stock.picking').search(cr, uid, [ | 563 | internal_pick = self.pool.get('stock.picking').search(cr, uid, [ |
1281 | 552 | ('type', '=', 'internal'), | 564 | ('type', '=', 'internal'), |
1282 | 553 | ('purchase_id', '=', pol.order_id.id), | 565 | ('purchase_id', '=', pol.order_id.id), |
1283 | 554 | ('state', 'not in', ['done', 'cancel']), | 566 | ('state', 'not in', ['done', 'cancel']), |
1284 | 555 | ], context=context) | 567 | ], context=context) |
1285 | @@ -604,7 +616,7 @@ | |||
1286 | 604 | ''' | 616 | ''' |
1287 | 605 | if context is None: | 617 | if context is None: |
1288 | 606 | context = {} | 618 | context = {} |
1290 | 607 | if isinstance(ids, (int,long)): | 619 | if isinstance(ids, (int, long)): |
1291 | 608 | ids = [ids] | 620 | ids = [ids] |
1292 | 609 | wf_service = netsvc.LocalService("workflow") | 621 | wf_service = netsvc.LocalService("workflow") |
1293 | 610 | 622 | ||
1294 | @@ -613,8 +625,8 @@ | |||
1295 | 613 | 625 | ||
1296 | 614 | for pol in self.browse(cr, uid, ids, context=context): | 626 | for pol in self.browse(cr, uid, ids, context=context): |
1297 | 615 | # no PICK/OUT needed in this cases; close SO line: | 627 | # no PICK/OUT needed in this cases; close SO line: |
1300 | 616 | internal_ir = pol.linked_sol_id and pol.linked_sol_id.order_id.procurement_request and pol.linked_sol_id.order_id.location_requestor_id.usage == 'internal' or False # PO line from Internal IR | 628 | internal_ir = pol.linked_sol_id and pol.linked_sol_id.order_id.procurement_request and pol.linked_sol_id.order_id.location_requestor_id.usage == 'internal' or False # PO line from Internal IR |
1301 | 617 | dpo = pol.order_id.order_type == 'direct' or False # direct PO | 629 | dpo = pol.order_id.order_type == 'direct' or False # direct PO |
1302 | 618 | ir_non_stockable = pol.linked_sol_id and pol.linked_sol_id.order_id.procurement_request and pol.linked_sol_id.product_id.type in ('consu', 'service', 'service_recep') or False | 630 | ir_non_stockable = pol.linked_sol_id and pol.linked_sol_id.order_id.procurement_request and pol.linked_sol_id.product_id.type in ('consu', 'service', 'service_recep') or False |
1303 | 619 | 631 | ||
1304 | 620 | if internal_ir or dpo or ir_non_stockable: | 632 | if internal_ir or dpo or ir_non_stockable: |
1305 | @@ -700,7 +712,7 @@ | |||
1306 | 700 | """ | 712 | """ |
1307 | 701 | if context is None: | 713 | if context is None: |
1308 | 702 | context = {} | 714 | context = {} |
1310 | 703 | if isinstance(ids, (int,long)): | 715 | if isinstance(ids, (int, long)): |
1311 | 704 | ids = [ids] | 716 | ids = [ids] |
1312 | 705 | 717 | ||
1313 | 706 | for po in self.browse(cr, uid, ids, context=context): | 718 | for po in self.browse(cr, uid, ids, context=context): |
1314 | @@ -715,7 +727,7 @@ | |||
1315 | 715 | ''' | 727 | ''' |
1316 | 716 | if context is None: | 728 | if context is None: |
1317 | 717 | context = {} | 729 | context = {} |
1319 | 718 | if isinstance(ids, (int,long)): | 730 | if isinstance(ids, (int, long)): |
1320 | 719 | ids = [ids] | 731 | ids = [ids] |
1321 | 720 | wf_service = netsvc.LocalService("workflow") | 732 | wf_service = netsvc.LocalService("workflow") |
1322 | 721 | 733 | ||
1323 | 722 | 734 | ||
1324 | === modified file 'bin/addons/register_accounting/report/fully_report_xls.mako' | |||
1325 | --- bin/addons/register_accounting/report/fully_report_xls.mako 2017-09-26 11:57:14 +0000 | |||
1326 | +++ bin/addons/register_accounting/report/fully_report_xls.mako 2018-02-12 10:19:50 +0000 | |||
1327 | @@ -904,8 +904,16 @@ | |||
1328 | 904 | <!-- Display analytic lines linked to this register line --> | 904 | <!-- Display analytic lines linked to this register line --> |
1329 | 905 | <% | 905 | <% |
1330 | 906 | a_lines = False | 906 | a_lines = False |
1331 | 907 | adv_return_aal = line.cash_return_move_line_id and line.cash_return_move_line_id.analytic_lines or [] | ||
1332 | 908 | adv_return_fp_lines = [] | ||
1333 | 909 | adv_return_free_lines = [] | ||
1334 | 910 | for adv_return_l in adv_return_aal: | ||
1335 | 911 | if adv_return_l.free_account: | ||
1336 | 912 | adv_return_free_lines.append(adv_return_l) | ||
1337 | 913 | else: | ||
1338 | 914 | adv_return_fp_lines.append(adv_return_l) | ||
1339 | 907 | if line.fp_analytic_lines and not line.invoice_id and not line.imported_invoice_line_ids: | 915 | if line.fp_analytic_lines and not line.invoice_id and not line.imported_invoice_line_ids: |
1341 | 908 | a_lines = line.cash_return_move_line_id and line.cash_return_move_line_id.analytic_lines or line.fp_analytic_lines | 916 | a_lines = adv_return_fp_lines or line.fp_analytic_lines |
1342 | 909 | %> | 917 | %> |
1343 | 910 | % if a_lines: | 918 | % if a_lines: |
1344 | 911 | % for ana_line in sorted(a_lines, key=lambda x: x.id): | 919 | % for ana_line in sorted(a_lines, key=lambda x: x.id): |
1345 | @@ -964,7 +972,7 @@ | |||
1346 | 964 | <% | 972 | <% |
1347 | 965 | a_lines = False | 973 | a_lines = False |
1348 | 966 | if line.free_analytic_lines and not line.invoice_id and not line.imported_invoice_line_ids: | 974 | if line.free_analytic_lines and not line.invoice_id and not line.imported_invoice_line_ids: |
1350 | 967 | a_lines = line.free_analytic_lines | 975 | a_lines = adv_return_free_lines or line.free_analytic_lines |
1351 | 968 | %> | 976 | %> |
1352 | 969 | % if a_lines: | 977 | % if a_lines: |
1353 | 970 | % for ana_line in sorted(a_lines, key=lambda x: x.id): | 978 | % for ana_line in sorted(a_lines, key=lambda x: x.id): |
1354 | 971 | 979 | ||
1355 | === modified file 'bin/addons/register_accounting/wizard/import_invoice_on_registers.py' | |||
1356 | --- bin/addons/register_accounting/wizard/import_invoice_on_registers.py 2017-06-06 09:58:17 +0000 | |||
1357 | +++ bin/addons/register_accounting/wizard/import_invoice_on_registers.py 2018-02-12 10:19:50 +0000 | |||
1358 | @@ -244,7 +244,8 @@ | |||
1359 | 244 | 244 | ||
1360 | 245 | # Create register line | 245 | # Create register line |
1361 | 246 | partial = False | 246 | partial = False |
1363 | 247 | if line.amount and line.amount_to_pay and line.amount < abs(line.amount_to_pay): | 247 | equal_amounts = abs(abs(line.amount) - abs(line.amount_to_pay)) <= 10**-3 |
1364 | 248 | if not equal_amounts and line.amount < abs(line.amount_to_pay): | ||
1365 | 248 | partial = ' - ' + _('partial pymt') | 249 | partial = ' - ' + _('partial pymt') |
1366 | 249 | ref = line.ref | 250 | ref = line.ref |
1367 | 250 | if not ref or ref == 'false': | 251 | if not ref or ref == 'false': |
1368 | 251 | 252 | ||
1369 | === modified file 'bin/addons/register_accounting/wizard/wizard_register_import.py' | |||
1370 | --- bin/addons/register_accounting/wizard/wizard_register_import.py 2017-04-19 13:19:37 +0000 | |||
1371 | +++ bin/addons/register_accounting/wizard/wizard_register_import.py 2018-02-12 10:19:50 +0000 | |||
1372 | @@ -61,9 +61,9 @@ | |||
1373 | 61 | if not context: | 61 | if not context: |
1374 | 62 | context = {} | 62 | context = {} |
1375 | 63 | view = super(wizard_register_import, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) | 63 | view = super(wizard_register_import, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu) |
1377 | 64 | if view_type=='form': | 64 | if view_type == 'form': |
1378 | 65 | form = etree.fromstring(view['arch']) | 65 | form = etree.fromstring(view['arch']) |
1380 | 66 | for el in [('document_date', 'Document Date'), ('posting_date', 'Posting Date'), ('cheque_number', 'Cheque Number'), ('description', 'Description'), ('reference', 'Reference'), ('account', 'Account'), ('third_party', 'Third Party'), ('amount_in', 'Amount In'), ('amount_out', 'Amount Out'), ('destination', 'Destination'), ('cost_center', 'Cost Centre'), ('funding_pool', 'Funding Pool'), ('proprietary_instance', "Proprietary instance's code"), ('journal', "Journal's code"), ('currency', "Currency's code"),('free1', "Free 1"),('free2', "Free 2")]: | 66 | for el in [('document_date', 'Document Date'), ('posting_date', 'Posting Date'), ('cheque_number', 'Cheque Number'), ('description', 'Description'), ('reference', 'Reference'), ('account', 'Account'), ('third_party', 'Third Party'), ('amount_in', 'Amount In'), ('amount_out', 'Amount Out'), ('destination', 'Destination'), ('cost_center', 'Cost Centre'), ('funding_pool', 'Funding Pool'), ('proprietary_instance', "Proprietary instance's code"), ('journal', "Journal's code"), ('currency', "Currency's code"), ('free1', "Free 1"), ('free2', "Free 2")]: |
1381 | 67 | fields = form.xpath('/form//th[@class="' + el[0] + '"]') | 67 | fields = form.xpath('/form//th[@class="' + el[0] + '"]') |
1382 | 68 | for field in fields: | 68 | for field in fields: |
1383 | 69 | field.text = _(el[1]) | 69 | field.text = _(el[1]) |
1384 | @@ -149,20 +149,20 @@ | |||
1385 | 149 | currency_id = l.get('currency_id', False) and l.get('currency_id')[0] or False | 149 | currency_id = l.get('currency_id', False) and l.get('currency_id')[0] or False |
1386 | 150 | account = account_obj.read(cr, uid, account_id, ['is_analytic_addicted']) | 150 | account = account_obj.read(cr, uid, account_id, ['is_analytic_addicted']) |
1387 | 151 | cheque_number = l.get('cheque_number') | 151 | cheque_number = l.get('cheque_number') |
1390 | 152 | free_1_id = l.get('free_1_id',False) and l.get('free_1_id')[0] or False | 152 | free_1_id = l.get('free_1_id', False) and l.get('free_1_id')[0] or False |
1391 | 153 | free_2_id = l.get('free_2_id',False) and l.get('free_2_id')[0] or False | 153 | free_2_id = l.get('free_2_id', False) and l.get('free_2_id')[0] or False |
1392 | 154 | 154 | ||
1393 | 155 | vals = { | 155 | vals = { |
1402 | 156 | 'name': l.get('description', ''), | 156 | 'name': l.get('description', ''), |
1403 | 157 | 'ref': l.get('ref', ''), | 157 | 'ref': l.get('ref', ''), |
1404 | 158 | 'document_date': l.get('document_date', False), | 158 | 'document_date': l.get('document_date', False), |
1405 | 159 | 'date': date, | 159 | 'date': date, |
1406 | 160 | 'account_id': account_id, | 160 | 'account_id': account_id, |
1407 | 161 | 'amount': l.get('debit', 0.0) - l.get('credit', 0.0), | 161 | 'amount': l.get('debit', 0.0) - l.get('credit', 0.0), |
1408 | 162 | 'partner_id': partner_id, | 162 | 'partner_id': partner_id, |
1409 | 163 | 'employee_id': employee_id, | 163 | 'employee_id': employee_id, |
1410 | 164 | 'transfer_journal_id': transfer_journal_id, | 164 | 'transfer_journal_id': transfer_journal_id, |
1412 | 165 | 'statement_id': register_id, | 165 | 'statement_id': register_id, |
1413 | 166 | } | 166 | } |
1414 | 167 | if cheque_number: | 167 | if cheque_number: |
1415 | 168 | vals['cheque_number'] = str(cheque_number) | 168 | vals['cheque_number'] = str(cheque_number) |
1416 | @@ -182,21 +182,21 @@ | |||
1417 | 182 | 'source_date': date, | 182 | 'source_date': date, |
1418 | 183 | 'destination_id': destination_id, | 183 | 'destination_id': destination_id, |
1419 | 184 | } | 184 | } |
1421 | 185 | common_vals.update({'analytic_id': cost_center_id,}) | 185 | common_vals.update({'analytic_id': cost_center_id, }) |
1422 | 186 | self.pool.get('cost.center.distribution.line').create(cr, uid, common_vals) | 186 | self.pool.get('cost.center.distribution.line').create(cr, uid, common_vals) |
1424 | 187 | common_vals.update({'analytic_id': funding_pool_id or msf_fp_id, 'cost_center_id': cost_center_id,}) | 187 | common_vals.update({'analytic_id': funding_pool_id or msf_fp_id, 'cost_center_id': cost_center_id, }) |
1425 | 188 | self.pool.get('funding.pool.distribution.line').create(cr, uid, common_vals) | 188 | self.pool.get('funding.pool.distribution.line').create(cr, uid, common_vals) |
1426 | 189 | 189 | ||
1427 | 190 | if free_1_id: | 190 | if free_1_id: |
1430 | 191 | common_vals.update({'analytic_id': free_1_id,}) | 191 | common_vals.update({'analytic_id': free_1_id, }) |
1431 | 192 | self.pool.get('free.1.distribution.line').create(cr,uid,common_vals) | 192 | self.pool.get('free.1.distribution.line').create(cr, uid, common_vals) |
1432 | 193 | 193 | ||
1433 | 194 | if free_2_id: | 194 | if free_2_id: |
1436 | 195 | common_vals.update({'analytic_id': free_2_id,}) | 195 | common_vals.update({'analytic_id': free_2_id, }) |
1437 | 196 | self.pool.get('free.2.distribution.line').create(cr,uid,common_vals) | 196 | self.pool.get('free.2.distribution.line').create(cr, uid, common_vals) |
1438 | 197 | 197 | ||
1439 | 198 | # Check analytic distribution. Use SKIP_WRITE_CHECK to not do anything else that writing analytic distribution field | 198 | # Check analytic distribution. Use SKIP_WRITE_CHECK to not do anything else that writing analytic distribution field |
1441 | 199 | absl_obj.write(cr, uid, [absl_id], {'analytic_distribution_id': distrib_id,}, context={'skip_write_check': True}) | 199 | absl_obj.write(cr, uid, [absl_id], {'analytic_distribution_id': distrib_id, }, context={'skip_write_check': True}) |
1442 | 200 | # Add this line to be check at the end of the process | 200 | # Add this line to be check at the end of the process |
1443 | 201 | to_check.append(absl_id) | 201 | to_check.append(absl_id) |
1444 | 202 | # Update wizard with current progression | 202 | # Update wizard with current progression |
1445 | @@ -212,7 +212,7 @@ | |||
1446 | 212 | to_delete.append(absl_data.get('id')) | 212 | to_delete.append(absl_data.get('id')) |
1447 | 213 | to_delete_distrib.append(absl_data.get('analytic_distribution_id', [False])[0]) | 213 | to_delete_distrib.append(absl_data.get('analytic_distribution_id', [False])[0]) |
1448 | 214 | # Delete analytic distribution field on register lines | 214 | # Delete analytic distribution field on register lines |
1450 | 215 | absl_obj.write(cr, uid, to_delete, {'analytic_distribution_id': False}, context={'skip_write_check': True}) # do not do anything else than changing analytic_distribution_id field content (thanks to SKIP_WRITE_CHECK) | 215 | absl_obj.write(cr, uid, to_delete, {'analytic_distribution_id': False}, context={'skip_write_check': True}) # do not do anything else than changing analytic_distribution_id field content (thanks to SKIP_WRITE_CHECK) |
1451 | 216 | # Delete analytic distribution | 216 | # Delete analytic distribution |
1452 | 217 | self.pool.get('analytic.distribution').unlink(cr, uid, to_delete_distrib, context) | 217 | self.pool.get('analytic.distribution').unlink(cr, uid, to_delete_distrib, context) |
1453 | 218 | return True | 218 | return True |
1454 | @@ -234,6 +234,9 @@ | |||
1455 | 234 | processed = 0 | 234 | processed = 0 |
1456 | 235 | errors = [] | 235 | errors = [] |
1457 | 236 | cheque_numbers = [] | 236 | cheque_numbers = [] |
1458 | 237 | employee_obj = self.pool.get('hr.employee') | ||
1459 | 238 | journal_obj = self.pool.get('account.journal') | ||
1460 | 239 | partner_obj = self.pool.get('res.partner') | ||
1461 | 237 | try: | 240 | try: |
1462 | 238 | msf_fp_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'analytic_distribution', 'analytic_account_msf_private_funds')[1] | 241 | msf_fp_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'analytic_distribution', 'analytic_account_msf_private_funds')[1] |
1463 | 239 | except ValueError: | 242 | except ValueError: |
1464 | @@ -270,22 +273,22 @@ | |||
1465 | 270 | # cols variable describe each column and its expected number | 273 | # cols variable describe each column and its expected number |
1466 | 271 | cols = { | 274 | cols = { |
1467 | 272 | 'document_date': 0, | 275 | 'document_date': 0, |
1469 | 273 | 'posting_date': 1, | 276 | 'posting_date': 1, |
1470 | 274 | 'cheque_number': 2, | 277 | 'cheque_number': 2, |
1482 | 275 | 'description': 3, | 278 | 'description': 3, |
1483 | 276 | 'reference': 4, | 279 | 'reference': 4, |
1484 | 277 | 'account': 5, | 280 | 'account': 5, |
1485 | 278 | 'third_party': 6, | 281 | 'third_party': 6, |
1486 | 279 | 'amount_in': 7, | 282 | 'amount_in': 7, |
1487 | 280 | 'amount_out': 8, | 283 | 'amount_out': 8, |
1488 | 281 | 'destination': 9, | 284 | 'destination': 9, |
1489 | 282 | 'cost_center': 10, | 285 | 'cost_center': 10, |
1490 | 283 | 'funding_pool': 11, | 286 | 'funding_pool': 11, |
1491 | 284 | 'free1': 12, | 287 | 'free1': 12, |
1492 | 285 | 'free2': 13, | 288 | 'free2': 13, |
1493 | 286 | } | 289 | } |
1494 | 287 | # Number of line to bypass in line's count | 290 | # Number of line to bypass in line's count |
1496 | 288 | base_num = 5 # because of Python that begins to 0. | 291 | base_num = 5 # because of Python that begins to 0. |
1497 | 289 | # Attempt to read 3 first lines | 292 | # Attempt to read 3 first lines |
1498 | 290 | first_line = self.pool.get('import.cell.data').get_line_values(cr, uid, ids, rows.next()) | 293 | first_line = self.pool.get('import.cell.data').get_line_values(cr, uid, ids, rows.next()) |
1499 | 291 | try: | 294 | try: |
1500 | @@ -296,7 +299,7 @@ | |||
1501 | 296 | try: | 299 | try: |
1502 | 297 | journal_code = second_line[1] | 300 | journal_code = second_line[1] |
1503 | 298 | except IndexError, e: | 301 | except IndexError, e: |
1505 | 299 | raise osv.except_osv(_('Warning'), _('No journal code found.')) | 302 | raise osv.except_osv(_('Warning'), _('No journal code found.')) |
1506 | 300 | third_line = self.pool.get('import.cell.data').get_line_values(cr, uid, ids, rows.next()) | 303 | third_line = self.pool.get('import.cell.data').get_line_values(cr, uid, ids, rows.next()) |
1507 | 301 | try: | 304 | try: |
1508 | 302 | currency_code = third_line[1] | 305 | currency_code = third_line[1] |
1509 | @@ -309,7 +312,7 @@ | |||
1510 | 309 | if isinstance(instance_ids, (int, long)): | 312 | if isinstance(instance_ids, (int, long)): |
1511 | 310 | instance_ids = [instance_ids] | 313 | instance_ids = [instance_ids] |
1512 | 311 | # Check second info: journal's code | 314 | # Check second info: journal's code |
1514 | 312 | journal_ids = self.pool.get('account.journal').search(cr, uid, [('code', '=', journal_code)]) | 315 | journal_ids = journal_obj.search(cr, uid, [('code', '=', journal_code)]) |
1515 | 313 | if not journal_ids or len(journal_ids) > 1: | 316 | if not journal_ids or len(journal_ids) > 1: |
1516 | 314 | raise osv.except_osv(_('Warning'), _('Journal %s not found.') % (journal_code or '',)) | 317 | raise osv.except_osv(_('Warning'), _('Journal %s not found.') % (journal_code or '',)) |
1517 | 315 | if isinstance(journal_ids, (int, long)): | 318 | if isinstance(journal_ids, (int, long)): |
1518 | @@ -346,7 +349,7 @@ | |||
1519 | 346 | # Check file's content | 349 | # Check file's content |
1520 | 347 | for num, r in enumerate(rows): | 350 | for num, r in enumerate(rows): |
1521 | 348 | # Update wizard | 351 | # Update wizard |
1523 | 349 | progression = ((float(num+1) * remaining) / float(nb_rows)) + 6 | 352 | progression = ((float(num + 1) * remaining) / float(nb_rows)) + 6 |
1524 | 350 | self.write(cr, uid, [wiz.id], {'message': _('Checking file…'), 'progression': progression}, context) | 353 | self.write(cr, uid, [wiz.id], {'message': _('Checking file…'), 'progression': progression}, context) |
1525 | 351 | # Prepare some values | 354 | # Prepare some values |
1526 | 352 | r_debit = 0 | 355 | r_debit = 0 |
1527 | @@ -446,42 +449,62 @@ | |||
1528 | 446 | if register_type == 'cheque': | 449 | if register_type == 'cheque': |
1529 | 447 | if r_cheque_number: | 450 | if r_cheque_number: |
1530 | 448 | if r_cheque_number in cheque_numbers: | 451 | if r_cheque_number in cheque_numbers: |
1532 | 449 | errors.append(_('Line %s. Cheque number %s is duplicated from another line') % (current_line_num,r_cheque_number,)) | 452 | errors.append(_('Line %s. Cheque number %s is duplicated from another line') % (current_line_num, r_cheque_number,)) |
1533 | 450 | absl = self.pool.get('account.bank.statement.line') | 453 | absl = self.pool.get('account.bank.statement.line') |
1535 | 451 | cheque_number_id = absl.search(cr, uid, [('cheque_number','=',r_cheque_number)],context=context) | 454 | cheque_number_id = absl.search(cr, uid, [('cheque_number', '=', r_cheque_number)], context=context) |
1536 | 452 | if cheque_number_id: | 455 | if cheque_number_id: |
1538 | 453 | errors.append(_('Line %s. Cheque number %s has already been entered into the system.') % (current_line_num,r_cheque_number,)) | 456 | errors.append(_('Line %s. Cheque number %s has already been entered into the system.') % (current_line_num, r_cheque_number,)) |
1539 | 454 | cheque_numbers.append(r_cheque_number) | 457 | cheque_numbers.append(r_cheque_number) |
1540 | 455 | else: | 458 | else: |
1541 | 456 | errors.append(_('Line %s. Cheque number is missing') % (current_line_num,)) | 459 | errors.append(_('Line %s. Cheque number is missing') % (current_line_num,)) |
1543 | 457 | # Check that Third party exists (if not empty) | 460 | |
1544 | 461 | # Check Account/Third Party compatibility regarding the Account "Type for specific treatment" | ||
1545 | 458 | partner_type = 'partner' | 462 | partner_type = 'partner' |
1553 | 459 | if line[cols['third_party']]: | 463 | tp_ids = [] |
1554 | 460 | if type_for_register == 'advance': | 464 | has_specific_type = type_for_register in ['advance', 'transfer', 'transfer_same', 'down_payment', 'payroll'] or False |
1555 | 461 | tp_ids = self.pool.get('hr.employee').search(cr, uid, [('name', '=', line[cols['third_party']])]) | 465 | if has_specific_type: |
1556 | 462 | partner_type = 'employee' | 466 | if line[cols['third_party']]: |
1557 | 463 | elif type_for_register in ['transfer', 'transfer_same']: | 467 | # Type Operational Advance ==> EMPLOYEE required |
1558 | 464 | tp_ids = self.pool.get('account.journal').search(cr, uid, [('code', '=', line[cols['third_party']])]) | 468 | if type_for_register == 'advance': |
1559 | 465 | if tp_ids: | 469 | tp_ids = employee_obj.search(cr, uid, [('name', '=', line[cols['third_party']])], context=context) |
1560 | 470 | partner_type = 'employee' | ||
1561 | 471 | # Type Internal transfer ==> JOURNAL required | ||
1562 | 472 | elif type_for_register in ['transfer', 'transfer_same']: | ||
1563 | 473 | tp_ids = journal_obj.search(cr, uid, [('code', '=', line[cols['third_party']])], context=context) | ||
1564 | 466 | partner_type = 'journal' | 474 | partner_type = 'journal' |
1578 | 467 | tp_journal = self.pool.get('account.journal').browse(cr, uid, tp_ids, context=context)[0] | 475 | if tp_ids: |
1579 | 468 | if type_for_register == 'transfer': | 476 | tp_journal = journal_obj.browse(cr, uid, tp_ids, fields_to_fetch=['currency'], context=context)[0] |
1580 | 469 | if tp_journal.currency.id == register_currency: | 477 | if type_for_register == 'transfer': |
1581 | 470 | errors.append(_('Line %s. A Transfer Journal must have a different currency than the register.') % (current_line_num,)) | 478 | if tp_journal.currency.id == register_currency: |
1582 | 471 | if type_for_register == 'transfer_same': | 479 | errors.append(_('Line %s. A Transfer Journal must have a different currency than the register.') % (current_line_num,)) |
1583 | 472 | if tp_journal.currency.id != register_currency: | 480 | continue |
1584 | 473 | errors.append(_('Line %s. A Transfer Same Journal must have the same currency as the register.') % (current_line_num,)) | 481 | if type_for_register == 'transfer_same': |
1585 | 474 | else: | 482 | if tp_journal.currency.id != register_currency: |
1586 | 475 | tp_ids = self.pool.get('res.partner').search(cr, uid, [('name', '=', line[cols['third_party']])]) | 483 | errors.append(_('Line %s. A Transfer Same Journal must have the same currency as the register.') % (current_line_num,)) |
1587 | 476 | partner_type = 'partner' | 484 | continue |
1588 | 477 | if not tp_ids: | 485 | # Type DP or payroll ==> PARTNER required |
1589 | 478 | # Search now if employee exists | 486 | elif type_for_register in ['down_payment', 'payroll']: |
1590 | 479 | tp_ids = self.pool.get('hr.employee').search(cr, uid, [('name', '=', line[cols['third_party']])]) | 487 | tp_ids = partner_obj.search(cr, uid, [('name', '=', line[cols['third_party']])], context=context) |
1591 | 488 | partner_type = 'partner' | ||
1592 | 489 | # Any type for Spec. Treatment listed above ==> EMPTY partner NOT allowed | ||
1593 | 490 | if not tp_ids: | ||
1594 | 491 | errors.append( | ||
1595 | 492 | _("Line %s. Third Party %s not found or not compatible with the Type for specific" | ||
1596 | 493 | " treatment of the account '%s - %s'.") % (current_line_num, line[cols['third_party']] or '', | ||
1597 | 494 | account['code'], account['name'],)) | ||
1598 | 495 | continue | ||
1599 | 496 | elif line[cols['third_party']]: | ||
1600 | 497 | # if the account has no specific type, search for a partner, then an employee | ||
1601 | 498 | # (the journal type is ignored in that case. If used it should trigger an error message) | ||
1602 | 499 | tp_ids = partner_obj.search(cr, uid, [('name', '=', line[cols['third_party']])], context=context) | ||
1603 | 500 | partner_type = 'partner' | ||
1604 | 501 | if not tp_ids: | ||
1605 | 502 | tp_ids = employee_obj.search(cr, uid, [('name', '=', line[cols['third_party']])], context=context) | ||
1606 | 480 | partner_type = 'employee' | 503 | partner_type = 'employee' |
1611 | 481 | # If really not, raise an error for this line | 504 | if not tp_ids: |
1612 | 482 | if not tp_ids: | 505 | errors.append(_('Line %s. Third party not found: %s') % (current_line_num, line[cols['third_party']],)) |
1613 | 483 | errors.append(_('Line %s. Third party not found: %s') % (current_line_num, line[cols['third_party']],)) | 506 | continue |
1614 | 484 | continue | 507 | if tp_ids: |
1615 | 485 | r_partner = tp_ids[0] | 508 | r_partner = tp_ids[0] |
1616 | 486 | 509 | ||
1617 | 487 | # US-672 TP compat with account | 510 | # US-672 TP compat with account |
1618 | @@ -569,7 +592,7 @@ | |||
1619 | 569 | # - Booking Currency | 592 | # - Booking Currency |
1620 | 570 | vals = { | 593 | vals = { |
1621 | 571 | 'description': r_description or '', | 594 | 'description': r_description or '', |
1623 | 572 | 'ref': line[4] or '', | 595 | 'ref': line[4] or '', |
1624 | 573 | 'account_id': r_account or False, | 596 | 'account_id': r_account or False, |
1625 | 574 | 'debit': r_debit or 0.0, | 597 | 'debit': r_debit or 0.0, |
1626 | 575 | 'credit': r_credit or 0.0, | 598 | 'credit': r_credit or 0.0, |
1627 | @@ -586,14 +609,14 @@ | |||
1628 | 586 | 'free_2_id': r_free2 or False, | 609 | 'free_2_id': r_free2 or False, |
1629 | 587 | } | 610 | } |
1630 | 588 | if type_for_register == 'advance': | 611 | if type_for_register == 'advance': |
1632 | 589 | vals.update({'employee_id': r_partner,}) | 612 | vals.update({'employee_id': r_partner, }) |
1633 | 590 | elif type_for_register in ['transfer', 'transfer_same']: | 613 | elif type_for_register in ['transfer', 'transfer_same']: |
1634 | 591 | vals.update({'transfer_journal_id': r_partner}) | 614 | vals.update({'transfer_journal_id': r_partner}) |
1635 | 592 | else: | 615 | else: |
1636 | 593 | if partner_type == 'partner': | 616 | if partner_type == 'partner': |
1638 | 594 | vals.update({'partner_id': r_partner,}) | 617 | vals.update({'partner_id': r_partner, }) |
1639 | 595 | elif partner_type == 'employee': | 618 | elif partner_type == 'employee': |
1641 | 596 | vals.update({'employee_id': r_partner,}) | 619 | vals.update({'employee_id': r_partner, }) |
1642 | 597 | line_res = self.pool.get('wizard.register.import.lines').create(cr, uid, vals, context) | 620 | line_res = self.pool.get('wizard.register.import.lines').create(cr, uid, vals, context) |
1643 | 598 | if not line_res: | 621 | if not line_res: |
1644 | 599 | errors.append(_('Line %s. A problem occurred for line registration. Please contact an Administrator.') % (current_line_num,)) | 622 | errors.append(_('Line %s. A problem occurred for line registration. Please contact an Administrator.') % (current_line_num,)) |
1645 | @@ -612,7 +635,7 @@ | |||
1646 | 612 | # Delete old errors | 635 | # Delete old errors |
1647 | 613 | error_ids = self.pool.get('wizard.register.import.errors').search(cr, uid, [], context) | 636 | error_ids = self.pool.get('wizard.register.import.errors').search(cr, uid, [], context) |
1648 | 614 | if error_ids: | 637 | if error_ids: |
1650 | 615 | self.pool.get('wizard.register.import.errors').unlink(cr, uid, error_ids ,context) | 638 | self.pool.get('wizard.register.import.errors').unlink(cr, uid, error_ids, context) |
1651 | 616 | # create errors lines | 639 | # create errors lines |
1652 | 617 | for e in errors: | 640 | for e in errors: |
1653 | 618 | self.pool.get('wizard.register.import.errors').create(cr, uid, {'wizard_id': wiz.id, 'name': e}, context) | 641 | self.pool.get('wizard.register.import.errors').create(cr, uid, {'wizard_id': wiz.id, 'name': e}, context) |
1654 | 619 | 642 | ||
1655 | === modified file 'bin/addons/sale/sale_workflow.py' | |||
1656 | --- bin/addons/sale/sale_workflow.py 2018-01-08 13:50:26 +0000 | |||
1657 | +++ bin/addons/sale/sale_workflow.py 2018-02-12 10:19:50 +0000 | |||
1658 | @@ -52,7 +52,7 @@ | |||
1659 | 52 | o_ana_dist_id = so.analytic_distribution_id and so.analytic_distribution_id.id | 52 | o_ana_dist_id = so.analytic_distribution_id and so.analytic_distribution_id.id |
1660 | 53 | distrib_id = l_ana_dist_id or o_ana_dist_id or False | 53 | distrib_id = l_ana_dist_id or o_ana_dist_id or False |
1661 | 54 | 54 | ||
1663 | 55 | #US-830 : Remove the definition of a default AD for the inter-mission FO is no AD is defined | 55 | # US-830 : Remove the definition of a default AD for the inter-mission FO is no AD is defined |
1664 | 56 | if not distrib_id and not so.order_type in ('loan', 'donation_st', 'donation_exp'): | 56 | if not distrib_id and not so.order_type in ('loan', 'donation_st', 'donation_exp'): |
1665 | 57 | raise osv.except_osv( | 57 | raise osv.except_osv( |
1666 | 58 | _('Warning'), | 58 | _('Warning'), |
1667 | @@ -102,7 +102,7 @@ | |||
1668 | 102 | ''' | 102 | ''' |
1669 | 103 | if context is None: | 103 | if context is None: |
1670 | 104 | context = {} | 104 | context = {} |
1672 | 105 | if isinstance(ids, (int,long)): | 105 | if isinstance(ids, (int, long)): |
1673 | 106 | ids = [ids] | 106 | ids = [ids] |
1674 | 107 | 107 | ||
1675 | 108 | # for each line get a new copy: | 108 | # for each line get a new copy: |
1676 | @@ -122,7 +122,7 @@ | |||
1677 | 122 | ''' | 122 | ''' |
1678 | 123 | if context is None: | 123 | if context is None: |
1679 | 124 | context = {} | 124 | context = {} |
1681 | 125 | if isinstance(ids, (int,long)): | 125 | if isinstance(ids, (int, long)): |
1682 | 126 | ids = [ids] | 126 | ids = [ids] |
1683 | 127 | 127 | ||
1684 | 128 | for sol in self.browse(cr, uid, ids, context=context): | 128 | for sol in self.browse(cr, uid, ids, context=context): |
1685 | @@ -139,14 +139,14 @@ | |||
1686 | 139 | ''' | 139 | ''' |
1687 | 140 | if context is None: | 140 | if context is None: |
1688 | 141 | context = {} | 141 | context = {} |
1690 | 142 | if isinstance(ids, (int,long)): | 142 | if isinstance(ids, (int, long)): |
1691 | 143 | ids = [ids] | 143 | ids = [ids] |
1692 | 144 | wf_service = netsvc.LocalService("workflow") | 144 | wf_service = netsvc.LocalService("workflow") |
1693 | 145 | 145 | ||
1694 | 146 | new_sol_id = False | 146 | new_sol_id = False |
1695 | 147 | for sol in self.browse(cr, uid, ids, context=context): | 147 | for sol in self.browse(cr, uid, ids, context=context): |
1696 | 148 | new_sol_id = self.copy(cr, uid, sol.id, { | 148 | new_sol_id = self.copy(cr, uid, sol.id, { |
1698 | 149 | 'resourced_original_line': sol.id, | 149 | 'resourced_original_line': sol.id, |
1699 | 150 | 'resourced_original_remote_line': sol.sync_linked_pol, | 150 | 'resourced_original_remote_line': sol.sync_linked_pol, |
1700 | 151 | 'resourced_at_state': sol.state, | 151 | 'resourced_at_state': sol.state, |
1701 | 152 | 'is_line_split': False, | 152 | 'is_line_split': False, |
1702 | @@ -164,7 +164,7 @@ | |||
1703 | 164 | ''' | 164 | ''' |
1704 | 165 | if context is None: | 165 | if context is None: |
1705 | 166 | context = {} | 166 | context = {} |
1707 | 167 | if isinstance(ids, (int,long)): | 167 | if isinstance(ids, (int, long)): |
1708 | 168 | ids = [ids] | 168 | ids = [ids] |
1709 | 169 | 169 | ||
1710 | 170 | sol = self.browse(cr, uid, ids[0], context=context) | 170 | sol = self.browse(cr, uid, ids[0], context=context) |
1711 | @@ -189,7 +189,7 @@ | |||
1712 | 189 | ''' | 189 | ''' |
1713 | 190 | if context is None: | 190 | if context is None: |
1714 | 191 | context = {} | 191 | context = {} |
1716 | 192 | if isinstance(ids, (int,long)): | 192 | if isinstance(ids, (int, long)): |
1717 | 193 | ids = [ids] | 193 | ids = [ids] |
1718 | 194 | 194 | ||
1719 | 195 | self.write(cr, uid, ids, {'state': 'done'}, context=context) | 195 | self.write(cr, uid, ids, {'state': 'done'}, context=context) |
1720 | @@ -197,7 +197,7 @@ | |||
1721 | 197 | # generate sync message manually : | 197 | # generate sync message manually : |
1722 | 198 | return_info = {} | 198 | return_info = {} |
1723 | 199 | for sol_id in ids: | 199 | for sol_id in ids: |
1725 | 200 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, | 200 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, |
1726 | 201 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 201 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1727 | 202 | 202 | ||
1728 | 203 | return True | 203 | return True |
1729 | @@ -217,7 +217,7 @@ | |||
1730 | 217 | # generate sync message manually : | 217 | # generate sync message manually : |
1731 | 218 | return_info = {} | 218 | return_info = {} |
1732 | 219 | for sol_id in ids: | 219 | for sol_id in ids: |
1734 | 220 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, | 220 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, |
1735 | 221 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 221 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1736 | 222 | 222 | ||
1737 | 223 | return True | 223 | return True |
1738 | @@ -237,7 +237,7 @@ | |||
1739 | 237 | # generate sync message | 237 | # generate sync message |
1740 | 238 | return_info = {} | 238 | return_info = {} |
1741 | 239 | for sol_id in ids: | 239 | for sol_id in ids: |
1743 | 240 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, | 240 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, |
1744 | 241 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 241 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1745 | 242 | 242 | ||
1746 | 243 | return True | 243 | return True |
1747 | @@ -271,7 +271,7 @@ | |||
1748 | 271 | # generate sync message manually : | 271 | # generate sync message manually : |
1749 | 272 | return_info = {} | 272 | return_info = {} |
1750 | 273 | for sol_id in ids: | 273 | for sol_id in ids: |
1752 | 274 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, | 274 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, |
1753 | 275 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 275 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1754 | 276 | 276 | ||
1755 | 277 | return True | 277 | return True |
1756 | @@ -283,7 +283,7 @@ | |||
1757 | 283 | ''' | 283 | ''' |
1758 | 284 | if context is None: | 284 | if context is None: |
1759 | 285 | context = {} | 285 | context = {} |
1761 | 286 | if isinstance(ids, (int,long)): | 286 | if isinstance(ids, (int, long)): |
1762 | 287 | ids = [ids] | 287 | ids = [ids] |
1763 | 288 | 288 | ||
1764 | 289 | sol = self.browse(cr, uid, ids[0], context=context) | 289 | sol = self.browse(cr, uid, ids[0], context=context) |
1765 | @@ -314,7 +314,7 @@ | |||
1766 | 314 | ''' | 314 | ''' |
1767 | 315 | if context is None: | 315 | if context is None: |
1768 | 316 | context = {} | 316 | context = {} |
1770 | 317 | if isinstance(ids, (int,long)): | 317 | if isinstance(ids, (int, long)): |
1771 | 318 | ids = [ids] | 318 | ids = [ids] |
1772 | 319 | 319 | ||
1773 | 320 | pick_to_use = False | 320 | pick_to_use = False |
1774 | @@ -363,18 +363,20 @@ | |||
1775 | 363 | ''' | 363 | ''' |
1776 | 364 | if context is None: | 364 | if context is None: |
1777 | 365 | context = {} | 365 | context = {} |
1779 | 366 | if isinstance(ids, (int,long)): | 366 | if isinstance(ids, (int, long)): |
1780 | 367 | ids = [ids] | 367 | ids = [ids] |
1781 | 368 | 368 | ||
1782 | 369 | for sol in self.browse(cr, uid, ids, context=context): | 369 | for sol in self.browse(cr, uid, ids, context=context): |
1783 | 370 | out_moves_to_cancel = self.pool.get('stock.move').search(cr, uid, [ | 370 | out_moves_to_cancel = self.pool.get('stock.move').search(cr, uid, [ |
1785 | 371 | ('sale_line_id', '=', sol.id), | 371 | ('sale_line_id', '=', sol.id), |
1786 | 372 | ('type', '=', 'out'), | 372 | ('type', '=', 'out'), |
1787 | 373 | ('state', 'in', ['assigned', 'confirmed']), | 373 | ('state', 'in', ['assigned', 'confirmed']), |
1788 | 374 | ], context=context) | 374 | ], context=context) |
1789 | 375 | 375 | ||
1790 | 376 | if out_moves_to_cancel: | 376 | if out_moves_to_cancel: |
1791 | 377 | context.update({'not_resource_move': out_moves_to_cancel}) | ||
1792 | 377 | self.pool.get('stock.move').action_cancel(cr, uid, out_moves_to_cancel, context=context) | 378 | self.pool.get('stock.move').action_cancel(cr, uid, out_moves_to_cancel, context=context) |
1793 | 379 | context.pop('not_resource_move') | ||
1794 | 378 | 380 | ||
1795 | 379 | return True | 381 | return True |
1796 | 380 | 382 | ||
1797 | @@ -398,7 +400,7 @@ | |||
1798 | 398 | ('order_id.order_type', '=', 'direct'), | 400 | ('order_id.order_type', '=', 'direct'), |
1799 | 399 | ], context=context) | 401 | ], context=context) |
1800 | 400 | 402 | ||
1802 | 401 | if sol.order_id.procurement_request and sol.product_id.type in ('consu', 'service', 'service_recep'): # IR non stockable | 403 | if sol.order_id.procurement_request and sol.product_id.type in ('consu', 'service', 'service_recep'): # IR non stockable |
1803 | 402 | continue | 404 | continue |
1804 | 403 | 405 | ||
1805 | 404 | if linked_dpo_line: | 406 | if linked_dpo_line: |
1806 | @@ -439,7 +441,7 @@ | |||
1807 | 439 | # Change Currency ?? | 441 | # Change Currency ?? |
1808 | 440 | if sol.order_partner_id.partner_type in ('section', 'intermission'): | 442 | if sol.order_partner_id.partner_type in ('section', 'intermission'): |
1809 | 441 | picking = picking_obj.browse(cr, uid, pick_to_use, context=context) | 443 | picking = picking_obj.browse(cr, uid, pick_to_use, context=context) |
1811 | 442 | move = self.pool.get('stock.move').browse(cr ,uid, move_id, context=context) | 444 | move = self.pool.get('stock.move').browse(cr, uid, move_id, context=context) |
1812 | 443 | invoice_id, inv_type = picking_obj.action_invoice_create_header(cr, uid, picking, journal_id=False, invoices_group=False, type=False, use_draft=True, context=context) | 445 | invoice_id, inv_type = picking_obj.action_invoice_create_header(cr, uid, picking, journal_id=False, invoices_group=False, type=False, use_draft=True, context=context) |
1813 | 444 | if invoice_id: | 446 | if invoice_id: |
1814 | 445 | picking_obj.action_invoice_create_line(cr, uid, picking, move, invoice_id, group=False, inv_type=inv_type, partner=sol.order_id.partner_id, context=context) | 447 | picking_obj.action_invoice_create_line(cr, uid, picking, move, invoice_id, group=False, inv_type=inv_type, partner=sol.order_id.partner_id, context=context) |
1815 | @@ -460,24 +462,35 @@ | |||
1816 | 460 | self.pool.get('stock.move').action_confirm(cr, uid, [move_id], context=context) | 462 | self.pool.get('stock.move').action_confirm(cr, uid, [move_id], context=context) |
1817 | 461 | 463 | ||
1818 | 462 | # confirm the OUT if in draft state: | 464 | # confirm the OUT if in draft state: |
1820 | 463 | pick_state = self.pool.get('stock.picking').read(cr, uid, pick_to_use, ['state'] ,context=context)['state'] | 465 | pick_state = self.pool.get('stock.picking').read(cr, uid, pick_to_use, ['state'], context=context)['state'] |
1821 | 464 | if picking_data['type'] == 'out' and picking_data['subtype'] == 'standard' and pick_state == 'draft': | 466 | if picking_data['type'] == 'out' and picking_data['subtype'] == 'standard' and pick_state == 'draft': |
1822 | 465 | self.pool.get('stock.picking').draft_force_assign(cr, uid, [pick_to_use], context=context) | 467 | self.pool.get('stock.picking').draft_force_assign(cr, uid, [pick_to_use], context=context) |
1823 | 466 | # run check availability on PICK/OUT: | 468 | # run check availability on PICK/OUT: |
1824 | 467 | if picking_data['type'] == 'out' and picking_data['subtype'] in ['picking', 'standard']: | 469 | if picking_data['type'] == 'out' and picking_data['subtype'] in ['picking', 'standard']: |
1825 | 468 | self.pool.get('stock.picking').action_assign(cr, uid, [pick_to_use], context=context) | 470 | self.pool.get('stock.picking').action_assign(cr, uid, [pick_to_use], context=context) |
1826 | 469 | if picking_data['type'] == 'internal' and sol.type == 'make_to_stock' and sol.order_id.procurement_request: | 471 | if picking_data['type'] == 'internal' and sol.type == 'make_to_stock' and sol.order_id.procurement_request: |
1828 | 470 | wf_service.trg_validate(uid, 'stock.picking', pick_to_use, 'button_confirm', cr) | 472 | wf_service.trg_validate(uid, 'stock.picking', pick_to_use, 'button_confirm', cr) |
1829 | 471 | 473 | ||
1830 | 472 | self.write(cr, uid, ids, {'state': 'confirmed'}, context=context) | 474 | self.write(cr, uid, ids, {'state': 'confirmed'}, context=context) |
1831 | 473 | 475 | ||
1832 | 474 | # generate sync message: | 476 | # generate sync message: |
1833 | 475 | return_info = {} | 477 | return_info = {} |
1834 | 476 | for sol_id in ids: | 478 | for sol_id in ids: |
1836 | 477 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, | 479 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, |
1837 | 478 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 480 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1838 | 479 | return True | 481 | return True |
1839 | 480 | 482 | ||
1840 | 483 | def check_fo_tax(self, cr, uid, ids, context=None): | ||
1841 | 484 | """ | ||
1842 | 485 | Prevents from validating a FO with taxes when using an Intermission partner | ||
1843 | 486 | """ | ||
1844 | 487 | if context is None: | ||
1845 | 488 | context = {} | ||
1846 | 489 | if isinstance(ids, (int, long)): | ||
1847 | 490 | ids = [ids] | ||
1848 | 491 | for fo_line in self.browse(cr, uid, ids, fields_to_fetch=['order_id', 'tax_id'], context=context): | ||
1849 | 492 | if fo_line.tax_id and fo_line.order_id.partner_type == 'intermission': | ||
1850 | 493 | raise osv.except_osv(_('Error'), _("You can't use taxes with an intermission partner.")) | ||
1851 | 481 | 494 | ||
1852 | 482 | def action_validate(self, cr, uid, ids, context=None): | 495 | def action_validate(self, cr, uid, ids, context=None): |
1853 | 483 | ''' | 496 | ''' |
1854 | @@ -486,13 +499,15 @@ | |||
1855 | 486 | if context is None: | 499 | if context is None: |
1856 | 487 | context = {} | 500 | context = {} |
1857 | 488 | if isinstance(ids, (int, long)): | 501 | if isinstance(ids, (int, long)): |
1859 | 489 | ids = [ids] | 502 | ids = [ids] |
1860 | 503 | |||
1861 | 504 | self.check_fo_tax(cr, uid, ids, context=context) | ||
1862 | 490 | 505 | ||
1863 | 491 | for sol in self.browse(cr, uid, ids, context=context): | 506 | for sol in self.browse(cr, uid, ids, context=context): |
1864 | 492 | to_write = {} | 507 | to_write = {} |
1865 | 493 | if not sol.stock_take_date and sol.order_id.stock_take_date: | 508 | if not sol.stock_take_date and sol.order_id.stock_take_date: |
1866 | 494 | to_write['stock_take_date'] = sol.order_id.stock_take_date | 509 | to_write['stock_take_date'] = sol.order_id.stock_take_date |
1868 | 495 | if not sol.order_id.procurement_request: # in case of FO | 510 | if not sol.order_id.procurement_request: # in case of FO |
1869 | 496 | # check unit price: | 511 | # check unit price: |
1870 | 497 | if not sol.price_unit or sol.price_unit <= 0: | 512 | if not sol.price_unit or sol.price_unit <= 0: |
1871 | 498 | raise osv.except_osv( | 513 | raise osv.except_osv( |
1872 | @@ -522,13 +537,13 @@ | |||
1873 | 522 | # generate sync message: | 537 | # generate sync message: |
1874 | 523 | return_info = {} | 538 | return_info = {} |
1875 | 524 | for sol in self.browse(cr, uid, ids, context=context): | 539 | for sol in self.browse(cr, uid, ids, context=context): |
1877 | 525 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol.id, return_info, | 540 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol.id, return_info, |
1878 | 526 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 541 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1879 | 527 | 542 | ||
1880 | 528 | return True | 543 | return True |
1881 | 529 | 544 | ||
1882 | 530 | 545 | ||
1884 | 531 | def action_draft(self, cr ,uid, ids, context=None): | 546 | def action_draft(self, cr, uid, ids, context=None): |
1885 | 532 | ''' | 547 | ''' |
1886 | 533 | Workflow method called when trying to reset draft the sale.order.line | 548 | Workflow method called when trying to reset draft the sale.order.line |
1887 | 534 | ''' | 549 | ''' |
1888 | @@ -560,7 +575,7 @@ | |||
1889 | 560 | # generate sync message: | 575 | # generate sync message: |
1890 | 561 | return_info = {} | 576 | return_info = {} |
1891 | 562 | for sol_id in ids: | 577 | for sol_id in ids: |
1893 | 563 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, | 578 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, |
1894 | 564 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 579 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1895 | 565 | 580 | ||
1896 | 566 | return True | 581 | return True |
1897 | @@ -585,11 +600,11 @@ | |||
1898 | 585 | # generate sync message for original FO line: | 600 | # generate sync message for original FO line: |
1899 | 586 | return_info = {} | 601 | return_info = {} |
1900 | 587 | for sol_id in ids: | 602 | for sol_id in ids: |
1902 | 588 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, | 603 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', sol_id, return_info, |
1903 | 589 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 604 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1904 | 590 | 605 | ||
1905 | 591 | # generate sync message for resourced line: | 606 | # generate sync message for resourced line: |
1907 | 592 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', resourced_sol, return_info, | 607 | self.pool.get('sync.client.message_rule')._manual_create_sync_message(cr, uid, 'sale.order.line', resourced_sol, return_info, |
1908 | 593 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) | 608 | 'purchase.order.line.sol_update_original_pol', self._logger, check_identifier=False, context=context) |
1909 | 594 | 609 | ||
1910 | 595 | return True | 610 | return True |
1911 | 596 | 611 | ||
1912 | === modified file 'bin/addons/sync_so/purchase.py' | |||
1913 | --- bin/addons/sync_so/purchase.py 2017-12-13 14:46:52 +0000 | |||
1914 | +++ bin/addons/sync_so/purchase.py 2018-02-12 10:19:50 +0000 | |||
1915 | @@ -146,6 +146,7 @@ | |||
1916 | 146 | pol_updated = False | 146 | pol_updated = False |
1917 | 147 | if not pol_id: # then create new PO line | 147 | if not pol_id: # then create new PO line |
1918 | 148 | kind = 'new line' | 148 | kind = 'new line' |
1919 | 149 | pol_values['line_number'] = sol_dict['line_number'] | ||
1920 | 149 | if sol_dict['is_line_split']: | 150 | if sol_dict['is_line_split']: |
1921 | 150 | sync_linked_sol = int(sol_dict['original_line_id'].get('id').split('/')[-1]) if sol_dict['original_line_id'] else False | 151 | sync_linked_sol = int(sol_dict['original_line_id'].get('id').split('/')[-1]) if sol_dict['original_line_id'] else False |
1922 | 151 | if not sync_linked_sol: | 152 | if not sync_linked_sol: |
1923 | @@ -161,7 +162,6 @@ | |||
1924 | 161 | pol_values['origin'] = orig_pol_info.origin | 162 | pol_values['origin'] = orig_pol_info.origin |
1925 | 162 | if sol_dict['in_name_goods_return'] and not sol_dict['is_line_split']: | 163 | if sol_dict['in_name_goods_return'] and not sol_dict['is_line_split']: |
1926 | 163 | # in case of FO from missing/replacement claim | 164 | # in case of FO from missing/replacement claim |
1927 | 164 | pol_values['line_number'] = sol_dict['line_number'] | ||
1928 | 165 | pol_values['origin'] = self.pool.get('purchase.order').browse(cr, uid, po_ids[0], context=context).origin | 165 | pol_values['origin'] = self.pool.get('purchase.order').browse(cr, uid, po_ids[0], context=context).origin |
1929 | 166 | pol_values['from_synchro_return_goods'] = True | 166 | pol_values['from_synchro_return_goods'] = True |
1930 | 167 | # case of PO line doesn't exists, so created in FO (COO) and pushed back in PO (PROJ) | 167 | # case of PO line doesn't exists, so created in FO (COO) and pushed back in PO (PROJ) |
1931 | 168 | 168 | ||
1932 | === modified file 'bin/addons/tender_flow/tender_flow.py' | |||
1933 | --- bin/addons/tender_flow/tender_flow.py 2017-11-13 08:37:20 +0000 | |||
1934 | +++ bin/addons/tender_flow/tender_flow.py 2018-02-12 10:19:50 +0000 | |||
1935 | @@ -40,7 +40,7 @@ | |||
1936 | 40 | def copy(self, cr, uid, id, default=None, context=None, done_list=[], local=False): | 40 | def copy(self, cr, uid, id, default=None, context=None, done_list=[], local=False): |
1937 | 41 | if not default: | 41 | if not default: |
1938 | 42 | default = {} | 42 | default = {} |
1940 | 43 | default['internal_state'] = 'draft' # UF-733: Reset the internal_state | 43 | default['internal_state'] = 'draft' # UF-733: Reset the internal_state |
1941 | 44 | if not 'sale_order_id' in default: | 44 | if not 'sale_order_id' in default: |
1942 | 45 | default['sale_order_id'] = False | 45 | default['sale_order_id'] = False |
1943 | 46 | return super(osv.osv, self).copy(cr, uid, id, default, context=context) | 46 | return super(osv.osv, self).copy(cr, uid, id, default, context=context) |
1944 | @@ -91,8 +91,8 @@ | |||
1945 | 91 | res = {} | 91 | res = {} |
1946 | 92 | for tender in self.browse(cr, uid, ids, context=context): | 92 | for tender in self.browse(cr, uid, ids, context=context): |
1947 | 93 | retour = False | 93 | retour = False |
1950 | 94 | ids_proc = self.pool.get('procurement.order').search(cr,uid,[('tender_id','=',tender.id)]) | 94 | ids_proc = self.pool.get('procurement.order').search(cr, uid, [('tender_id', '=', tender.id)]) |
1951 | 95 | ids_sol = self.pool.get('sale.order.line').search(cr,uid,[('procurement_id','in',ids_proc),('order_id.procurement_request','=',False)]) | 95 | ids_sol = self.pool.get('sale.order.line').search(cr, uid, [('procurement_id', 'in', ids_proc), ('order_id.procurement_request', '=', False)]) |
1952 | 96 | if ids_sol: | 96 | if ids_sol: |
1953 | 97 | retour = True | 97 | retour = True |
1954 | 98 | res[tender.id] = retour | 98 | res[tender.id] = retour |
1955 | @@ -100,22 +100,22 @@ | |||
1956 | 100 | 100 | ||
1957 | 101 | _columns = {'name': fields.char('Tender Reference', size=64, required=True, select=True, readonly=True), | 101 | _columns = {'name': fields.char('Tender Reference', size=64, required=True, select=True, readonly=True), |
1958 | 102 | 'sale_order_id': fields.many2one('sale.order', string="Sale Order", readonly=True), | 102 | 'sale_order_id': fields.many2one('sale.order', string="Sale Order", readonly=True), |
1960 | 103 | 'state': fields.selection([('draft', 'Draft'),('comparison', 'Comparison'), ('done', 'Closed'), ('cancel', 'Cancelled'),], string="State", readonly=True), | 103 | 'state': fields.selection([('draft', 'Draft'), ('comparison', 'Comparison'), ('done', 'Closed'), ('cancel', 'Cancelled'), ], string="State", readonly=True), |
1961 | 104 | 'supplier_ids': fields.many2many('res.partner', 'tender_supplier_rel', 'tender_id', 'supplier_id', string="Suppliers", domain="[('id', '!=', company_id)]", | 104 | 'supplier_ids': fields.many2many('res.partner', 'tender_supplier_rel', 'tender_id', 'supplier_id', string="Suppliers", domain="[('id', '!=', company_id)]", |
1966 | 105 | states={'draft':[('readonly',False)]}, readonly=True, | 105 | states={'draft': [('readonly', False)]}, readonly=True, |
1967 | 106 | context={'search_default_supplier': 1,}), | 106 | context={'search_default_supplier': 1, }), |
1968 | 107 | 'location_id': fields.many2one('stock.location', 'Location', required=True, states={'draft':[('readonly',False)]}, readonly=True, domain=[('usage', '=', 'internal')]), | 107 | 'location_id': fields.many2one('stock.location', 'Location', required=True, states={'draft': [('readonly', False)]}, readonly=True, domain=[('usage', '=', 'internal')]), |
1969 | 108 | 'company_id': fields.many2one('res.company','Company',required=True, states={'draft':[('readonly',False)]}, readonly=True), | 108 | 'company_id': fields.many2one('res.company', 'Company', required=True, states={'draft': [('readonly', False)]}, readonly=True), |
1970 | 109 | 'rfq_ids': fields.one2many('purchase.order', 'tender_id', string="RfQs", readonly=True), | 109 | 'rfq_ids': fields.one2many('purchase.order', 'tender_id', string="RfQs", readonly=True), |
1973 | 110 | 'priority': fields.selection(ORDER_PRIORITY, string='Tender Priority', states={'draft':[('readonly',False)],}, readonly=True,), | 110 | 'priority': fields.selection(ORDER_PRIORITY, string='Tender Priority', states={'draft': [('readonly', False)], }, readonly=True,), |
1974 | 111 | 'categ': fields.selection(ORDER_CATEGORY, string='Tender Category', required=True, states={'draft':[('readonly',False)],}, readonly=True), | 111 | 'categ': fields.selection(ORDER_CATEGORY, string='Tender Category', required=True, states={'draft': [('readonly', False)], }, readonly=True), |
1975 | 112 | 'creator': fields.many2one('res.users', string="Creator", readonly=True, required=True,), | 112 | 'creator': fields.many2one('res.users', string="Creator", readonly=True, required=True,), |
1980 | 113 | 'warehouse_id': fields.many2one('stock.warehouse', string="Warehouse", required=True, states={'draft':[('readonly',False)],}, readonly=True), | 113 | 'warehouse_id': fields.many2one('stock.warehouse', string="Warehouse", required=True, states={'draft': [('readonly', False)], }, readonly=True), |
1981 | 114 | 'creation_date': fields.date(string="Creation Date", readonly=True, states={'draft':[('readonly',False)]}), | 114 | 'creation_date': fields.date(string="Creation Date", readonly=True, states={'draft': [('readonly', False)]}), |
1982 | 115 | 'details': fields.char(size=30, string="Details", states={'draft':[('readonly',False)],}, readonly=True), | 115 | 'details': fields.char(size=30, string="Details", states={'draft': [('readonly', False)], }, readonly=True), |
1983 | 116 | 'requested_date': fields.date(string="Requested Date", required=True, states={'draft':[('readonly',False)],}, readonly=True), | 116 | 'requested_date': fields.date(string="Requested Date", required=True, states={'draft': [('readonly', False)], }, readonly=True), |
1984 | 117 | 'notes': fields.text('Notes'), | 117 | 'notes': fields.text('Notes'), |
1986 | 118 | 'internal_state': fields.selection([('draft', 'Draft'),('updated', 'Rfq Updated'), ], string="Internal State", readonly=True), | 118 | 'internal_state': fields.selection([('draft', 'Draft'), ('updated', 'Rfq Updated'), ], string="Internal State", readonly=True), |
1987 | 119 | 'rfq_name_list': fields.function(_vals_get, method=True, string='RfQs Ref', type='char', readonly=True, store=False, multi='get_vals',), | 119 | 'rfq_name_list': fields.function(_vals_get, method=True, string='RfQs Ref', type='char', readonly=True, store=False, multi='get_vals',), |
1988 | 120 | 'product_id': fields.related('tender_line_ids', 'product_id', type='many2one', relation='product.product', string='Product'), | 120 | 'product_id': fields.related('tender_line_ids', 'product_id', type='many2one', relation='product.product', string='Product'), |
1989 | 121 | 'delivery_address': fields.many2one('res.partner.address', string='Delivery address', required=True), | 121 | 'delivery_address': fields.many2one('res.partner.address', string='Delivery address', required=True), |
1990 | @@ -174,7 +174,7 @@ | |||
1991 | 174 | if not tender.tender_from_fo: | 174 | if not tender.tender_from_fo: |
1992 | 175 | return retour | 175 | return retour |
1993 | 176 | for sup in tender.supplier_ids: | 176 | for sup in tender.supplier_ids: |
1995 | 177 | if sup.partner_type == 'internal' : | 177 | if sup.partner_type == 'internal': |
1996 | 178 | retour = False | 178 | retour = False |
1997 | 179 | return retour | 179 | return retour |
1998 | 180 | 180 | ||
1999 | @@ -280,7 +280,7 @@ | |||
2000 | 280 | ''' | 280 | ''' |
2001 | 281 | on_change function for the warehouse | 281 | on_change function for the warehouse |
2002 | 282 | ''' | 282 | ''' |
2004 | 283 | result = {'value':{},} | 283 | result = {'value': {}, } |
2005 | 284 | if warehouse_id: | 284 | if warehouse_id: |
2006 | 285 | input_loc_id = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context=context).lot_input_id.id | 285 | input_loc_id = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context=context).lot_input_id.id |
2007 | 286 | result['value'].update(location_id=input_loc_id) | 286 | result['value'].update(location_id=input_loc_id) |
2008 | @@ -303,7 +303,7 @@ | |||
2009 | 303 | # check some supplier have been selected | 303 | # check some supplier have been selected |
2010 | 304 | if not tender.supplier_ids: | 304 | if not tender.supplier_ids: |
2011 | 305 | raise osv.except_osv(_('Warning !'), _('You must select at least one supplier!')) | 305 | raise osv.except_osv(_('Warning !'), _('You must select at least one supplier!')) |
2013 | 306 | #utp-315: check that the suppliers are not inactive (I use a SQL request because the inactive partner are ignored with the browse) | 306 | # utp-315: check that the suppliers are not inactive (I use a SQL request because the inactive partner are ignored with the browse) |
2014 | 307 | sql = """ | 307 | sql = """ |
2015 | 308 | select tsr.supplier_id, rp.name, rp.active | 308 | select tsr.supplier_id, rp.name, rp.active |
2016 | 309 | from tender_supplier_rel tsr | 309 | from tender_supplier_rel tsr |
2017 | @@ -325,7 +325,7 @@ | |||
2018 | 325 | # create a purchase order for each supplier | 325 | # create a purchase order for each supplier |
2019 | 326 | address_id = partner_obj.address_get(cr, uid, [supplier.id], ['default'])['default'] | 326 | address_id = partner_obj.address_get(cr, uid, [supplier.id], ['default'])['default'] |
2020 | 327 | if not address_id: | 327 | if not address_id: |
2022 | 328 | raise osv.except_osv(_('Warning !'), _('The supplier "%s" has no address defined!')%(supplier.name,)) | 328 | raise osv.except_osv(_('Warning !'), _('The supplier "%s" has no address defined!') % (supplier.name,)) |
2023 | 329 | pricelist_id = supplier.property_product_pricelist_purchase.id | 329 | pricelist_id = supplier.property_product_pricelist_purchase.id |
2024 | 330 | values = {'origin': tender.sale_order_id and tender.sale_order_id.name + ';' + tender.name or tender.name, | 330 | values = {'origin': tender.sale_order_id and tender.sale_order_id.name + ';' + tender.name or tender.name, |
2025 | 331 | 'rfq_ok': True, | 331 | 'rfq_ok': True, |
2026 | @@ -353,14 +353,14 @@ | |||
2027 | 353 | if line.qty <= 0.00: | 353 | if line.qty <= 0.00: |
2028 | 354 | raise osv.except_osv(_('Error !'), _('You cannot generate RfQs for an line with a null quantity.')) | 354 | raise osv.except_osv(_('Error !'), _('You cannot generate RfQs for an line with a null quantity.')) |
2029 | 355 | 355 | ||
2031 | 356 | if line.product_id.id == obj_data.get_object_reference(cr, uid,'msf_doc_import', 'product_tbd')[1]: | 356 | if line.product_id.id == obj_data.get_object_reference(cr, uid, 'msf_doc_import', 'product_tbd')[1]: |
2032 | 357 | raise osv.except_osv(_('Warning !'), _('You can\'t have "To Be Defined" for the product. Please select an existing product.')) | 357 | raise osv.except_osv(_('Warning !'), _('You can\'t have "To Be Defined" for the product. Please select an existing product.')) |
2033 | 358 | newdate = datetime.strptime(line.date_planned, '%Y-%m-%d') | 358 | newdate = datetime.strptime(line.date_planned, '%Y-%m-%d') |
2034 | 359 | values = {'name': line.product_id.partner_ref, | 359 | values = {'name': line.product_id.partner_ref, |
2035 | 360 | 'product_qty': line.qty, | 360 | 'product_qty': line.qty, |
2036 | 361 | 'product_id': line.product_id.id, | 361 | 'product_id': line.product_id.id, |
2037 | 362 | 'product_uom': line.product_uom.id, | 362 | 'product_uom': line.product_uom.id, |
2039 | 363 | 'price_unit': 0.0, # was price variable - uf-607 | 363 | 'price_unit': 0.0, # was price variable - uf-607 |
2040 | 364 | 'date_planned': newdate.strftime('%Y-%m-%d'), | 364 | 'date_planned': newdate.strftime('%Y-%m-%d'), |
2041 | 365 | 'notes': line.product_id.description_purchase, | 365 | 'notes': line.product_id.description_purchase, |
2042 | 366 | 'order_id': po_id, | 366 | 'order_id': po_id, |
2043 | @@ -369,7 +369,7 @@ | |||
2044 | 369 | } | 369 | } |
2045 | 370 | # create purchase order line | 370 | # create purchase order line |
2046 | 371 | pol_obj.create(cr, uid, values, context=context) | 371 | pol_obj.create(cr, uid, values, context=context) |
2048 | 372 | message = "Request for Quotation '%s' has been created."%po_obj.browse(cr, uid, po_id, context=context).name | 372 | message = "Request for Quotation '%s' has been created." % po_obj.browse(cr, uid, po_id, context=context).name |
2049 | 373 | # create the log message | 373 | # create the log message |
2050 | 374 | self.pool.get('res.log').create(cr, uid, | 374 | self.pool.get('res.log').create(cr, uid, |
2051 | 375 | {'name': message, | 375 | {'name': message, |
2052 | @@ -385,7 +385,7 @@ | |||
2053 | 385 | tender.name, | 385 | tender.name, |
2054 | 386 | )) | 386 | )) |
2055 | 387 | 387 | ||
2057 | 388 | self.write(cr, uid, ids, {'state':'comparison'}, context=context) | 388 | self.write(cr, uid, ids, {'state': 'comparison'}, context=context) |
2058 | 389 | return True | 389 | return True |
2059 | 390 | 390 | ||
2060 | 391 | 391 | ||
2061 | @@ -395,7 +395,7 @@ | |||
2062 | 395 | ''' | 395 | ''' |
2063 | 396 | if context is None: | 396 | if context is None: |
2064 | 397 | context = {} | 397 | context = {} |
2066 | 398 | if isinstance(ids, (int,long)): | 398 | if isinstance(ids, (int, long)): |
2067 | 399 | ids = [ids] | 399 | ids = [ids] |
2068 | 400 | 400 | ||
2069 | 401 | self.create_po(cr, uid, ids, context=context) | 401 | self.create_po(cr, uid, ids, context=context) |
2070 | @@ -420,12 +420,12 @@ | |||
2071 | 420 | # close linked RfQ: | 420 | # close linked RfQ: |
2072 | 421 | rfq_list = [] | 421 | rfq_list = [] |
2073 | 422 | for rfq in tender.rfq_ids: | 422 | for rfq in tender.rfq_ids: |
2075 | 423 | if rfq.rfq_state not in ('updated', 'cancel'): | 423 | if rfq.rfq_state not in ('updated', 'cancel'): |
2076 | 424 | rfq_list.append(rfq.id) | 424 | rfq_list.append(rfq.id) |
2077 | 425 | else: | 425 | else: |
2078 | 426 | self.pool.get('purchase.order').write(cr, uid, [rfq.id], {'rfq_state': 'done'}, context=context) | 426 | self.pool.get('purchase.order').write(cr, uid, [rfq.id], {'rfq_state': 'done'}, context=context) |
2079 | 427 | 427 | ||
2081 | 428 | self.write(cr, uid, [tender.id], {'state':'done'}, context=context) | 428 | self.write(cr, uid, [tender.id], {'state': 'done'}, context=context) |
2082 | 429 | self.infolog(cr, uid, "The tender id:%s (%s) has been closed" % ( | 429 | self.infolog(cr, uid, "The tender id:%s (%s) has been closed" % ( |
2083 | 430 | tender.id, | 430 | tender.id, |
2084 | 431 | tender.name, | 431 | tender.name, |
2085 | @@ -444,12 +444,12 @@ | |||
2086 | 444 | raise osv.except_osv(_('Error !'), _("Some RfQ are already Closed. Integrity failure.")) | 444 | raise osv.except_osv(_('Error !'), _("Some RfQ are already Closed. Integrity failure.")) |
2087 | 445 | # all rfqs must have been treated | 445 | # all rfqs must have been treated |
2088 | 446 | rfq_ids = po_obj.search(cr, uid, [('tender_id', '=', tender.id), | 446 | rfq_ids = po_obj.search(cr, uid, [('tender_id', '=', tender.id), |
2090 | 447 | ('rfq_state', 'in', ('draft', 'sent',)),], context=context) | 447 | ('rfq_state', 'in', ('draft', 'sent',)), ], context=context) |
2091 | 448 | if rfq_ids: | 448 | if rfq_ids: |
2092 | 449 | raise osv.except_osv(_('Warning !'), _("Generated RfQs must be Updated or Cancelled.")) | 449 | raise osv.except_osv(_('Warning !'), _("Generated RfQs must be Updated or Cancelled.")) |
2093 | 450 | # at least one rfq must be updated and not canceled | 450 | # at least one rfq must be updated and not canceled |
2094 | 451 | rfq_ids = po_obj.search(cr, uid, [('tender_id', '=', tender.id), | 451 | rfq_ids = po_obj.search(cr, uid, [('tender_id', '=', tender.id), |
2096 | 452 | ('rfq_state', 'in', ('updated',)),], context=context) | 452 | ('rfq_state', 'in', ('updated',)), ], context=context) |
2097 | 453 | if not rfq_ids: | 453 | if not rfq_ids: |
2098 | 454 | raise osv.except_osv(_('Warning !'), _("At least one RfQ must be in state Updated.")) | 454 | raise osv.except_osv(_('Warning !'), _("At least one RfQ must be in state Updated.")) |
2099 | 455 | 455 | ||
2100 | @@ -469,7 +469,7 @@ | |||
2101 | 469 | suppliers = {} | 469 | suppliers = {} |
2102 | 470 | for line in tender.tender_line_ids: | 470 | for line in tender.tender_line_ids: |
2103 | 471 | if line.product_id and line.supplier_id and line.line_state != 'cancel': | 471 | if line.product_id and line.supplier_id and line.line_state != 'cancel': |
2105 | 472 | suppliers.update({line.product_id.id:line.supplier_id.id,}) | 472 | suppliers.update({line.product_id.id: line.supplier_id.id, }) |
2106 | 473 | # rfq corresponding to this tender with done state (has been updated and not canceled) | 473 | # rfq corresponding to this tender with done state (has been updated and not canceled) |
2107 | 474 | # the list of rfq which will be compared | 474 | # the list of rfq which will be compared |
2108 | 475 | c = dict(context, active_ids=rfq_ids, tender_id=tender.id, end_wizard=False, suppliers=suppliers,) | 475 | c = dict(context, active_ids=rfq_ids, tender_id=tender.id, end_wizard=False, suppliers=suppliers,) |
2109 | @@ -503,7 +503,7 @@ | |||
2110 | 503 | # find the corresponding suppinfo with sequence -99 | 503 | # find the corresponding suppinfo with sequence -99 |
2111 | 504 | info_99_list = info_obj.search(cr, uid, [('product_id', '=', product.product_tmpl_id.id), | 504 | info_99_list = info_obj.search(cr, uid, [('product_id', '=', product.product_tmpl_id.id), |
2112 | 505 | ('name', '=', line.purchase_order_line_id.order_id.partner_id.id), | 505 | ('name', '=', line.purchase_order_line_id.order_id.partner_id.id), |
2114 | 506 | ('sequence', '=', -99),], context=context) | 506 | ('sequence', '=', -99), ], context=context) |
2115 | 507 | 507 | ||
2116 | 508 | if info_99_list: | 508 | if info_99_list: |
2117 | 509 | # we drop it | 509 | # we drop it |
2118 | @@ -513,12 +513,12 @@ | |||
2119 | 513 | values = {'name': line.supplier_id.id, | 513 | values = {'name': line.supplier_id.id, |
2120 | 514 | 'product_name': False, | 514 | 'product_name': False, |
2121 | 515 | 'product_code': False, | 515 | 'product_code': False, |
2123 | 516 | 'sequence' : -99, | 516 | 'sequence': -99, |
2124 | 517 | #'product_uom': line.product_uom.id, | 517 | #'product_uom': line.product_uom.id, |
2125 | 518 | #'min_qty': 0.0, | 518 | #'min_qty': 0.0, |
2126 | 519 | #'qty': function | 519 | #'qty': function |
2129 | 520 | 'product_id' : product.product_tmpl_id.id, | 520 | 'product_id': product.product_tmpl_id.id, |
2130 | 521 | 'delay' : int(line.supplier_id.default_delay), | 521 | 'delay': int(line.supplier_id.default_delay), |
2131 | 522 | #'pricelist_ids': created just after | 522 | #'pricelist_ids': created just after |
2132 | 523 | #'company_id': default value | 523 | #'company_id': default value |
2133 | 524 | } | 524 | } |
2134 | @@ -574,10 +574,13 @@ | |||
2135 | 574 | self.pool.get('purchase.order').log(cr, uid, po_to_use, 'The Purchase Order %s for supplier %s has been created.' % (po.name, po.partner_id.name)) | 574 | self.pool.get('purchase.order').log(cr, uid, po_to_use, 'The Purchase Order %s for supplier %s has been created.' % (po.name, po.partner_id.name)) |
2136 | 575 | self.pool.get('purchase.order').infolog(cr, uid, 'The Purchase order %s for supplier %s has been created.' % (po.name, po.partner_id.name)) | 575 | self.pool.get('purchase.order').infolog(cr, uid, 'The Purchase order %s for supplier %s has been created.' % (po.name, po.partner_id.name)) |
2137 | 576 | 576 | ||
2138 | 577 | anal_dist_to_copy = tender_line.sale_order_line_id and tender_line.sale_order_line_id.analytic_distribution_id.id or False | ||
2139 | 578 | |||
2140 | 577 | # attach new PO line: | 579 | # attach new PO line: |
2141 | 578 | pol_values = { | 580 | pol_values = { |
2142 | 579 | 'order_id': po_to_use, | 581 | 'order_id': po_to_use, |
2143 | 580 | 'linked_sol_id': tender_line.sale_order_line_id.id or False, | 582 | 'linked_sol_id': tender_line.sale_order_line_id.id or False, |
2144 | 583 | 'origin': tender_line.sale_order_line_id and tender_line.sale_order_line_id.order_id.name or False, | ||
2145 | 581 | 'name': tender_line.product_id.partner_ref, | 584 | 'name': tender_line.product_id.partner_ref, |
2146 | 582 | 'product_qty': tender_line.qty, | 585 | 'product_qty': tender_line.qty, |
2147 | 583 | 'product_id': tender_line.product_id.id, | 586 | 'product_id': tender_line.product_id.id, |
2148 | @@ -589,6 +592,8 @@ | |||
2149 | 589 | 'notes': tender_line.product_id.description_purchase, | 592 | 'notes': tender_line.product_id.description_purchase, |
2150 | 590 | 'comment': tender_line.comment, | 593 | 'comment': tender_line.comment, |
2151 | 591 | } | 594 | } |
2152 | 595 | if anal_dist_to_copy: | ||
2153 | 596 | pol_values['analytic_distribution_id'] = self.pool.get('analytic.distribution').copy(cr, uid, anal_dist_to_copy, {}, context=context) | ||
2154 | 592 | self.pool.get('purchase.order.line').create(cr, uid, pol_values, context=context) | 597 | self.pool.get('purchase.order.line').create(cr, uid, pol_values, context=context) |
2155 | 593 | 598 | ||
2156 | 594 | # when the po is generated, the tender is done - no more modification or comparison | 599 | # when the po is generated, the tender is done - no more modification or comparison |
2157 | @@ -769,9 +774,9 @@ | |||
2158 | 769 | ''' | 774 | ''' |
2159 | 770 | _name = 'tender.line' | 775 | _name = 'tender.line' |
2160 | 771 | _rec_name = 'product_id' | 776 | _rec_name = 'product_id' |
2162 | 772 | _description= 'Tender Line' | 777 | _description = 'Tender Line' |
2163 | 773 | 778 | ||
2165 | 774 | _SELECTION_TENDER_STATE = [('draft', 'Draft'),('comparison', 'Comparison'), ('done', 'Closed'),] | 779 | _SELECTION_TENDER_STATE = [('draft', 'Draft'), ('comparison', 'Comparison'), ('done', 'Closed'), ] |
2166 | 775 | 780 | ||
2167 | 776 | def on_product_change(self, cr, uid, id, product_id, uom_id, product_qty, categ, context=None): | 781 | def on_product_change(self, cr, uid, id, product_id, uom_id, product_qty, categ, context=None): |
2168 | 777 | ''' | 782 | ''' |
2169 | @@ -793,7 +798,7 @@ | |||
2170 | 793 | result['value']['text_error'] = False | 798 | result['value']['text_error'] = False |
2171 | 794 | result['value']['to_correct_ok'] = False | 799 | result['value']['to_correct_ok'] = False |
2172 | 795 | 800 | ||
2174 | 796 | res_qty = self.onchange_uom_qty(cr, uid, id, uom_id or result.get('value', {}).get('product_uom',False), product_qty) | 801 | res_qty = self.onchange_uom_qty(cr, uid, id, uom_id or result.get('value', {}).get('product_uom', False), product_qty) |
2175 | 797 | result['value']['qty'] = res_qty.get('value', {}).get('qty', product_qty) | 802 | result['value']['qty'] = res_qty.get('value', {}).get('qty', product_qty) |
2176 | 798 | 803 | ||
2177 | 799 | if uom_id: | 804 | if uom_id: |
2178 | @@ -841,9 +846,9 @@ | |||
2179 | 841 | else: | 846 | else: |
2180 | 842 | result[line.id]['currency_id'] = result[line.id]['func_currency_id'] | 847 | result[line.id]['currency_id'] = result[line.id]['func_currency_id'] |
2181 | 843 | 848 | ||
2185 | 844 | result[line.id]['func_total_price'] = self.pool.get('res.currency').compute(cr, uid, result[line.id]['currency_id'], | 849 | result[line.id]['func_total_price'] = self.pool.get('res.currency').compute(cr, uid, result[line.id]['currency_id'], |
2186 | 845 | result[line.id]['func_currency_id'], | 850 | result[line.id]['func_currency_id'], |
2187 | 846 | result[line.id]['total_price'], | 851 | result[line.id]['total_price'], |
2188 | 847 | round=True, context=context) | 852 | round=True, context=context) |
2189 | 848 | 853 | ||
2190 | 849 | return result | 854 | return result |
2191 | @@ -865,7 +870,7 @@ | |||
2192 | 865 | 'date_planned': fields.related('tender_id', 'requested_date', type='date', string='Requested Date', store=False,), | 870 | 'date_planned': fields.related('tender_id', 'requested_date', type='date', string='Requested Date', store=False,), |
2193 | 866 | # functions | 871 | # functions |
2194 | 867 | 'supplier_id': fields.related('purchase_order_line_id', 'order_id', 'partner_id', type='many2one', relation='res.partner', string="Supplier", readonly=True), | 872 | 'supplier_id': fields.related('purchase_order_line_id', 'order_id', 'partner_id', type='many2one', relation='res.partner', string="Supplier", readonly=True), |
2196 | 868 | 'price_unit': fields.related('purchase_order_line_id', 'price_unit', type="float", string="Price unit", digits_compute=dp.get_precision('Purchase Price Computation'), readonly=True), # same precision as related field! | 873 | 'price_unit': fields.related('purchase_order_line_id', 'price_unit', type="float", string="Price unit", digits_compute=dp.get_precision('Purchase Price Computation'), readonly=True), # same precision as related field! |
2197 | 869 | 'delivery_confirmed_date': fields.related('purchase_order_line_id', 'confirmed_delivery_date', type="date", string="Delivery Confirmed Date", readonly=True), | 874 | 'delivery_confirmed_date': fields.related('purchase_order_line_id', 'confirmed_delivery_date', type="date", string="Delivery Confirmed Date", readonly=True), |
2198 | 870 | 'total_price': fields.function(_get_total_price, method=True, type='float', string="Total Price", digits_compute=dp.get_precision('Purchase Price'), multi='total'), | 875 | 'total_price': fields.function(_get_total_price, method=True, type='float', string="Total Price", digits_compute=dp.get_precision('Purchase Price'), multi='total'), |
2199 | 871 | 'currency_id': fields.function(_get_total_price, method=True, type='many2one', relation='res.currency', string='Cur.', multi='total'), | 876 | 'currency_id': fields.function(_get_total_price, method=True, type='many2one', relation='res.currency', string='Cur.', multi='total'), |
2200 | @@ -874,7 +879,7 @@ | |||
2201 | 874 | 'purchase_order_id': fields.related('purchase_order_line_id', 'order_id', type='many2one', relation='purchase.order', string="Related RfQ", readonly=True,), | 879 | 'purchase_order_id': fields.related('purchase_order_line_id', 'order_id', type='many2one', relation='purchase.order', string="Related RfQ", readonly=True,), |
2202 | 875 | 'purchase_order_line_number': fields.related('purchase_order_line_id', 'line_number', type="char", string="Related Line Number", readonly=True,), | 880 | 'purchase_order_line_number': fields.related('purchase_order_line_id', 'line_number', type="char", string="Related Line Number", readonly=True,), |
2203 | 876 | 'state': fields.related('tender_id', 'state', type="selection", selection=_SELECTION_TENDER_STATE, string="State",), | 881 | 'state': fields.related('tender_id', 'state', type="selection", selection=_SELECTION_TENDER_STATE, string="State",), |
2205 | 877 | 'line_state': fields.selection([('draft','Draft'), ('cancel', 'Canceled'), ('done', 'Done')], string='State', readonly=True), | 882 | 'line_state': fields.selection([('draft', 'Draft'), ('cancel', 'Canceled'), ('done', 'Done')], string='State', readonly=True), |
2206 | 878 | 'comment': fields.char(size=128, string='Comment'), | 883 | 'comment': fields.char(size=128, string='Comment'), |
2207 | 879 | 'has_to_be_resourced': fields.boolean(string='Has to be resourced'), | 884 | 'has_to_be_resourced': fields.boolean(string='Has to be resourced'), |
2208 | 880 | 'created_by_rfq': fields.boolean(string='Created by RfQ'), | 885 | 'created_by_rfq': fields.boolean(string='Created by RfQ'), |
2209 | @@ -940,7 +945,7 @@ | |||
2210 | 940 | 945 | ||
2211 | 941 | return super(tender_line, self).copy(cr, uid, id, default, context=context) | 946 | return super(tender_line, self).copy(cr, uid, id, default, context=context) |
2212 | 942 | 947 | ||
2214 | 943 | def cancel_sourcing(self,cr, uid, ids, context=None): | 948 | def cancel_sourcing(self, cr, uid, ids, context=None): |
2215 | 944 | ''' | 949 | ''' |
2216 | 945 | Cancel the line and re-source the FO line | 950 | Cancel the line and re-source the FO line |
2217 | 946 | ''' | 951 | ''' |
2218 | @@ -997,11 +1002,11 @@ | |||
2219 | 997 | del context['update_or_cancel_line_not_delete'] | 1002 | del context['update_or_cancel_line_not_delete'] |
2220 | 998 | 1003 | ||
2221 | 999 | # Update the FO state | 1004 | # Update the FO state |
2223 | 1000 | #for so in so_to_update: | 1005 | # for so in so_to_update: |
2224 | 1001 | # wf_service.trg_write(uid, 'sale.order', so, cr) | 1006 | # wf_service.trg_write(uid, 'sale.order', so, cr) |
2225 | 1002 | 1007 | ||
2226 | 1003 | # UF-733: if all tender lines have been compared (have PO Line id), then set the tender to be ready | 1008 | # UF-733: if all tender lines have been compared (have PO Line id), then set the tender to be ready |
2228 | 1004 | # for proceeding to other actions (create PO, Done etc) | 1009 | # for proceeding to other actions (create PO, Done etc) |
2229 | 1005 | for tender in tender_obj.browse(cr, uid, list(tender_to_update), context=context): | 1010 | for tender in tender_obj.browse(cr, uid, list(tender_to_update), context=context): |
2230 | 1006 | if tender.internal_state == 'draft': | 1011 | if tender.internal_state == 'draft': |
2231 | 1007 | flag = True | 1012 | flag = True |
2232 | @@ -1149,7 +1154,7 @@ | |||
2233 | 1149 | ''' | 1154 | ''' |
2234 | 1150 | if context is None: | 1155 | if context is None: |
2235 | 1151 | context = {} | 1156 | context = {} |
2237 | 1152 | if isinstance(ids, (int,long)): | 1157 | if isinstance(ids, (int, long)): |
2238 | 1153 | ids = [ids] | 1158 | ids = [ids] |
2239 | 1154 | 1159 | ||
2240 | 1155 | for tender_line in self.browse(cr, uid, ids, context=context): | 1160 | for tender_line in self.browse(cr, uid, ids, context=context): |
2241 | @@ -1164,7 +1169,7 @@ | |||
2242 | 1164 | 'origin': (tender.sale_order_id and tender.sale_order_id.name or "") + '; ' + tender.name, | 1169 | 'origin': (tender.sale_order_id and tender.sale_order_id.name or "") + '; ' + tender.name, |
2243 | 1165 | 'partner_id': tender_line.supplier_id.id, | 1170 | 'partner_id': tender_line.supplier_id.id, |
2244 | 1166 | 'partner_address_id': self.pool.get('res.partner').address_get(cr, uid, [tender_line.supplier_id.id], ['default'])['default'], | 1171 | 'partner_address_id': self.pool.get('res.partner').address_get(cr, uid, [tender_line.supplier_id.id], ['default'])['default'], |
2246 | 1167 | 'customer_id': tender_line.sale_order_line_id and tender_line.sale_order_line_id.order_id.partner_id.id or False, | 1172 | 'customer_id': tender_line.sale_order_line_id and tender_line.sale_order_line_id.order_id.partner_id.id or False, |
2247 | 1168 | 'location_id': tender.location_id.id, | 1173 | 'location_id': tender.location_id.id, |
2248 | 1169 | 'company_id': tender.company_id.id, | 1174 | 'company_id': tender.company_id.id, |
2249 | 1170 | 'cross_docking_ok': True if tender_line.sale_order_line_id else False, | 1175 | 'cross_docking_ok': True if tender_line.sale_order_line_id else False, |
2250 | @@ -1189,7 +1194,7 @@ | |||
2251 | 1189 | tender class | 1194 | tender class |
2252 | 1190 | ''' | 1195 | ''' |
2253 | 1191 | _inherit = 'tender' | 1196 | _inherit = 'tender' |
2255 | 1192 | _columns = {'tender_line_ids': fields.one2many('tender.line', 'tender_id', string="Tender lines", states={'draft':[('readonly',False)]}, readonly=True), | 1197 | _columns = {'tender_line_ids': fields.one2many('tender.line', 'tender_id', string="Tender lines", states={'draft': [('readonly', False)]}, readonly=True), |
2256 | 1193 | } | 1198 | } |
2257 | 1194 | 1199 | ||
2258 | 1195 | def copy(self, cr, uid, id, default=None, context=None): | 1200 | def copy(self, cr, uid, id, default=None, context=None): |
2259 | @@ -1252,16 +1257,16 @@ | |||
2260 | 1252 | 'rfq_id': fields.many2one('purchase.order', string='RfQ', readonly=True), | 1257 | 'rfq_id': fields.many2one('purchase.order', string='RfQ', readonly=True), |
2261 | 1253 | 'rfq_line_id': fields.many2one('purchase.order.line', string='RfQ line', readonly=True), | 1258 | 'rfq_line_id': fields.many2one('purchase.order.line', string='RfQ line', readonly=True), |
2262 | 1254 | 'is_rfq_done': fields.boolean(string="RfQ Closed"), | 1259 | 'is_rfq_done': fields.boolean(string="RfQ Closed"), |
2270 | 1255 | 'state': fields.selection([('draft','Draft'), | 1260 | 'state': fields.selection([('draft', 'Draft'), |
2271 | 1256 | ('confirmed','Confirmed'), | 1261 | ('confirmed', 'Confirmed'), |
2272 | 1257 | ('exception','Exception'), | 1262 | ('exception', 'Exception'), |
2273 | 1258 | ('running','Converted'), | 1263 | ('running', 'Converted'), |
2274 | 1259 | ('cancel','Cancelled'), | 1264 | ('cancel', 'Cancelled'), |
2275 | 1260 | ('ready','Ready'), | 1265 | ('ready', 'Ready'), |
2276 | 1261 | ('done','Closed'), | 1266 | ('done', 'Closed'), |
2277 | 1262 | ('tender', 'Tender'), | 1267 | ('tender', 'Tender'), |
2278 | 1263 | ('rfq', 'Request for Quotation'), | 1268 | ('rfq', 'Request for Quotation'), |
2280 | 1264 | ('waiting','Waiting'),], 'State', required=True, | 1269 | ('waiting', 'Waiting'), ], 'State', required=True, |
2281 | 1265 | help='When a procurement is created the state is set to \'Draft\'.\n If the procurement is confirmed, the state is set to \'Confirmed\'.\ | 1270 | help='When a procurement is created the state is set to \'Draft\'.\n If the procurement is confirmed, the state is set to \'Confirmed\'.\ |
2282 | 1266 | \nAfter confirming the state is set to \'Running\'.\n If any exception arises in the order then the state is set to \'Exception\'.\n Once the exception is removed the state becomes \'Ready\'.\n It is in \'Waiting\'. state when the procurement is waiting for another one to finish.'), | 1271 | \nAfter confirming the state is set to \'Running\'.\n If any exception arises in the order then the state is set to \'Exception\'.\n Once the exception is removed the state becomes \'Ready\'.\n It is in \'Waiting\'. state when the procurement is waiting for another one to finish.'), |
2283 | 1267 | 'price_unit': fields.float('Unit Price from Tender', digits_compute=dp.get_precision('Purchase Price Computation')), | 1272 | 'price_unit': fields.float('Unit Price from Tender', digits_compute=dp.get_precision('Purchase Price Computation')), |
2284 | @@ -1279,7 +1284,7 @@ | |||
2285 | 1279 | if proc.supplier and not proc.supplier.address: | 1284 | if proc.supplier and not proc.supplier.address: |
2286 | 1280 | self.write(cr, uid, [proc.id], { | 1285 | self.write(cr, uid, [proc.id], { |
2287 | 1281 | 'state': 'exception', | 1286 | 'state': 'exception', |
2289 | 1282 | 'message': _('The supplier "%s" has no address defined!')%(proc.supplier.name,), | 1287 | 'message': _('The supplier "%s" has no address defined!') % (proc.supplier.name,), |
2290 | 1283 | }, context=context) | 1288 | }, context=context) |
2291 | 1284 | 1289 | ||
2292 | 1285 | return True | 1290 | return True |
2293 | @@ -1308,8 +1313,8 @@ | |||
2294 | 1308 | break | 1313 | break |
2295 | 1309 | # find the rfq | 1314 | # find the rfq |
2296 | 1310 | rfq_id = False | 1315 | rfq_id = False |
2299 | 1311 | # UTP-934: If source rfq to different supplier, different rfq must be created, and cannot be using the same rfq | 1316 | # UTP-934: If source rfq to different supplier, different rfq must be created, and cannot be using the same rfq |
2300 | 1312 | rfq_ids = rfq_obj.search(cr, uid, [('sale_order_id', '=', sale_order.id),('partner_id', '=', proc.supplier.id), ('state', '=', 'draft'), ('rfq_ok', '=', True),], context=context) | 1317 | rfq_ids = rfq_obj.search(cr, uid, [('sale_order_id', '=', sale_order.id), ('partner_id', '=', proc.supplier.id), ('state', '=', 'draft'), ('rfq_ok', '=', True), ], context=context) |
2301 | 1313 | if rfq_ids: | 1318 | if rfq_ids: |
2302 | 1314 | rfq_id = rfq_ids[0] | 1319 | rfq_id = rfq_ids[0] |
2303 | 1315 | # create if not found | 1320 | # create if not found |
2304 | @@ -1320,7 +1325,7 @@ | |||
2305 | 1320 | address_id = partner_obj.address_get(cr, uid, [supplier.id], ['default'])['default'] | 1325 | address_id = partner_obj.address_get(cr, uid, [supplier.id], ['default'])['default'] |
2306 | 1321 | if not address_id: | 1326 | if not address_id: |
2307 | 1322 | self.write(cr, uid, [proc.id], { | 1327 | self.write(cr, uid, [proc.id], { |
2309 | 1323 | 'message': _('The supplier "%s" has no address defined!')%(supplier.name,), | 1328 | 'message': _('The supplier "%s" has no address defined!') % (supplier.name,), |
2310 | 1324 | }, context=context) | 1329 | }, context=context) |
2311 | 1325 | continue | 1330 | continue |
2312 | 1326 | 1331 | ||
2313 | @@ -1338,7 +1343,7 @@ | |||
2314 | 1338 | 'rfq_ok': True, | 1343 | 'rfq_ok': True, |
2315 | 1339 | 'from_procurement': True, | 1344 | 'from_procurement': True, |
2316 | 1340 | 'order_type': sale_order.order_type, | 1345 | 'order_type': sale_order.order_type, |
2318 | 1341 | 'origin': sale_order.name,}, context=context) | 1346 | 'origin': sale_order.name, }, context=context) |
2319 | 1342 | 1347 | ||
2320 | 1343 | prsd_obj.chk_create(cr, uid, { | 1348 | prsd_obj.chk_create(cr, uid, { |
2321 | 1344 | 'order_id': sale_order.id, | 1349 | 'order_id': sale_order.id, |
2322 | @@ -1366,7 +1371,7 @@ | |||
2323 | 1366 | self.write(cr, uid, ids, {'rfq_id': rfq_id, 'rfq_line_id': rfq_line_id}, context=context) | 1371 | self.write(cr, uid, ids, {'rfq_id': rfq_id, 'rfq_line_id': rfq_line_id}, context=context) |
2324 | 1367 | 1372 | ||
2325 | 1368 | # log message concerning RfQ creation | 1373 | # log message concerning RfQ creation |
2327 | 1369 | rfq_obj.log(cr, uid, rfq_id, "The Request for Quotation '%s' has been created and must be completed before purchase order creation."%rfq_obj.browse(cr, uid, rfq_id, context=context).name, context={'rfq_ok': 1}) | 1374 | rfq_obj.log(cr, uid, rfq_id, "The Request for Quotation '%s' has been created and must be completed before purchase order creation." % rfq_obj.browse(cr, uid, rfq_id, context=context).name, context={'rfq_ok': 1}) |
2328 | 1370 | rfq_line = rfq_line_obj.browse(cr, uid, rfq_line_id, context=context) | 1375 | rfq_line = rfq_line_obj.browse(cr, uid, rfq_line_id, context=context) |
2329 | 1371 | self.infolog(cr, uid, "The FO/IR line id:%s (line number: %s) has been sourced on order to RfQ line id:%s (line number: %s) of the RfQ id:%s (%s)" % ( | 1376 | self.infolog(cr, uid, "The FO/IR line id:%s (line number: %s) has been sourced on order to RfQ line id:%s (line number: %s) of the RfQ id:%s (%s)" % ( |
2330 | 1372 | sale_order_line.id, | 1377 | sale_order_line.id, |
2331 | @@ -1399,7 +1404,7 @@ | |||
2332 | 1399 | sale_order_line = sol | 1404 | sale_order_line = sol |
2333 | 1400 | # find the tender | 1405 | # find the tender |
2334 | 1401 | tender_id = False | 1406 | tender_id = False |
2336 | 1402 | tender_ids = tender_obj.search(cr, uid, [('sale_order_id', '=', sale_order.id),('state', '=', 'draft'),], context=context) | 1407 | tender_ids = tender_obj.search(cr, uid, [('sale_order_id', '=', sale_order.id), ('state', '=', 'draft'), ], context=context) |
2337 | 1403 | if tender_ids: | 1408 | if tender_ids: |
2338 | 1404 | tender_id = tender_ids[0] | 1409 | tender_id = tender_ids[0] |
2339 | 1405 | # create if not found | 1410 | # create if not found |
2340 | @@ -1433,7 +1438,7 @@ | |||
2341 | 1433 | 1438 | ||
2342 | 1434 | # log message concerning tender creation | 1439 | # log message concerning tender creation |
2343 | 1435 | tender_line = tender_line_obj.browse(cr, uid, tender_line_id, context=context) | 1440 | tender_line = tender_line_obj.browse(cr, uid, tender_line_id, context=context) |
2345 | 1436 | tender_obj.log(cr, uid, tender_id, "The tender '%s' has been created and must be completed before purchase order creation."%tender_line.tender_id.name) | 1441 | tender_obj.log(cr, uid, tender_id, "The tender '%s' has been created and must be completed before purchase order creation." % tender_line.tender_id.name) |
2346 | 1437 | self.infolog(cr, uid, "The FO/IR line id:%s (%s) has been sourced on order to tender line id:%s of the tender id:%s (%s)" % ( | 1442 | self.infolog(cr, uid, "The FO/IR line id:%s (%s) has been sourced on order to tender line id:%s of the tender id:%s (%s)" % ( |
2347 | 1438 | sale_order_line.id, | 1443 | sale_order_line.id, |
2348 | 1439 | sale_order_line.line_number, | 1444 | sale_order_line.line_number, |
2349 | @@ -1450,14 +1455,14 @@ | |||
2350 | 1450 | ''' | 1455 | ''' |
2351 | 1451 | set is_tender_done value | 1456 | set is_tender_done value |
2352 | 1452 | ''' | 1457 | ''' |
2354 | 1453 | self.write(cr, uid, ids, {'is_tender_done': True, 'state': 'exception',}, context=context) | 1458 | self.write(cr, uid, ids, {'is_tender_done': True, 'state': 'exception', }, context=context) |
2355 | 1454 | return True | 1459 | return True |
2356 | 1455 | 1460 | ||
2357 | 1456 | def wkf_action_rfq_done(self, cr, uid, ids, context=None): | 1461 | def wkf_action_rfq_done(self, cr, uid, ids, context=None): |
2358 | 1457 | ''' | 1462 | ''' |
2359 | 1458 | set is_rfq_done value | 1463 | set is_rfq_done value |
2360 | 1459 | ''' | 1464 | ''' |
2362 | 1460 | self.write(cr, uid, ids, {'is_rfq_done': True, 'state': 'exception',}, context=context) | 1465 | self.write(cr, uid, ids, {'is_rfq_done': True, 'state': 'exception', }, context=context) |
2363 | 1461 | return True | 1466 | return True |
2364 | 1462 | 1467 | ||
2365 | 1463 | def _get_pricelist_from_currency(self, cr, uid, currency_id, context=None): | 1468 | def _get_pricelist_from_currency(self, cr, uid, currency_id, context=None): |
2366 | @@ -1488,7 +1493,7 @@ | |||
2367 | 1488 | # do not display a log if we come from po update backward update of so | 1493 | # do not display a log if we come from po update backward update of so |
2368 | 1489 | data = self.read(cr, uid, ids, ['so_back_update_dest_po_id_procurement_order'], context=context) | 1494 | data = self.read(cr, uid, ids, ['so_back_update_dest_po_id_procurement_order'], context=context) |
2369 | 1490 | if not data[0]['so_back_update_dest_po_id_procurement_order']: | 1495 | if not data[0]['so_back_update_dest_po_id_procurement_order']: |
2371 | 1491 | po_obj.log(cr, uid, result, "The Purchase Order '%s' has been created following 'on order' sourcing."%po_obj.browse(cr, uid, result, context=context).name) | 1496 | po_obj.log(cr, uid, result, "The Purchase Order '%s' has been created following 'on order' sourcing." % po_obj.browse(cr, uid, result, context=context).name) |
2372 | 1492 | return result | 1497 | return result |
2373 | 1493 | 1498 | ||
2374 | 1494 | def po_values_hook(self, cr, uid, ids, context=None, *args, **kwargs): | 1499 | def po_values_hook(self, cr, uid, ids, context=None, *args, **kwargs): |
2375 | @@ -1570,7 +1575,7 @@ | |||
2376 | 1570 | _constraints = [ | 1575 | _constraints = [ |
2377 | 1571 | (_check_valid_till, | 1576 | (_check_valid_till, |
2378 | 1572 | 'You must specify a Valid Till date.', | 1577 | 'You must specify a Valid Till date.', |
2380 | 1573 | ['valid_till']),] | 1578 | ['valid_till']), ] |
2381 | 1574 | 1579 | ||
2382 | 1575 | def default_get(self, cr, uid, fields, context=None): | 1580 | def default_get(self, cr, uid, fields, context=None): |
2383 | 1576 | ''' | 1581 | ''' |
2384 | @@ -1612,7 +1617,7 @@ | |||
2385 | 1612 | ''' | 1617 | ''' |
2386 | 1613 | if context is None: | 1618 | if context is None: |
2387 | 1614 | context = {} | 1619 | context = {} |
2389 | 1615 | if isinstance(ids, (int,long)): | 1620 | if isinstance(ids, (int, long)): |
2390 | 1616 | ids = [ids] | 1621 | ids = [ids] |
2391 | 1617 | wf_service = netsvc.LocalService("workflow") | 1622 | wf_service = netsvc.LocalService("workflow") |
2392 | 1618 | 1623 | ||
2393 | @@ -1640,10 +1645,10 @@ | |||
2394 | 1640 | purchase_orders = self.read(cr, uid, ids, ['state'], context=context) | 1645 | purchase_orders = self.read(cr, uid, ids, ['state'], context=context) |
2395 | 1641 | unlink_ids = [] | 1646 | unlink_ids = [] |
2396 | 1642 | for s in purchase_orders: | 1647 | for s in purchase_orders: |
2398 | 1643 | if s['state'] in ['draft','cancel']: | 1648 | if s['state'] in ['draft', 'cancel']: |
2399 | 1644 | unlink_ids.append(s['id']) | 1649 | unlink_ids.append(s['id']) |
2400 | 1645 | else: | 1650 | else: |
2402 | 1646 | raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!') % _(dict(PURCHASE_ORDER_STATE_SELECTION).get(s['state']))) | 1651 | raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!') % _(dict(PURCHASE_ORDER_STATE_SELECTION).get(s['state']))) |
2403 | 1647 | 1652 | ||
2404 | 1648 | return super(purchase_order, self).unlink(cr, uid, ids, context=context) | 1653 | return super(purchase_order, self).unlink(cr, uid, ids, context=context) |
2405 | 1649 | 1654 | ||
2406 | @@ -1675,18 +1680,18 @@ | |||
2407 | 1675 | This hook belongs to the rfq_sent method from tender_flow>tender_flow.py | 1680 | This hook belongs to the rfq_sent method from tender_flow>tender_flow.py |
2408 | 1676 | - check lines after import | 1681 | - check lines after import |
2409 | 1677 | ''' | 1682 | ''' |
2411 | 1678 | pol_obj = self.pool.get('purchase.order.line') | 1683 | pol_obj = self.pool.get('purchase.order.line') |
2412 | 1679 | 1684 | ||
2421 | 1680 | res = True | 1685 | res = True |
2422 | 1681 | empty_lines = pol_obj.search(cr, uid, [ | 1686 | empty_lines = pol_obj.search(cr, uid, [ |
2423 | 1682 | ('order_id', 'in', ids), | 1687 | ('order_id', 'in', ids), |
2424 | 1683 | ('product_qty', '<=', 0.00), | 1688 | ('product_qty', '<=', 0.00), |
2425 | 1684 | ], context=context) | 1689 | ], context=context) |
2426 | 1685 | if empty_lines: | 1690 | if empty_lines: |
2427 | 1686 | raise osv.except_osv( | 1691 | raise osv.except_osv( |
2428 | 1687 | _('Error'), | 1692 | _('Error'), |
2429 | 1688 | _('All lines of the RfQ should have a quantity before sending the RfQ to the supplier'), | 1693 | _('All lines of the RfQ should have a quantity before sending the RfQ to the supplier'), |
2431 | 1689 | ) | 1694 | ) |
2432 | 1690 | return res | 1695 | return res |
2433 | 1691 | 1696 | ||
2434 | 1692 | def action_sent(self, cr, uid, ids, context=None): | 1697 | def action_sent(self, cr, uid, ids, context=None): |
2435 | @@ -1695,7 +1700,7 @@ | |||
2436 | 1695 | ''' | 1700 | ''' |
2437 | 1696 | if context is None: | 1701 | if context is None: |
2438 | 1697 | context = {} | 1702 | context = {} |
2440 | 1698 | if isinstance(ids, (int,long)): | 1703 | if isinstance(ids, (int, long)): |
2441 | 1699 | ids = [ids] | 1704 | ids = [ids] |
2442 | 1700 | 1705 | ||
2443 | 1701 | self.write(cr, uid, ids, { | 1706 | self.write(cr, uid, ids, { |
2444 | @@ -2123,7 +2128,7 @@ | |||
2445 | 2123 | 2128 | ||
2446 | 2124 | po_accepted_values = {'client_action_multi': ['Order Follow Up', | 2129 | po_accepted_values = {'client_action_multi': ['Order Follow Up', |
2447 | 2125 | 'action_view_purchase_order_group'], | 2130 | 'action_view_purchase_order_group'], |
2449 | 2126 | 'client_print_multi': ['Purchase Order (Merged)', | 2131 | 'client_print_multi': ['Purchase Order (Merged)', |
2450 | 2127 | 'Purchase Order', | 2132 | 'Purchase Order', |
2451 | 2128 | 'Allocation report', | 2133 | 'Allocation report', |
2452 | 2129 | 'Order impact vs. Budget'], | 2134 | 'Order impact vs. Budget'], |
2453 | @@ -2146,14 +2151,14 @@ | |||
2454 | 2146 | or v[1] == 'Purchase Order' \ | 2151 | or v[1] == 'Purchase Order' \ |
2455 | 2147 | or v[1] == 'Purchase Order (Merged)' \ | 2152 | or v[1] == 'Purchase Order (Merged)' \ |
2456 | 2148 | or v[1] == 'Allocation report' \ | 2153 | or v[1] == 'Allocation report' \ |
2458 | 2149 | or v[1] == 'Order impact vs. Budget' : | 2154 | or v[1] == 'Order impact vs. Budget': |
2459 | 2150 | new_values.append(v) | 2155 | new_values.append(v) |
2460 | 2151 | elif context.get('request_for_quotation', False) and 'purchase.order' in [x[0] for x in models]: | 2156 | elif context.get('request_for_quotation', False) and 'purchase.order' in [x[0] for x in models]: |
2461 | 2152 | new_values = [] | 2157 | new_values = [] |
2462 | 2153 | for v in values: | 2158 | for v in values: |
2463 | 2154 | if key == 'action' and v[1] in rfq_accepted_values[key2] \ | 2159 | if key == 'action' and v[1] in rfq_accepted_values[key2] \ |
2464 | 2155 | or v[1] == 'Request for Quotation' \ | 2160 | or v[1] == 'Request for Quotation' \ |
2466 | 2156 | or v[1] == 'Request For Quotation Excel Export' : | 2161 | or v[1] == 'Request For Quotation Excel Export': |
2467 | 2157 | new_values.append(v) | 2162 | new_values.append(v) |
2468 | 2158 | 2163 | ||
2469 | 2159 | return new_values | 2164 | return new_values |
2470 | 2160 | 2165 | ||
2471 | === modified file 'bin/release.py' | |||
2472 | --- bin/release.py 2018-01-30 16:12:16 +0000 | |||
2473 | +++ bin/release.py 2018-02-12 10:19:50 +0000 | |||
2474 | @@ -20,7 +20,7 @@ | |||
2475 | 20 | ############################################################################## | 20 | ############################################################################## |
2476 | 21 | 21 | ||
2477 | 22 | name = 'openerp-server' | 22 | name = 'openerp-server' |
2479 | 23 | version = 'UF7.1' | 23 | version = 'UF8.0dev' |
2480 | 24 | major_version = '7.0' | 24 | major_version = '7.0' |
2481 | 25 | description = 'OpenERP Server' | 25 | description = 'OpenERP Server' |
2482 | 26 | long_desc = '''OpenERP is a complete ERP and CRM. The main features are accounting (analytic | 26 | long_desc = '''OpenERP is a complete ERP and CRM. The main features are accounting (analytic |
2483 | 27 | 27 | ||
2484 | === modified file 'bin/sql_db.py' | |||
2485 | --- bin/sql_db.py 2017-10-19 14:14:14 +0000 | |||
2486 | +++ bin/sql_db.py 2018-02-12 10:19:50 +0000 | |||
2487 | @@ -390,6 +390,9 @@ | |||
2488 | 390 | try: | 390 | try: |
2489 | 391 | result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection) | 391 | result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection) |
2490 | 392 | except psycopg2.Error: | 392 | except psycopg2.Error: |
2491 | 393 | log = logging.getLogger() | ||
2492 | 394 | if len(log.handlers) > 1: | ||
2493 | 395 | log.removeHandler(log.handlers[1]) | ||
2494 | 393 | self.__logger.exception('Connection to the database failed') | 396 | self.__logger.exception('Connection to the database failed') |
2495 | 394 | raise | 397 | raise |
2496 | 395 | self._connections.append((result, True, time.time())) | 398 | self._connections.append((result, True, time.time())) |