Merge lp:~openbig/bigconsulting/multi_currency_milestone2 into lp:bigconsulting
- multi_currency_milestone2
- Merge into addons
Proposed by
Atik Agewan(OpenERP)
Status: | Merged |
---|---|
Merged at revision: | 53 |
Proposed branch: | lp:~openbig/bigconsulting/multi_currency_milestone2 |
Merge into: | lp:bigconsulting |
Diff against target: |
748 lines (+408/-68) 2 files modified
account_invoice_cash_discount/account_invoice_cash_discount.py (+353/-58) account_invoice_cash_discount/account_invoice_cash_discount_view.xml (+55/-10) |
To merge this branch: | bzr merge lp:~openbig/bigconsulting/multi_currency_milestone2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
openbig | Pending | ||
Review via email: mp+31034@code.launchpad.net |
Commit message
Description of the change
changes in milestone2 multicurrency
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py' | |||
2 | --- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-07-23 11:30:07 +0000 | |||
3 | +++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-07-27 10:15:58 +0000 | |||
4 | @@ -1,7 +1,7 @@ | |||
5 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
6 | 2 | ############################################################################## | 2 | ############################################################################## |
7 | 3 | # | 3 | # |
9 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
10 | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
11 | 6 | # $Id$ | 6 | # $Id$ |
12 | 7 | # | 7 | # |
13 | @@ -63,7 +63,7 @@ | |||
14 | 63 | 63 | ||
15 | 64 | class account_invoice(osv.osv): | 64 | class account_invoice(osv.osv): |
16 | 65 | _inherit = "account.invoice" | 65 | _inherit = "account.invoice" |
18 | 66 | 66 | ||
19 | 67 | def _get_amount(self, cr, uid, ids, resudial_amonut, payment_term, context=None): | 67 | def _get_amount(self, cr, uid, ids, resudial_amonut, payment_term, context=None): |
20 | 68 | """ | 68 | """ |
21 | 69 | This function return the Amount to paid according to the payment term cash discount payment term lines | 69 | This function return the Amount to paid according to the payment term cash discount payment term lines |
22 | @@ -72,16 +72,16 @@ | |||
23 | 72 | context = {} | 72 | context = {} |
24 | 73 | tax_obj = self.pool.get('account.tax') | 73 | tax_obj = self.pool.get('account.tax') |
25 | 74 | invoice = self.browse(cr, uid, ids[0], context=context) | 74 | invoice = self.browse(cr, uid, ids[0], context=context) |
27 | 75 | 75 | ||
28 | 76 | if invoice.date_invoice: | 76 | if invoice.date_invoice: |
29 | 77 | date1 = invoice.date_invoice | 77 | date1 = invoice.date_invoice |
30 | 78 | else: | 78 | else: |
31 | 79 | date1 = time.strftime('%Y-%m-%d') | 79 | date1 = time.strftime('%Y-%m-%d') |
34 | 80 | 80 | ||
35 | 81 | if 'date_p' in context and context['date_p']: | 81 | if 'date_p' in context and context['date_p']: |
36 | 82 | date2 = context['date_p'] | 82 | date2 = context['date_p'] |
37 | 83 | else: | 83 | else: |
39 | 84 | date2 = time.strftime('%Y-%m-%d') | 84 | date2 = time.strftime('%Y-%m-%d') |
40 | 85 | 85 | ||
41 | 86 | if date1 >= date2: | 86 | if date1 >= date2: |
42 | 87 | from_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) | 87 | from_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) |
43 | @@ -91,12 +91,12 @@ | |||
44 | 91 | from_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) | 91 | from_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) |
45 | 92 | to_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) | 92 | to_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) |
46 | 93 | diff_day = (from_dt-to_dt)/(3600*24) | 93 | diff_day = (from_dt-to_dt)/(3600*24) |
48 | 94 | 94 | ||
49 | 95 | discount = 0.0 | 95 | discount = 0.0 |
50 | 96 | amount = 0.0 | 96 | amount = 0.0 |
51 | 97 | tol_days = 0.0 | 97 | tol_days = 0.0 |
52 | 98 | payment_line_found = False | 98 | payment_line_found = False |
54 | 99 | 99 | ||
55 | 100 | if payment_term: | 100 | if payment_term: |
56 | 101 | payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context) | 101 | payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context) |
57 | 102 | if payment_term_lines.line_ids: | 102 | if payment_term_lines.line_ids: |
58 | @@ -115,28 +115,28 @@ | |||
59 | 115 | res = resudial_amonut | 115 | res = resudial_amonut |
60 | 116 | amount = res | 116 | amount = res |
61 | 117 | dis = payment_line.days | 117 | dis = payment_line.days |
63 | 118 | 118 | ||
64 | 119 | return {'amount':amount,'tol_days':tol_days,'found':payment_line_found} | 119 | return {'amount':amount,'tol_days':tol_days,'found':payment_line_found} |
66 | 120 | 120 | ||
67 | 121 | def _get_payment(self, cr, uid, ids, resudial_amonut, payment_term, context=None): | 121 | def _get_payment(self, cr, uid, ids, resudial_amonut, payment_term, context=None): |
68 | 122 | """ | 122 | """ |
69 | 123 | This function return the Discount according to the payment term cash discount term | 123 | This function return the Discount according to the payment term cash discount term |
70 | 124 | """ | 124 | """ |
71 | 125 | if context is None: | 125 | if context is None: |
72 | 126 | context = {} | 126 | context = {} |
74 | 127 | 127 | ||
75 | 128 | tax_obj = self.pool.get('account.tax') | 128 | tax_obj = self.pool.get('account.tax') |
76 | 129 | invoice = self.browse(cr, uid, ids[0], context=context) | 129 | invoice = self.browse(cr, uid, ids[0], context=context) |
78 | 130 | 130 | ||
79 | 131 | if invoice.date_invoice: | 131 | if invoice.date_invoice: |
80 | 132 | date1 = invoice.date_invoice | 132 | date1 = invoice.date_invoice |
81 | 133 | else: | 133 | else: |
82 | 134 | date1 = time.strftime('%Y-%m-%d') | 134 | date1 = time.strftime('%Y-%m-%d') |
85 | 135 | 135 | ||
86 | 136 | if 'date_p' in context and context['date_p']: | 136 | if 'date_p' in context and context['date_p']: |
87 | 137 | date2 = context['date_p'] | 137 | date2 = context['date_p'] |
88 | 138 | else: | 138 | else: |
90 | 139 | date2 = time.strftime('%Y-%m-%d') | 139 | date2 = time.strftime('%Y-%m-%d') |
91 | 140 | 140 | ||
92 | 141 | if date1 >= date2: | 141 | if date1 >= date2: |
93 | 142 | from_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) | 142 | from_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) |
94 | @@ -146,10 +146,10 @@ | |||
95 | 146 | from_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) | 146 | from_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) |
96 | 147 | to_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) | 147 | to_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) |
97 | 148 | diff_day = (from_dt-to_dt)/(3600*24) | 148 | diff_day = (from_dt-to_dt)/(3600*24) |
99 | 149 | 149 | ||
100 | 150 | tolerance = self._get_amount(cr, uid, ids, resudial_amonut, payment_term, context) | 150 | tolerance = self._get_amount(cr, uid, ids, resudial_amonut, payment_term, context) |
101 | 151 | tolerance_days = tolerance['tol_days'] | 151 | tolerance_days = tolerance['tol_days'] |
103 | 152 | 152 | ||
104 | 153 | discount = 0.0 | 153 | discount = 0.0 |
105 | 154 | if payment_term: | 154 | if payment_term: |
106 | 155 | payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context) | 155 | payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context) |
107 | @@ -163,29 +163,29 @@ | |||
108 | 163 | discount = res | 163 | discount = res |
109 | 164 | dis = discount_line.delay + tolerance_days | 164 | dis = discount_line.delay + tolerance_days |
110 | 165 | return discount | 165 | return discount |
112 | 166 | 166 | ||
113 | 167 | def _get_account(self, cr, uid, ids, resudial_amonut, payment_term, context=None): | 167 | def _get_account(self, cr, uid, ids, resudial_amonut, payment_term, context=None): |
114 | 168 | """ | 168 | """ |
115 | 169 | This function return the Account according to the payment term cash discount term | 169 | This function return the Account according to the payment term cash discount term |
116 | 170 | """ | 170 | """ |
117 | 171 | if context is None: | 171 | if context is None: |
118 | 172 | context = {} | 172 | context = {} |
120 | 173 | 173 | ||
121 | 174 | account_id = False | 174 | account_id = False |
123 | 175 | 175 | ||
124 | 176 | tax_obj = self.pool.get('account.tax') | 176 | tax_obj = self.pool.get('account.tax') |
125 | 177 | invoice = self.browse(cr, uid, ids[0], context=context) | 177 | invoice = self.browse(cr, uid, ids[0], context=context) |
127 | 178 | 178 | ||
128 | 179 | if invoice.date_invoice: | 179 | if invoice.date_invoice: |
129 | 180 | date1 = invoice.date_invoice | 180 | date1 = invoice.date_invoice |
131 | 181 | else: | 181 | else: |
132 | 182 | date1 = time.strftime('%Y-%m-%d') | 182 | date1 = time.strftime('%Y-%m-%d') |
135 | 183 | 183 | ||
136 | 184 | if 'date_p' in context and context['date_p']: | 184 | if 'date_p' in context and context['date_p']: |
137 | 185 | date2 = context['date_p'] | 185 | date2 = context['date_p'] |
138 | 186 | else: | 186 | else: |
141 | 187 | date2 = time.strftime('%Y-%m-%d') | 187 | date2 = time.strftime('%Y-%m-%d') |
142 | 188 | 188 | ||
143 | 189 | if date1 > date2: | 189 | if date1 > date2: |
144 | 190 | from_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) | 190 | from_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) |
145 | 191 | to_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) | 191 | to_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) |
146 | @@ -193,11 +193,11 @@ | |||
147 | 193 | else: | 193 | else: |
148 | 194 | from_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) | 194 | from_dt = time.mktime(time.strptime(date2,'%Y-%m-%d')) |
149 | 195 | to_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) | 195 | to_dt = time.mktime(time.strptime(date1,'%Y-%m-%d')) |
152 | 196 | diff_day = (from_dt-to_dt)/(3600*24) | 196 | diff_day = (from_dt-to_dt)/(3600*24) |
153 | 197 | 197 | ||
154 | 198 | tolerance = self._get_amount(cr, uid, ids, resudial_amonut, payment_term, context) | 198 | tolerance = self._get_amount(cr, uid, ids, resudial_amonut, payment_term, context) |
155 | 199 | tolerance_days = tolerance['tol_days'] | 199 | tolerance_days = tolerance['tol_days'] |
157 | 200 | 200 | ||
158 | 201 | if payment_term: | 201 | if payment_term: |
159 | 202 | payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context) | 202 | payment_term_lines = self.pool.get('account.payment.term').browse(cr, uid, payment_term, context=context) |
160 | 203 | if payment_term_lines.cash_discount_ids: | 203 | if payment_term_lines.cash_discount_ids: |
161 | @@ -207,29 +207,29 @@ | |||
162 | 207 | if diff_day >= dis and diff_day <= discount_line.delay + tolerance_days: | 207 | if diff_day >= dis and diff_day <= discount_line.delay + tolerance_days: |
163 | 208 | if invoice.type in ('in_invoice', 'in_refund'): | 208 | if invoice.type in ('in_invoice', 'in_refund'): |
164 | 209 | account_id = discount_line.sup_discount_account_id.id | 209 | account_id = discount_line.sup_discount_account_id.id |
166 | 210 | else: | 210 | else: |
167 | 211 | account_id = discount_line.discount_account_id.id | 211 | account_id = discount_line.discount_account_id.id |
168 | 212 | dis = discount_line.delay + tolerance_days | 212 | dis = discount_line.delay + tolerance_days |
171 | 213 | return account_id | 213 | return account_id |
172 | 214 | 214 | ||
173 | 215 | def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): | 215 | def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): |
174 | 216 | if context is None: | 216 | if context is None: |
175 | 217 | context = {} | 217 | context = {} |
176 | 218 | #TODO check if we can use different period for payment and the writeoff line | 218 | #TODO check if we can use different period for payment and the writeoff line |
177 | 219 | assert len(ids)==1, "Can only pay one invoice at a time" | 219 | assert len(ids)==1, "Can only pay one invoice at a time" |
178 | 220 | invoice = self.browse(cr, uid, ids[0]) | 220 | invoice = self.browse(cr, uid, ids[0]) |
180 | 221 | 221 | ||
181 | 222 | tax_obj = self.pool.get('account.tax') | 222 | tax_obj = self.pool.get('account.tax') |
182 | 223 | invoice_tax_obj = self.pool.get("account.invoice.tax") | 223 | invoice_tax_obj = self.pool.get("account.invoice.tax") |
183 | 224 | move_line_obj = self.pool.get('account.move.line') | 224 | move_line_obj = self.pool.get('account.move.line') |
184 | 225 | move_obj = self.pool.get('account.move') | 225 | move_obj = self.pool.get('account.move') |
187 | 226 | 226 | ||
188 | 227 | amount_discount = 0.0 | 227 | amount_discount = 0.0 |
189 | 228 | if invoice.payment_term: | 228 | if invoice.payment_term: |
190 | 229 | # Return the discount on for the payment term | 229 | # Return the discount on for the payment term |
191 | 230 | amount_discount = self._get_payment(cr, uid, ids, pay_amount, invoice.payment_term.id, context=context) | 230 | amount_discount = self._get_payment(cr, uid, ids, pay_amount, invoice.payment_term.id, context=context) |
192 | 231 | 231 | ||
194 | 232 | 232 | ||
195 | 233 | src_account_id = invoice.account_id.id | 233 | src_account_id = invoice.account_id.id |
196 | 234 | # Take the seq as name for move | 234 | # Take the seq as name for move |
197 | 235 | types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1} | 235 | types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1} |
198 | @@ -239,7 +239,7 @@ | |||
199 | 239 | date=context['date_p'] | 239 | date=context['date_p'] |
200 | 240 | else: | 240 | else: |
201 | 241 | date=time.strftime('%Y-%m-%d') | 241 | date=time.strftime('%Y-%m-%d') |
203 | 242 | 242 | ||
204 | 243 | # Take the amount in currency and the currency of the payment | 243 | # Take the amount in currency and the currency of the payment |
205 | 244 | if 'amount_currency' in context and context['amount_currency'] and 'currency_id' in context and context['currency_id']: | 244 | if 'amount_currency' in context and context['amount_currency'] and 'currency_id' in context and context['currency_id']: |
206 | 245 | amount_currency = context['amount_currency'] | 245 | amount_currency = context['amount_currency'] |
207 | @@ -247,18 +247,18 @@ | |||
208 | 247 | else: | 247 | else: |
209 | 248 | amount_currency = False | 248 | amount_currency = False |
210 | 249 | currency_id = False | 249 | currency_id = False |
212 | 250 | 250 | ||
213 | 251 | if invoice.type in ('in_invoice', 'in_refund'): | 251 | if invoice.type in ('in_invoice', 'in_refund'): |
214 | 252 | ref = invoice.reference | 252 | ref = invoice.reference |
215 | 253 | else: | 253 | else: |
216 | 254 | ref = self._convert_ref(cr, uid, invoice.number) | 254 | ref = self._convert_ref(cr, uid, invoice.number) |
218 | 255 | 255 | ||
219 | 256 | discount_amount = 0.0 | 256 | discount_amount = 0.0 |
220 | 257 | tax_total_amount = 0.0 | 257 | tax_total_amount = 0.0 |
222 | 258 | 258 | ||
223 | 259 | if 'cash_amount' in context and context['cash_amount']: | 259 | if 'cash_amount' in context and context['cash_amount']: |
224 | 260 | discount_amount = context['cash_amount'] | 260 | discount_amount = context['cash_amount'] |
226 | 261 | 261 | ||
227 | 262 | # Pay attention to the sign for both debit/credit AND amount_currency | 262 | # Pay attention to the sign for both debit/credit AND amount_currency |
228 | 263 | l1 = { | 263 | l1 = { |
229 | 264 | 'debit': direction * (pay_amount)>0 and direction * (pay_amount), | 264 | 'debit': direction * (pay_amount)>0 and direction * (pay_amount), |
230 | @@ -270,12 +270,12 @@ | |||
231 | 270 | 'currency_id':currency_id, | 270 | 'currency_id':currency_id, |
232 | 271 | 'amount_currency':amount_currency and direction * amount_currency or 0.0, | 271 | 'amount_currency':amount_currency and direction * amount_currency or 0.0, |
233 | 272 | } | 272 | } |
235 | 273 | 273 | ||
236 | 274 | ### if we change the amount paid and in the disocunt then it used the changes discount | 274 | ### if we change the amount paid and in the disocunt then it used the changes discount |
238 | 275 | 275 | ||
239 | 276 | if amount_discount != discount_amount and discount_amount>0.0: | 276 | if amount_discount != discount_amount and discount_amount>0.0: |
240 | 277 | amount_discount = discount_amount | 277 | amount_discount = discount_amount |
242 | 278 | 278 | ||
243 | 279 | l2 = { | 279 | l2 = { |
244 | 280 | 'debit': direction * (pay_amount-amount_discount)<0 and - direction * (pay_amount-amount_discount), | 280 | 'debit': direction * (pay_amount-amount_discount)<0 and - direction * (pay_amount-amount_discount), |
245 | 281 | 'credit': direction * (pay_amount-amount_discount)>0 and direction * (pay_amount-amount_discount), | 281 | 'credit': direction * (pay_amount-amount_discount)>0 and direction * (pay_amount-amount_discount), |
246 | @@ -289,12 +289,12 @@ | |||
247 | 289 | 289 | ||
248 | 290 | if not name: | 290 | if not name: |
249 | 291 | name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number | 291 | name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number |
251 | 292 | 292 | ||
252 | 293 | l1['name'] = name | 293 | l1['name'] = name |
253 | 294 | l2['name'] = name | 294 | l2['name'] = name |
254 | 295 | lines = [(0, 0, l1), (0, 0, l2)] | 295 | lines = [(0, 0, l1), (0, 0, l2)] |
257 | 296 | 296 | ||
258 | 297 | ### When we make payment by pay invoice wizard and if found the taxes move then directly take the entry from the wizard | 297 | ### When we make payment by pay invoice wizard and if found the taxes move then directly take the entry from the wizard |
259 | 298 | if 'tax_move_ids' in context and context['tax_move_ids']: | 298 | if 'tax_move_ids' in context and context['tax_move_ids']: |
260 | 299 | move_line = context['tax_move_ids'] | 299 | move_line = context['tax_move_ids'] |
261 | 300 | for move_line_id in move_line: | 300 | for move_line_id in move_line: |
262 | @@ -316,7 +316,7 @@ | |||
263 | 316 | move_line_obj.unlink(cr, uid,[move_line_id]) | 316 | move_line_obj.unlink(cr, uid,[move_line_id]) |
264 | 317 | move_obj.unlink(cr, uid,[move_line_data.move_id.id]) | 317 | move_obj.unlink(cr, uid,[move_line_data.move_id.id]) |
265 | 318 | else: | 318 | else: |
267 | 319 | if amount_discount>0.0: | 319 | if amount_discount>0.0: |
268 | 320 | for line in invoice.invoice_line: | 320 | for line in invoice.invoice_line: |
269 | 321 | if line.invoice_line_tax_id: | 321 | if line.invoice_line_tax_id: |
270 | 322 | for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, amount_discount, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): | 322 | for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, amount_discount, line.quantity, invoice.address_invoice_id.id, line.product_id, invoice.partner_id): |
271 | @@ -340,9 +340,9 @@ | |||
272 | 340 | } | 340 | } |
273 | 341 | l3['name'] = name | 341 | l3['name'] = name |
274 | 342 | lines.append((0, 0, l3)) | 342 | lines.append((0, 0, l3)) |
276 | 343 | 343 | ||
277 | 344 | ### When we make payment by pay invoice wizard and if found the discount moves in wizard discount move then directly take the entry from the wizard | 344 | ### When we make payment by pay invoice wizard and if found the discount moves in wizard discount move then directly take the entry from the wizard |
279 | 345 | if 'discount_move_ids' in context and context['discount_move_ids']: | 345 | if 'discount_move_ids' in context and context['discount_move_ids']: |
280 | 346 | move_line = context['discount_move_ids'] | 346 | move_line = context['discount_move_ids'] |
281 | 347 | for move_line_id in move_line: | 347 | for move_line_id in move_line: |
282 | 348 | move_line_data = move_line_obj.browse(cr, uid,move_line_id) | 348 | move_line_data = move_line_obj.browse(cr, uid,move_line_id) |
283 | @@ -365,7 +365,7 @@ | |||
284 | 365 | else: | 365 | else: |
285 | 366 | if amount_discount>0: | 366 | if amount_discount>0: |
286 | 367 | if 'account_id' in context and context['account_id']: | 367 | if 'account_id' in context and context['account_id']: |
288 | 368 | account_id = context['account_id'] | 368 | account_id = context['account_id'] |
289 | 369 | if tax_total_amount>0: | 369 | if tax_total_amount>0: |
290 | 370 | amount_discount = (amount_discount - tax_total_amount) | 370 | amount_discount = (amount_discount - tax_total_amount) |
291 | 371 | else: | 371 | else: |
292 | @@ -382,15 +382,15 @@ | |||
293 | 382 | } | 382 | } |
294 | 383 | l4['name'] = name | 383 | l4['name'] = name |
295 | 384 | lines.append((0, 0, l4)) | 384 | lines.append((0, 0, l4)) |
297 | 385 | 385 | ||
298 | 386 | move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date} | 386 | move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date} |
299 | 387 | move_id = move_obj.create(cr, uid, move, context=context) | 387 | move_id = move_obj.create(cr, uid, move, context=context) |
301 | 388 | 388 | ||
302 | 389 | line_ids = [] | 389 | line_ids = [] |
303 | 390 | total = 0.0 | 390 | total = 0.0 |
304 | 391 | line = self.pool.get('account.move.line') | 391 | line = self.pool.get('account.move.line') |
305 | 392 | cr.execute('select id from account_move_line where move_id in ('+str(move_id)+','+str(invoice.move_id.id)+')') | 392 | cr.execute('select id from account_move_line where move_id in ('+str(move_id)+','+str(invoice.move_id.id)+')') |
307 | 393 | 393 | ||
308 | 394 | lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) ) | 394 | lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) ) |
309 | 395 | for l in lines+invoice.payment_ids: | 395 | for l in lines+invoice.payment_ids: |
310 | 396 | if l.account_id.id==src_account_id: | 396 | if l.account_id.id==src_account_id: |
311 | @@ -404,28 +404,323 @@ | |||
312 | 404 | # Update the stored value (fields.function), so we write to trigger recompute | 404 | # Update the stored value (fields.function), so we write to trigger recompute |
313 | 405 | self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) | 405 | self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) |
314 | 406 | return True | 406 | return True |
316 | 407 | 407 | ||
317 | 408 | account_invoice() | 408 | account_invoice() |
318 | 409 | 409 | ||
319 | 410 | class account_move_line(osv.osv): | 410 | class account_move_line(osv.osv): |
320 | 411 | _name = 'account.move.line' | 411 | _name = 'account.move.line' |
321 | 412 | _inherit = 'account.move.line' | 412 | _inherit = 'account.move.line' |
323 | 413 | 413 | ||
324 | 414 | def _invoice(self, cr, uid, ids, name, arg, context=None): | 414 | def _invoice(self, cr, uid, ids, name, arg, context=None): |
325 | 415 | res = {} | 415 | res = {} |
326 | 416 | if ids: | 416 | if ids: |
327 | 417 | return super(account_move_line, self)._invoice(cr, uid, ids, name, arg, context) | 417 | return super(account_move_line, self)._invoice(cr, uid, ids, name, arg, context) |
328 | 418 | else: | 418 | else: |
329 | 419 | return res | 419 | return res |
331 | 420 | 420 | ||
332 | 421 | def _invoice_search(self, cr, uid, obj, name, args, context={}): | 421 | def _invoice_search(self, cr, uid, obj, name, args, context={}): |
333 | 422 | return super(account_move_line, self)._invoice_search(cr, uid, obj, name, args, context=context) | 422 | return super(account_move_line, self)._invoice_search(cr, uid, obj, name, args, context=context) |
335 | 423 | 423 | ||
336 | 424 | _columns = { | 424 | _columns = { |
337 | 425 | 'invoice': fields.function(_invoice, method=True, string='Invoice', | 425 | 'invoice': fields.function(_invoice, method=True, string='Invoice', |
338 | 426 | type='many2one', relation='account.invoice', fnct_search=_invoice_search), | 426 | type='many2one', relation='account.invoice', fnct_search=_invoice_search), |
339 | 427 | } | 427 | } |
340 | 428 | account_move_line() | 428 | account_move_line() |
341 | 429 | 429 | ||
342 | 430 | class res_company(osv.osv): | ||
343 | 431 | _inherit = "res.company" | ||
344 | 432 | |||
345 | 433 | _columns = { | ||
346 | 434 | 'expense_account_id': fields.many2one('account.account', 'Expenses',required=True), | ||
347 | 435 | 'revenue_account_id': fields.many2one('account.account', 'Revenues',required=True), | ||
348 | 436 | } | ||
349 | 437 | res_company() | ||
350 | 438 | |||
351 | 439 | class res_company_wizard(osv.osv_memory): | ||
352 | 440 | _name = 'res.company.wizard' | ||
353 | 441 | _columns = { | ||
354 | 442 | 'expense_account_id': fields.many2one('account.account', 'Expenses',required=True), | ||
355 | 443 | 'revenue_account_id': fields.many2one('account.account', 'Revenues',required=True), | ||
356 | 444 | } | ||
357 | 445 | _defaults = { | ||
358 | 446 | 'expense_account_id': lambda *a: 2, | ||
359 | 447 | 'revenue_account_id': lambda *a: 3, | ||
360 | 448 | } | ||
361 | 449 | |||
362 | 450 | def set_default(self, cr, uid, ids, context=None): | ||
363 | 451 | company_id =self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id | ||
364 | 452 | for o in self.browse(cr, uid, ids, context=context): | ||
365 | 453 | self.pool.get('res.company').write(cr, uid, [company_id.id], {'expense_account_id':o.expense_account_id.id,'revenue_account_id':o.revenue_account_id.id}) | ||
366 | 454 | return { | ||
367 | 455 | 'view_type': 'form', | ||
368 | 456 | "view_mode": 'form', | ||
369 | 457 | 'res_model': 'ir.actions.configuration.wizard', | ||
370 | 458 | 'type': 'ir.actions.act_window', | ||
371 | 459 | 'target': 'new', | ||
372 | 460 | } | ||
373 | 461 | |||
374 | 462 | def action_cancel(self,cr,uid,ids,conect=None): | ||
375 | 463 | return { | ||
376 | 464 | 'view_type': 'form', | ||
377 | 465 | "view_mode": 'form', | ||
378 | 466 | 'res_model': 'ir.actions.configuration.wizard', | ||
379 | 467 | 'type': 'ir.actions.act_window', | ||
380 | 468 | 'target':'new', | ||
381 | 469 | } | ||
382 | 470 | |||
383 | 471 | res_company_wizard() | ||
384 | 472 | |||
385 | 473 | class account_bank_statement(osv.osv): | ||
386 | 474 | _inherit="account.bank.statement" | ||
387 | 475 | |||
388 | 476 | def button_confirm(self, cr, uid, ids, context={}): | ||
389 | 477 | done = [] | ||
390 | 478 | res_currency_obj = self.pool.get('res.currency') | ||
391 | 479 | res_users_obj = self.pool.get('res.users') | ||
392 | 480 | account_move_obj = self.pool.get('account.move') | ||
393 | 481 | account_move_line_obj = self.pool.get('account.move.line') | ||
394 | 482 | cur_obj = self.pool.get('res.currency') | ||
395 | 483 | account_bank_statement_line_obj = \ | ||
396 | 484 | self.pool.get('account.bank.statement.line') | ||
397 | 485 | account_bank_reconcil = self.pool.get('account.bank.statement.reconcile') | ||
398 | 486 | company_currency_id = res_users_obj.browse(cr, uid, uid, | ||
399 | 487 | context=context).company_id.currency_id.id | ||
400 | 488 | for st in self.browse(cr, uid, ids, context): | ||
401 | 489 | if not st.state=='draft': | ||
402 | 490 | continue | ||
403 | 491 | if not (abs(st.balance_end - st.balance_end_real) < 0.0001): | ||
404 | 492 | raise osv.except_osv(_('Error !'), | ||
405 | 493 | _('The statement balance is incorrect !\n') + | ||
406 | 494 | _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end)) | ||
407 | 495 | if (not st.journal_id.default_credit_account_id) \ | ||
408 | 496 | or (not st.journal_id.default_debit_account_id): | ||
409 | 497 | raise osv.except_osv(_('Configuration Error !'), | ||
410 | 498 | _('Please verify that an account is defined in the journal.')) | ||
411 | 499 | |||
412 | 500 | for line in st.move_line_ids: | ||
413 | 501 | if line.state <> 'valid': | ||
414 | 502 | raise osv.except_osv(_('Error !'), | ||
415 | 503 | _('The account entries lines are not in valid state.')) | ||
416 | 504 | # for bank.statement.lines | ||
417 | 505 | # In line we get reconcile_id on bank.ste.rec. | ||
418 | 506 | # in bank stat.rec we get line_new_ids on bank.stat.rec.line | ||
419 | 507 | for move in st.line_ids: | ||
420 | 508 | context.update({'date':move.date}) | ||
421 | 509 | move_id = account_move_obj.create(cr, uid, { | ||
422 | 510 | 'journal_id': st.journal_id.id, | ||
423 | 511 | 'period_id': st.period_id.id, | ||
424 | 512 | 'date': move.date, | ||
425 | 513 | }, context=context) | ||
426 | 514 | account_bank_statement_line_obj.write(cr, uid, [move.id], { | ||
427 | 515 | 'move_ids': [(4,move_id, False)] | ||
428 | 516 | }) | ||
429 | 517 | if not move.amount: | ||
430 | 518 | continue | ||
431 | 519 | torec = [] | ||
432 | 520 | if move.amount >= 0: | ||
433 | 521 | account_id = st.journal_id.default_credit_account_id.id | ||
434 | 522 | else: | ||
435 | 523 | account_id = st.journal_id.default_debit_account_id.id | ||
436 | 524 | acc_cur = ((move.amount<=0) and st.journal_id.default_debit_account_id) or move.account_id | ||
437 | 525 | amount = res_currency_obj.compute(cr, uid, st.currency.id, | ||
438 | 526 | company_currency_id, move.amount, context=context, | ||
439 | 527 | account=acc_cur) | ||
440 | 528 | if move.reconcile_id and move.reconcile_id.line_new_ids: | ||
441 | 529 | for newline in move.reconcile_id.line_new_ids: | ||
442 | 530 | amount += newline.amount | ||
443 | 531 | |||
444 | 532 | val = { | ||
445 | 533 | 'name': move.name, | ||
446 | 534 | 'date': move.date, | ||
447 | 535 | 'ref': move.ref, | ||
448 | 536 | 'move_id': move_id, | ||
449 | 537 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | ||
450 | 538 | 'account_id': (move.account_id) and move.account_id.id, | ||
451 | 539 | 'credit': ((amount>0) and amount) or 0.0, | ||
452 | 540 | 'debit': ((amount<0) and -amount) or 0.0, | ||
453 | 541 | 'statement_id': st.id, | ||
454 | 542 | 'journal_id': st.journal_id.id, | ||
455 | 543 | 'period_id': st.period_id.id, | ||
456 | 544 | 'currency_id': st.currency.id, | ||
457 | 545 | } | ||
458 | 546 | |||
459 | 547 | amount = res_currency_obj.compute(cr, uid, st.currency.id, | ||
460 | 548 | company_currency_id, move.amount, context=context, | ||
461 | 549 | account=acc_cur) | ||
462 | 550 | if st.currency.id <> company_currency_id: | ||
463 | 551 | amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, | ||
464 | 552 | st.currency.id, amount, context=context, | ||
465 | 553 | account=acc_cur) | ||
466 | 554 | val['amount_currency'] = -amount_cur | ||
467 | 555 | |||
468 | 556 | if move.account_id and move.account_id.currency_id and move.account_id.currency_id.id <> company_currency_id: | ||
469 | 557 | val['currency_id'] = move.account_id.currency_id.id | ||
470 | 558 | if company_currency_id==move.account_id.currency_id.id: | ||
471 | 559 | amount_cur = move.amount | ||
472 | 560 | else: | ||
473 | 561 | amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, | ||
474 | 562 | move.account_id.currency_id.id, amount, context=context, | ||
475 | 563 | account=acc_cur) | ||
476 | 564 | val['amount_currency'] = amount_cur | ||
477 | 565 | |||
478 | 566 | torec.append(account_move_line_obj.create(cr, uid, val , context=context)) | ||
479 | 567 | |||
480 | 568 | if move.reconcile_id and move.reconcile_id.line_new_ids: | ||
481 | 569 | for newline in move.reconcile_id.line_new_ids: | ||
482 | 570 | account_move_line_obj.create(cr, uid, { | ||
483 | 571 | 'name': newline.name or move.name, | ||
484 | 572 | 'date': move.date, | ||
485 | 573 | 'ref': move.ref, | ||
486 | 574 | 'move_id': move_id, | ||
487 | 575 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | ||
488 | 576 | 'account_id': (newline.account_id) and newline.account_id.id, | ||
489 | 577 | 'debit': newline.amount>0 and newline.amount or 0.0, | ||
490 | 578 | 'credit': newline.amount<0 and -newline.amount or 0.0, | ||
491 | 579 | 'statement_id': st.id, | ||
492 | 580 | 'journal_id': st.journal_id.id, | ||
493 | 581 | 'period_id': st.period_id.id, | ||
494 | 582 | |||
495 | 583 | }, context=context) | ||
496 | 584 | |||
497 | 585 | amount_currency = False | ||
498 | 586 | currency_id = False | ||
499 | 587 | partner_acc_id = False | ||
500 | 588 | |||
501 | 589 | if st.currency.id <> company_currency_id: | ||
502 | 590 | amount_currency = move.amount | ||
503 | 591 | expense_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.expense_account_id | ||
504 | 592 | revene_acc = res_users_obj.browse(cr, uid, uid, context=context).company_id.revenue_account_id | ||
505 | 593 | currency_id = st.currency.id | ||
506 | 594 | |||
507 | 595 | if move.type=='customer': | ||
508 | 596 | partner_acc_id = move.partner_id.property_account_receivable.id | ||
509 | 597 | elif move.type=='supplier': | ||
510 | 598 | partner_acc_id = move.partner_id.property_account_payable.id | ||
511 | 599 | |||
512 | 600 | for line in move.reconcile_id.line_ids: | ||
513 | 601 | balance = 0.0 | ||
514 | 602 | move_line_data = self.pool.get('account.move.line').browse(cr, uid, line.id, context=context) | ||
515 | 603 | context.update({'amount': move_line_data.amount_currency, 'currency_id': move_line_data.currency_id.id}) | ||
516 | 604 | balance = self.pool.get("account.bank.statement.reconcile").browse(cr, uid, move.reconcile_id.id, context=context).total_balance | ||
517 | 605 | |||
518 | 606 | if balance < 0.00: | ||
519 | 607 | account_move_line_obj.create(cr, uid, { | ||
520 | 608 | 'name': move.name, | ||
521 | 609 | 'date': move.date, | ||
522 | 610 | 'ref': move.ref, | ||
523 | 611 | 'move_id': move_id, | ||
524 | 612 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | ||
525 | 613 | 'account_id': expense_acc.id, | ||
526 | 614 | 'credit': abs(balance), | ||
527 | 615 | 'debit': 0.0, | ||
528 | 616 | 'statement_id': st.id, | ||
529 | 617 | 'journal_id': st.journal_id.id, | ||
530 | 618 | 'period_id': st.period_id.id, | ||
531 | 619 | 'amount_currency': amount_currency, | ||
532 | 620 | 'currency_id': currency_id, | ||
533 | 621 | }, context=context) | ||
534 | 622 | |||
535 | 623 | account_move_line_obj.create(cr, uid, { | ||
536 | 624 | 'name': move.name, | ||
537 | 625 | 'date': move.date, | ||
538 | 626 | 'ref': move.ref, | ||
539 | 627 | 'move_id': move_id, | ||
540 | 628 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | ||
541 | 629 | 'account_id': partner_acc_id, | ||
542 | 630 | 'credit': 0.0, | ||
543 | 631 | 'debit': abs(balance), | ||
544 | 632 | 'statement_id': st.id, | ||
545 | 633 | 'journal_id': st.journal_id.id, | ||
546 | 634 | 'period_id': st.period_id.id, | ||
547 | 635 | 'amount_currency': amount_currency, | ||
548 | 636 | 'currency_id': currency_id, | ||
549 | 637 | }, context=context) | ||
550 | 638 | |||
551 | 639 | elif balance > 0.00: | ||
552 | 640 | account_move_line_obj.create(cr, uid, { | ||
553 | 641 | 'name': move.name, | ||
554 | 642 | 'date': move.date, | ||
555 | 643 | 'ref': move.ref, | ||
556 | 644 | 'move_id': move_id, | ||
557 | 645 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | ||
558 | 646 | 'account_id':revene_acc.id, | ||
559 | 647 | 'credit': abs(balance), | ||
560 | 648 | 'debit': 0.0, | ||
561 | 649 | 'statement_id': st.id, | ||
562 | 650 | 'journal_id': st.journal_id.id, | ||
563 | 651 | 'period_id': st.period_id.id, | ||
564 | 652 | 'amount_currency': amount_currency, | ||
565 | 653 | 'currency_id': currency_id, | ||
566 | 654 | }, context=context) | ||
567 | 655 | |||
568 | 656 | account_move_line_obj.create(cr, uid, { | ||
569 | 657 | 'name': move.name, | ||
570 | 658 | 'date': move.date, | ||
571 | 659 | 'ref': move.ref, | ||
572 | 660 | 'move_id': move_id, | ||
573 | 661 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | ||
574 | 662 | 'account_id': partner_acc_id, | ||
575 | 663 | 'credit': 0.0, | ||
576 | 664 | 'debit': abs(balance), | ||
577 | 665 | 'statement_id': st.id, | ||
578 | 666 | 'journal_id': st.journal_id.id, | ||
579 | 667 | 'period_id': st.period_id.id, | ||
580 | 668 | 'amount_currency': amount_currency, | ||
581 | 669 | 'currency_id': currency_id, | ||
582 | 670 | }, context=context) | ||
583 | 671 | else: | ||
584 | 672 | continue | ||
585 | 673 | |||
586 | 674 | account_move_line_obj.create(cr, uid, { | ||
587 | 675 | 'name': move.name, | ||
588 | 676 | 'date': move.date, | ||
589 | 677 | 'ref': move.ref, | ||
590 | 678 | 'move_id': move_id, | ||
591 | 679 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | ||
592 | 680 | 'account_id': account_id, | ||
593 | 681 | 'credit': ((amount < 0) and -amount) or 0.0, | ||
594 | 682 | 'debit': ((amount > 0) and amount) or 0.0, | ||
595 | 683 | 'statement_id': st.id, | ||
596 | 684 | 'journal_id': st.journal_id.id, | ||
597 | 685 | 'period_id': st.period_id.id, | ||
598 | 686 | 'amount_currency': amount_currency, | ||
599 | 687 | 'currency_id': currency_id, | ||
600 | 688 | }, context=context) | ||
601 | 689 | |||
602 | 690 | for line in account_move_line_obj.browse(cr, uid, [x.id for x in | ||
603 | 691 | account_move_obj.browse(cr, uid, move_id, | ||
604 | 692 | context=context).line_id], | ||
605 | 693 | context=context): | ||
606 | 694 | if line.state <> 'valid': | ||
607 | 695 | raise osv.except_osv(_('Error !'), | ||
608 | 696 | _('Account move line "%s" is not valid') % line.name) | ||
609 | 697 | |||
610 | 698 | if move.reconcile_id and move.reconcile_id.line_ids: | ||
611 | 699 | torec += map(lambda x: x.id, move.reconcile_id.line_ids) | ||
612 | 700 | #try: | ||
613 | 701 | if abs(move.reconcile_amount-move.amount)<0.0001: | ||
614 | 702 | |||
615 | 703 | writeoff_acc_id = False | ||
616 | 704 | #There should only be one write-off account! | ||
617 | 705 | for entry in move.reconcile_id.line_new_ids: | ||
618 | 706 | writeoff_acc_id = entry.account_id.id | ||
619 | 707 | break | ||
620 | 708 | |||
621 | 709 | account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) | ||
622 | 710 | else: | ||
623 | 711 | account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) | ||
624 | 712 | #except: | ||
625 | 713 | # raise osv.except_osv(_('Error !'), _('Unable to reconcile entry "%s": %.2f') % (move.name, move.amount)) | ||
626 | 714 | |||
627 | 715 | if st.journal_id.entry_posted: | ||
628 | 716 | account_move_obj.write(cr, uid, [move_id], {'state':'posted'}) | ||
629 | 717 | done.append(st.id) | ||
630 | 718 | self.write(cr, uid, done, {'state':'confirm'}, context=context) | ||
631 | 719 | |||
632 | 720 | return True | ||
633 | 721 | |||
634 | 722 | account_bank_statement() | ||
635 | 723 | |||
636 | 724 | |||
637 | 430 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 725 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
638 | 431 | 726 | ||
639 | 432 | 727 | ||
640 | === modified file 'account_invoice_cash_discount/account_invoice_cash_discount_view.xml' | |||
641 | --- account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-08-23 12:13:39 +0000 | |||
642 | +++ account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-07-27 10:15:58 +0000 | |||
643 | @@ -47,7 +47,7 @@ | |||
644 | 47 | </field> | 47 | </field> |
645 | 48 | </field> | 48 | </field> |
646 | 49 | </record> | 49 | </record> |
648 | 50 | 50 | ||
649 | 51 | <record id="bank_statement_form_view1" model="ir.ui.view"> | 51 | <record id="bank_statement_form_view1" model="ir.ui.view"> |
650 | 52 | <field name="name">account.bank.statement.form</field> | 52 | <field name="name">account.bank.statement.form</field> |
651 | 53 | <field name="model">account.bank.statement</field> | 53 | <field name="model">account.bank.statement</field> |
652 | @@ -56,10 +56,10 @@ | |||
653 | 56 | <field name="arch" type="xml"> | 56 | <field name="arch" type="xml"> |
654 | 57 | <xpath expr="//button[@string='Import Invoice']" position="replace"> | 57 | <xpath expr="//button[@string='Import Invoice']" position="replace"> |
655 | 58 | <button name="%(wizard_populate_statement_from_inv1)d" type="action" string="Import Invoice" attrs="{'invisible':[('state','=','confirm')]}"/> | 58 | <button name="%(wizard_populate_statement_from_inv1)d" type="action" string="Import Invoice" attrs="{'invisible':[('state','=','confirm')]}"/> |
657 | 59 | </xpath> | 59 | </xpath> |
658 | 60 | </field> | 60 | </field> |
659 | 61 | </record> | 61 | </record> |
661 | 62 | 62 | ||
662 | 63 | <record id="bank_statement_reconcile_form_view1" model="ir.ui.view"> | 63 | <record id="bank_statement_reconcile_form_view1" model="ir.ui.view"> |
663 | 64 | <field name="name">account.bank.statement.reconcile.form</field> | 64 | <field name="name">account.bank.statement.reconcile.form</field> |
664 | 65 | <field name="model">account.bank.statement.reconcile</field> | 65 | <field name="model">account.bank.statement.reconcile</field> |
665 | @@ -68,10 +68,10 @@ | |||
666 | 68 | <field name="arch" type="xml"> | 68 | <field name="arch" type="xml"> |
667 | 69 | <field name="total_new" position="replace"> | 69 | <field name="total_new" position="replace"> |
668 | 70 | <field name="total_new" string="Total Write Off / Cash Discount"/> | 70 | <field name="total_new" string="Total Write Off / Cash Discount"/> |
670 | 71 | </field> | 71 | </field> |
671 | 72 | </field> | 72 | </field> |
672 | 73 | </record> | 73 | </record> |
674 | 74 | 74 | ||
675 | 75 | <record id="bank_statement_reconcile_form_view2" model="ir.ui.view"> | 75 | <record id="bank_statement_reconcile_form_view2" model="ir.ui.view"> |
676 | 76 | <field name="name">account.bank.statement.reconcile.form</field> | 76 | <field name="name">account.bank.statement.reconcile.form</field> |
677 | 77 | <field name="model">account.bank.statement.reconcile</field> | 77 | <field name="model">account.bank.statement.reconcile</field> |
678 | @@ -84,10 +84,10 @@ | |||
679 | 84 | <field name="amount"/> | 84 | <field name="amount"/> |
680 | 85 | <field name="name"/> | 85 | <field name="name"/> |
681 | 86 | </tree> | 86 | </tree> |
683 | 87 | </xpath> | 87 | </xpath> |
684 | 88 | </field> | 88 | </field> |
685 | 89 | </record> | 89 | </record> |
687 | 90 | 90 | ||
688 | 91 | <record id="account_payment_term_line_view1" model="ir.ui.view"> | 91 | <record id="account_payment_term_line_view1" model="ir.ui.view"> |
689 | 92 | <field name="name">account.payment.term.line.form</field> | 92 | <field name="name">account.payment.term.line.form</field> |
690 | 93 | <field name="model">account.payment.term.line</field> | 93 | <field name="model">account.payment.term.line</field> |
691 | @@ -97,9 +97,54 @@ | |||
692 | 97 | <field name="days2" position="after"> | 97 | <field name="days2" position="after"> |
693 | 98 | <field name="compl_cash_discount"/> | 98 | <field name="compl_cash_discount"/> |
694 | 99 | <field name="day_tolerance"/> | 99 | <field name="day_tolerance"/> |
698 | 100 | </field> | 100 | </field> |
699 | 101 | </field> | 101 | </field> |
700 | 102 | </record> | 102 | </record> |
701 | 103 | |||
702 | 104 | <record id="view_res_company_inherit_form" model="ir.ui.view"> | ||
703 | 105 | <field name="name">res.company.inherit.form</field> | ||
704 | 106 | <field name="model">res.company</field> | ||
705 | 107 | <field name="type">form</field> | ||
706 | 108 | <field name="inherit_id" ref="base.view_company_form"/> | ||
707 | 109 | <field name="arch" type="xml"> | ||
708 | 110 | <field name="currency_id" position="after"> | ||
709 | 111 | <field name="expense_account_id"/> | ||
710 | 112 | <field name="revenue_account_id"/> | ||
711 | 113 | </field> | ||
712 | 114 | </field> | ||
713 | 115 | </record> | ||
714 | 116 | |||
715 | 117 | <record id="view_res_company_wizard" model="ir.ui.view"> | ||
716 | 118 | <field name="name">Account set in Company</field> | ||
717 | 119 | <field name="model">res.company.wizard</field> | ||
718 | 120 | <field name="type">form</field> | ||
719 | 121 | <field name="arch" type="xml"> | ||
720 | 122 | <form string="Account Configuration"> | ||
721 | 123 | <field name="expense_account_id"/> | ||
722 | 124 | <field name="revenue_account_id"/> | ||
723 | 125 | <newline/> | ||
724 | 126 | <group col="4" colspan="4"> | ||
725 | 127 | <button icon="gtk-cancel" name="action_cancel" type="object" special="cancel" string="Cancel"/> | ||
726 | 128 | <button icon="gtk-ok" name="set_default" string="Set Default" type="object"/> | ||
727 | 129 | </group> | ||
728 | 130 | </form> | ||
729 | 131 | </field> | ||
730 | 132 | </record> | ||
731 | 133 | |||
732 | 134 | <record id="action_res_company_wizard" model="ir.actions.act_window"> | ||
733 | 135 | <field name="name">Account set in Company</field> | ||
734 | 136 | <field name="type">ir.actions.act_window</field> | ||
735 | 137 | <field name="res_model">res.company.wizard</field> | ||
736 | 138 | <field name="view_type">form</field> | ||
737 | 139 | <field name="view_mode">form</field> | ||
738 | 140 | <field name="target">new</field> | ||
739 | 141 | </record> | ||
740 | 142 | |||
741 | 143 | <record id="config_wizard_res_company_wizard" model="ir.actions.todo"> | ||
742 | 144 | <field name="name">Account set in Company</field> | ||
743 | 145 | <field name="note">This Configuration step use to set default Account</field> | ||
744 | 146 | <field name="action_id" ref="action_res_company_wizard"/> | ||
745 | 147 | </record> | ||
746 | 103 | 148 | ||
747 | 104 | </data> | 149 | </data> |
748 | 105 | </openerp> | 150 | </openerp> |