Merge lp:~openbig/bigconsulting/milestone2_manually_entries into lp:bigconsulting

Proposed by gpa(OpenERP)
Status: Merged
Merged at revision: 62
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
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+31821@code.launchpad.net

This proposal supersedes a proposal from 2010-08-05.

Description of the change

changes added for milestone2 for manually entries

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_invoice_cash_discount/account_invoice_cash_discount.py'
--- account_invoice_cash_discount/account_invoice_cash_discount.py 2010-08-03 12:11:28 +0000
+++ account_invoice_cash_discount/account_invoice_cash_discount.py 2010-08-05 07:58:42 +0000
@@ -529,6 +529,7 @@
529529
530 def button_confirm(self, cr, uid, ids, context={}):530 def button_confirm(self, cr, uid, ids, context={}):
531 done = []531 done = []
532 tax_obj = self.pool.get('account.tax')
532 res_currency_obj = self.pool.get('res.currency')533 res_currency_obj = self.pool.get('res.currency')
533 res_users_obj = self.pool.get('res.users')534 res_users_obj = self.pool.get('res.users')
534 account_move_obj = self.pool.get('account.move')535 account_move_obj = self.pool.get('account.move')
@@ -579,10 +580,15 @@
579 amount = res_currency_obj.compute(cr, uid, st.currency.id,580 amount = res_currency_obj.compute(cr, uid, st.currency.id,
580 company_currency_id, move.amount, context=context,581 company_currency_id, move.amount, context=context,
581 account=acc_cur)582 account=acc_cur)
582# if move.reconcile_id and move.reconcile_id.line_new_ids:
583# for newline in move.reconcile_id.line_new_ids:
584# amount += newline.amount
585583
584 st_tax_amount = 0.00
585 st_base_code_id = False
586
587 if move.tax_id:
588 tax = tax_obj.compute(cr, uid, [move.tax_id], move.amount, 1.00)[0]
589 st_tax_amount = tax['amount']
590 st_base_code_id = tax['base_code_id']
591
586 val = {592 val = {
587 'name': move.name,593 'name': move.name,
588 'date': move.date,594 'date': move.date,
@@ -596,8 +602,10 @@
596 'journal_id': st.journal_id.id,602 'journal_id': st.journal_id.id,
597 'period_id': st.period_id.id,603 'period_id': st.period_id.id,
598 'currency_id': st.currency.id,604 'currency_id': st.currency.id,
605 'tax_code_id':st_base_code_id,
606 'account_tax_id':move.tax_id.id,
607 'tax_amount':move.amount,
599 }608 }
600
601 amount = res_currency_obj.compute(cr, uid, st.currency.id,609 amount = res_currency_obj.compute(cr, uid, st.currency.id,
602 company_currency_id, move.amount, context=context,610 company_currency_id, move.amount, context=context,
603 account=acc_cur)611 account=acc_cur)
@@ -617,7 +625,8 @@
617 account=acc_cur)625 account=acc_cur)
618 val['amount_currency'] = amount_cur626 val['amount_currency'] = amount_cur
619627
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))
629
621 newline_sum = 0.0630 newline_sum = 0.0
622 if move.reconcile_id and move.reconcile_id.line_new_ids:631 if move.reconcile_id and move.reconcile_id.line_new_ids:
623 for newline in move.reconcile_id.line_new_ids:632 for newline in move.reconcile_id.line_new_ids:
@@ -723,7 +732,7 @@
723 'amount_currency': amount_currency,732 'amount_currency': amount_currency,
724 'currency_id': currency_id,733 'currency_id': currency_id,
725 }, context=context)734 }, context=context)
726735
727 account_move_line_obj.create(cr, uid, {736 account_move_line_obj.create(cr, uid, {
728 'name': move.name,737 'name': move.name,
729 'date': move.date,738 'date': move.date,
@@ -731,8 +740,8 @@
731 'move_id': move_id,740 'move_id': move_id,
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,
733 'account_id': account_id,742 'account_id': account_id,
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,
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,
736 'statement_id': st.id,745 'statement_id': st.id,
737 'journal_id': st.journal_id.id,746 'journal_id': st.journal_id.id,
738 'period_id': st.period_id.id,747 'period_id': st.period_id.id,
@@ -740,10 +749,15 @@
740 'currency_id': currency_id,749 'currency_id': currency_id,
741 }, context=context)750 }, context=context)
742751
752 account_move_line_obj.write(cr, uid, [x.id for x in
753 account_move_obj.browse(cr, uid, move_id,
754 context=context).line_id], {'statement_id': st.id,})
755
743 for line in account_move_line_obj.browse(cr, uid, [x.id for x in756 for line in account_move_line_obj.browse(cr, uid, [x.id for x in
744 account_move_obj.browse(cr, uid, move_id,757 account_move_obj.browse(cr, uid, move_id,
745 context=context).line_id],758 context=context).line_id],
746 context=context):759 context=context):
760
747 if line.state <> 'valid':761 if line.state <> 'valid':
748 raise osv.except_osv(_('Error !'),762 raise osv.except_osv(_('Error !'),
749 _('Account move line "%s" is not valid') % line.name)763 _('Account move line "%s" is not valid') % line.name)
@@ -752,13 +766,11 @@
752 torec += map(lambda x: x.id, move.reconcile_id.line_ids)766 torec += map(lambda x: x.id, move.reconcile_id.line_ids)
753 #try:767 #try:
754 if abs(move.reconcile_amount-move.amount)<0.0001:768 if abs(move.reconcile_amount-move.amount)<0.0001:
755
756 writeoff_acc_id = False769 writeoff_acc_id = False
757 #There should only be one write-off account!770 #There should only be one write-off account!
758 for entry in move.reconcile_id.line_new_ids:771 for entry in move.reconcile_id.line_new_ids:
759 writeoff_acc_id = entry.account_id.id772 writeoff_acc_id = entry.account_id.id
760 break773 break
761
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)
763 else:775 else:
764 account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context)776 account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context)
@@ -774,6 +786,30 @@
774786
775account_bank_statement()787account_bank_statement()
776788
789class account_bank_statement_line(osv.osv):
790 _inherit="account.bank.statement.line"
791
792 def _get_account(self, cr, uid, context={}):
793 account_id = self.pool.get('account.account').search(cr, uid, [('type','!=','view')])[0]
794 if account_id:
795 return account_id
796 else:
797 return False
798
799 def _get_tax(self, cr, uid, context={}):
800 tax_id = self.pool.get('account.tax').search(cr, uid, [])
801 if tax_id:
802 return tax_id[0]
803 else:
804 return False
805 _columns = {
806 'tax_id': fields.many2one('account.tax', 'Tax'),
807 }
808 _defaults = {
809 'account_id': _get_account,
810 'tax_id': _get_tax,
811 }
812account_bank_statement_line()
777813
778# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:814# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
779815
780816
=== modified file 'account_invoice_cash_discount/account_invoice_cash_discount_view.xml'
--- account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-08-03 12:11:28 +0000
+++ account_invoice_cash_discount/account_invoice_cash_discount_view.xml 2010-08-05 07:58:42 +0000
@@ -162,5 +162,44 @@
162 <field name="action_id" ref="action_res_company_wizard"/>162 <field name="action_id" ref="action_res_company_wizard"/>
163 </record>163 </record>
164164
165 <record id="view_move_line_tree1" model="ir.ui.view">
166 <field name="name">account.move.line.tree</field>
167 <field name="model">account.move.line</field>
168 <field name="type">tree</field>
169 <field eval="1" name="priority"/>
170 <field name="inherit_id" ref="account.view_move_line_tree"/>
171 <field name="arch" type="xml">
172 <field name="account_tax_id" position="after">
173 <field name="tax_code_id"/>
174 <field name="tax_amount"/>
175 </field>
176 </field>
177 </record>
178
179 <record model="ir.ui.view" id="view_bank_statement_form111">
180 <field name="name">account.bank.statement.form1</field>
181 <field name="model">account.bank.statement</field>
182 <field name="inherit_id" ref="account.view_bank_statement_form" />
183 <field name="type">form</field>
184 <field name="arch" type="xml">
185 <xpath expr="//field[@name='line_ids']/form/field[@name='ref']" position="after">
186 <field name="tax_id"/>
187 </xpath>
188 </field>
189 </record>
190
191 <record model="ir.ui.view" id="view_bank_statement_form222">
192 <field name="name">account.bank.statement.tree1</field>
193 <field name="model">account.bank.statement</field>
194 <field name="inherit_id" ref="account.view_bank_statement_form" />
195 <field name="type">form</field>
196 <field name="arch" type="xml">
197 <xpath expr="//field[@name='line_ids']/tree/field[@name='reconcile_amount']" position="after">
198 <field name="tax_id"/>
199 </xpath>
200 </field>
201 </record>
202
203
165 </data>204 </data>
166</openerp>205</openerp>

Subscribers

People subscribed via source and target branches