Merge lp:~openbig/bigconsulting/milestone2_manually_entries into lp:bigconsulting
- milestone2_manually_entries
- Merge into addons
Proposed by
gpa(OpenERP)
Status: | Superseded |
---|---|
Proposed branch: | lp:~openbig/bigconsulting/milestone2_manually_entries |
Merge into: | lp:bigconsulting |
Diff against target: |
182 lines (+85/-10) 2 files modified
account_invoice_cash_discount/account_invoice_cash_discount.py (+46/-10) account_invoice_cash_discount/account_invoice_cash_discount_view.xml (+39/-0) |
To merge this branch: | bzr merge lp:~openbig/bigconsulting/milestone2_manually_entries |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
openbig | Pending | ||
Review via email: mp+31817@code.launchpad.net |
This proposal has been superseded by a proposal from 2010-08-05.
Commit message
Description of the change
changes added for milestone2 for manually entries
To post a comment you must log in.
- 64. By gpa(OpenERP)
-
changes in tax compute
Unmerged revisions
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-08-03 12:11:28 +0000 | |||
3 | +++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-08-05 07:58:42 +0000 | |||
4 | @@ -529,6 +529,7 @@ | |||
5 | 529 | 529 | ||
6 | 530 | def button_confirm(self, cr, uid, ids, context={}): | 530 | def button_confirm(self, cr, uid, ids, context={}): |
7 | 531 | done = [] | 531 | done = [] |
8 | 532 | tax_obj = self.pool.get('account.tax') | ||
9 | 532 | res_currency_obj = self.pool.get('res.currency') | 533 | res_currency_obj = self.pool.get('res.currency') |
10 | 533 | res_users_obj = self.pool.get('res.users') | 534 | res_users_obj = self.pool.get('res.users') |
11 | 534 | account_move_obj = self.pool.get('account.move') | 535 | account_move_obj = self.pool.get('account.move') |
12 | @@ -579,10 +580,15 @@ | |||
13 | 579 | amount = res_currency_obj.compute(cr, uid, st.currency.id, | 580 | amount = res_currency_obj.compute(cr, uid, st.currency.id, |
14 | 580 | company_currency_id, move.amount, context=context, | 581 | company_currency_id, move.amount, context=context, |
15 | 581 | account=acc_cur) | 582 | account=acc_cur) |
16 | 582 | # if move.reconcile_id and move.reconcile_id.line_new_ids: | ||
17 | 583 | # for newline in move.reconcile_id.line_new_ids: | ||
18 | 584 | # amount += newline.amount | ||
19 | 585 | 583 | ||
20 | 584 | st_tax_amount = 0.00 | ||
21 | 585 | st_base_code_id = False | ||
22 | 586 | |||
23 | 587 | if move.tax_id: | ||
24 | 588 | tax = tax_obj.compute(cr, uid, [move.tax_id], move.amount, 1.00)[0] | ||
25 | 589 | st_tax_amount = tax['amount'] | ||
26 | 590 | st_base_code_id = tax['base_code_id'] | ||
27 | 591 | |||
28 | 586 | val = { | 592 | val = { |
29 | 587 | 'name': move.name, | 593 | 'name': move.name, |
30 | 588 | 'date': move.date, | 594 | 'date': move.date, |
31 | @@ -596,8 +602,10 @@ | |||
32 | 596 | 'journal_id': st.journal_id.id, | 602 | 'journal_id': st.journal_id.id, |
33 | 597 | 'period_id': st.period_id.id, | 603 | 'period_id': st.period_id.id, |
34 | 598 | 'currency_id': st.currency.id, | 604 | 'currency_id': st.currency.id, |
35 | 605 | 'tax_code_id':st_base_code_id, | ||
36 | 606 | 'account_tax_id':move.tax_id.id, | ||
37 | 607 | 'tax_amount':move.amount, | ||
38 | 599 | } | 608 | } |
39 | 600 | |||
40 | 601 | amount = res_currency_obj.compute(cr, uid, st.currency.id, | 609 | amount = res_currency_obj.compute(cr, uid, st.currency.id, |
41 | 602 | company_currency_id, move.amount, context=context, | 610 | company_currency_id, move.amount, context=context, |
42 | 603 | account=acc_cur) | 611 | account=acc_cur) |
43 | @@ -617,7 +625,8 @@ | |||
44 | 617 | account=acc_cur) | 625 | account=acc_cur) |
45 | 618 | val['amount_currency'] = amount_cur | 626 | val['amount_currency'] = amount_cur |
46 | 619 | 627 | ||
48 | 620 | torec.append(account_move_line_obj.create(cr, uid, val , context=context)) | 628 | torec.append(account_move_line_obj.create(cr, uid, val, context=context)) |
49 | 629 | |||
50 | 621 | newline_sum = 0.0 | 630 | newline_sum = 0.0 |
51 | 622 | if move.reconcile_id and move.reconcile_id.line_new_ids: | 631 | if move.reconcile_id and move.reconcile_id.line_new_ids: |
52 | 623 | for newline in move.reconcile_id.line_new_ids: | 632 | for newline in move.reconcile_id.line_new_ids: |
53 | @@ -723,7 +732,7 @@ | |||
54 | 723 | 'amount_currency': amount_currency, | 732 | 'amount_currency': amount_currency, |
55 | 724 | 'currency_id': currency_id, | 733 | 'currency_id': currency_id, |
56 | 725 | }, context=context) | 734 | }, context=context) |
58 | 726 | 735 | ||
59 | 727 | account_move_line_obj.create(cr, uid, { | 736 | account_move_line_obj.create(cr, uid, { |
60 | 728 | 'name': move.name, | 737 | 'name': move.name, |
61 | 729 | 'date': move.date, | 738 | 'date': move.date, |
62 | @@ -731,8 +740,8 @@ | |||
63 | 731 | 'move_id': move_id, | 740 | 'move_id': move_id, |
64 | 732 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, | 741 | 'partner_id': ((move.partner_id) and move.partner_id.id) or False, |
65 | 733 | 'account_id': account_id, | 742 | 'account_id': account_id, |
68 | 734 | 'credit': (((amount-newline_sum) < 0) and -(amount-newline_sum)) or 0.0, | 743 | 'credit': (((amount+st_tax_amount-newline_sum) < 0) and -(amount+st_tax_amount-newline_sum)) or 0.0, |
69 | 735 | 'debit': (((amount-newline_sum) > 0) and (amount-newline_sum)) or 0.0, | 744 | 'debit': (((amount+st_tax_amount-newline_sum) > 0) and (amount+st_tax_amount-newline_sum)) or 0.0, |
70 | 736 | 'statement_id': st.id, | 745 | 'statement_id': st.id, |
71 | 737 | 'journal_id': st.journal_id.id, | 746 | 'journal_id': st.journal_id.id, |
72 | 738 | 'period_id': st.period_id.id, | 747 | 'period_id': st.period_id.id, |
73 | @@ -740,10 +749,15 @@ | |||
74 | 740 | 'currency_id': currency_id, | 749 | 'currency_id': currency_id, |
75 | 741 | }, context=context) | 750 | }, context=context) |
76 | 742 | 751 | ||
77 | 752 | account_move_line_obj.write(cr, uid, [x.id for x in | ||
78 | 753 | account_move_obj.browse(cr, uid, move_id, | ||
79 | 754 | context=context).line_id], {'statement_id': st.id,}) | ||
80 | 755 | |||
81 | 743 | for line in account_move_line_obj.browse(cr, uid, [x.id for x in | 756 | for line in account_move_line_obj.browse(cr, uid, [x.id for x in |
82 | 744 | account_move_obj.browse(cr, uid, move_id, | 757 | account_move_obj.browse(cr, uid, move_id, |
83 | 745 | context=context).line_id], | 758 | context=context).line_id], |
84 | 746 | context=context): | 759 | context=context): |
85 | 760 | |||
86 | 747 | if line.state <> 'valid': | 761 | if line.state <> 'valid': |
87 | 748 | raise osv.except_osv(_('Error !'), | 762 | raise osv.except_osv(_('Error !'), |
88 | 749 | _('Account move line "%s" is not valid') % line.name) | 763 | _('Account move line "%s" is not valid') % line.name) |
89 | @@ -752,13 +766,11 @@ | |||
90 | 752 | torec += map(lambda x: x.id, move.reconcile_id.line_ids) | 766 | torec += map(lambda x: x.id, move.reconcile_id.line_ids) |
91 | 753 | #try: | 767 | #try: |
92 | 754 | if abs(move.reconcile_amount-move.amount)<0.0001: | 768 | if abs(move.reconcile_amount-move.amount)<0.0001: |
93 | 755 | |||
94 | 756 | writeoff_acc_id = False | 769 | writeoff_acc_id = False |
95 | 757 | #There should only be one write-off account! | 770 | #There should only be one write-off account! |
96 | 758 | for entry in move.reconcile_id.line_new_ids: | 771 | for entry in move.reconcile_id.line_new_ids: |
97 | 759 | writeoff_acc_id = entry.account_id.id | 772 | writeoff_acc_id = entry.account_id.id |
98 | 760 | break | 773 | break |
99 | 761 | |||
100 | 762 | 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) | 774 | 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) |
101 | 763 | else: | 775 | else: |
102 | 764 | account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) | 776 | account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) |
103 | @@ -774,6 +786,30 @@ | |||
104 | 774 | 786 | ||
105 | 775 | account_bank_statement() | 787 | account_bank_statement() |
106 | 776 | 788 | ||
107 | 789 | class account_bank_statement_line(osv.osv): | ||
108 | 790 | _inherit="account.bank.statement.line" | ||
109 | 791 | |||
110 | 792 | def _get_account(self, cr, uid, context={}): | ||
111 | 793 | account_id = self.pool.get('account.account').search(cr, uid, [('type','!=','view')])[0] | ||
112 | 794 | if account_id: | ||
113 | 795 | return account_id | ||
114 | 796 | else: | ||
115 | 797 | return False | ||
116 | 798 | |||
117 | 799 | def _get_tax(self, cr, uid, context={}): | ||
118 | 800 | tax_id = self.pool.get('account.tax').search(cr, uid, []) | ||
119 | 801 | if tax_id: | ||
120 | 802 | return tax_id[0] | ||
121 | 803 | else: | ||
122 | 804 | return False | ||
123 | 805 | _columns = { | ||
124 | 806 | 'tax_id': fields.many2one('account.tax', 'Tax'), | ||
125 | 807 | } | ||
126 | 808 | _defaults = { | ||
127 | 809 | 'account_id': _get_account, | ||
128 | 810 | 'tax_id': _get_tax, | ||
129 | 811 | } | ||
130 | 812 | account_bank_statement_line() | ||
131 | 777 | 813 | ||
132 | 778 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 814 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
133 | 779 | 815 | ||
134 | 780 | 816 | ||
135 | === modified file 'account_invoice_cash_discount/account_invoice_cash_discount_view.xml' | |||
136 | --- account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-08-03 12:11:28 +0000 | |||
137 | +++ account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-08-05 07:58:42 +0000 | |||
138 | @@ -162,5 +162,44 @@ | |||
139 | 162 | <field name="action_id" ref="action_res_company_wizard"/> | 162 | <field name="action_id" ref="action_res_company_wizard"/> |
140 | 163 | </record> | 163 | </record> |
141 | 164 | 164 | ||
142 | 165 | <record id="view_move_line_tree1" model="ir.ui.view"> | ||
143 | 166 | <field name="name">account.move.line.tree</field> | ||
144 | 167 | <field name="model">account.move.line</field> | ||
145 | 168 | <field name="type">tree</field> | ||
146 | 169 | <field eval="1" name="priority"/> | ||
147 | 170 | <field name="inherit_id" ref="account.view_move_line_tree"/> | ||
148 | 171 | <field name="arch" type="xml"> | ||
149 | 172 | <field name="account_tax_id" position="after"> | ||
150 | 173 | <field name="tax_code_id"/> | ||
151 | 174 | <field name="tax_amount"/> | ||
152 | 175 | </field> | ||
153 | 176 | </field> | ||
154 | 177 | </record> | ||
155 | 178 | |||
156 | 179 | <record model="ir.ui.view" id="view_bank_statement_form111"> | ||
157 | 180 | <field name="name">account.bank.statement.form1</field> | ||
158 | 181 | <field name="model">account.bank.statement</field> | ||
159 | 182 | <field name="inherit_id" ref="account.view_bank_statement_form" /> | ||
160 | 183 | <field name="type">form</field> | ||
161 | 184 | <field name="arch" type="xml"> | ||
162 | 185 | <xpath expr="//field[@name='line_ids']/form/field[@name='ref']" position="after"> | ||
163 | 186 | <field name="tax_id"/> | ||
164 | 187 | </xpath> | ||
165 | 188 | </field> | ||
166 | 189 | </record> | ||
167 | 190 | |||
168 | 191 | <record model="ir.ui.view" id="view_bank_statement_form222"> | ||
169 | 192 | <field name="name">account.bank.statement.tree1</field> | ||
170 | 193 | <field name="model">account.bank.statement</field> | ||
171 | 194 | <field name="inherit_id" ref="account.view_bank_statement_form" /> | ||
172 | 195 | <field name="type">form</field> | ||
173 | 196 | <field name="arch" type="xml"> | ||
174 | 197 | <xpath expr="//field[@name='line_ids']/tree/field[@name='reconcile_amount']" position="after"> | ||
175 | 198 | <field name="tax_id"/> | ||
176 | 199 | </xpath> | ||
177 | 200 | </field> | ||
178 | 201 | </record> | ||
179 | 202 | |||
180 | 203 | |||
181 | 165 | </data> | 204 | </data> |
182 | 166 | </openerp> | 205 | </openerp> |