account_payment_tab move to account module
bzr revid: mra@tinyerp.com-20080912072122-4fzuwtbr3krrrbk7
This commit is contained in:
parent
e834a50810
commit
da5e2f7918
|
@ -122,6 +122,7 @@
|
|||
<field name="currency_id"/>
|
||||
<field name="date_invoice"/>
|
||||
<field name="date_due" select="1"/>
|
||||
<field name="residual"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -181,6 +182,7 @@
|
|||
<button colspan="2" name="button_compute" states="draft" string="Compute" type="object"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="residual"/>
|
||||
<field name="state" select="2"/>
|
||||
<group col="3" colspan="4">
|
||||
<button name="invoice_open" states="draft,proforma" string="Validate"/>
|
||||
|
@ -206,6 +208,9 @@
|
|||
<separator colspan="4" string="Additionnal Information"/>
|
||||
<field colspan="4" name="comment" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Payments">
|
||||
<field name="move_lines" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -251,6 +256,7 @@
|
|||
<button colspan="2" name="button_compute" states="draft" string="Compute" type="object"/>
|
||||
<field name="amount_total"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="residual"/>
|
||||
<field name="state" select="2"/>
|
||||
<group col="3" colspan="4">
|
||||
<button name="invoice_proforma" states="draft" string="PRO-FORMA"/>
|
||||
|
@ -276,6 +282,9 @@
|
|||
<separator colspan="4" string="Additionnal Information"/>
|
||||
<field colspan="4" name="comment" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Payments">
|
||||
<field name="move_lines" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
@ -98,6 +98,35 @@ class account_invoice(osv.osv):
|
|||
def _get_reference_type(self, cursor, user, context=None):
|
||||
return [('none', 'Free Reference')]
|
||||
|
||||
def _amount_residual(self, cr, uid, ids, name, args, context={}):
|
||||
res = {}
|
||||
data_inv = self.browse(cr, uid, ids)
|
||||
for inv in data_inv:
|
||||
paid_amt = 0.0
|
||||
to_pay = inv.amount_total
|
||||
for lines in inv.move_lines:
|
||||
paid_amt = paid_amt + lines.credit
|
||||
res[inv.id] = to_pay - paid_amt
|
||||
return res
|
||||
|
||||
def _get_lines(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for id in ids:
|
||||
move_lines = self.move_line_id_payment_get(cr,uid,[id])
|
||||
if not move_lines:
|
||||
res[id] = []
|
||||
continue
|
||||
data_lines = self.pool.get('account.move.line').browse(cr,uid,move_lines)
|
||||
for line in data_lines:
|
||||
ids_line = []
|
||||
if line.reconcile_id:
|
||||
ids_line = line.reconcile_id.line_id
|
||||
elif line.reconcile_partial_id:
|
||||
ids_line = line.reconcile_partial_id.line_partial_ids
|
||||
l = map(lambda x: x.id, ids_line)
|
||||
res[id]=[x for x in l if x <> line.id]
|
||||
return res
|
||||
|
||||
_name = "account.invoice"
|
||||
_description = 'Invoice'
|
||||
_order = "number"
|
||||
|
@ -151,6 +180,9 @@ class account_invoice(osv.osv):
|
|||
'reconciled': fields.function(_reconciled, method=True, string='Paid/Reconciled', type='boolean'),
|
||||
'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
help='The bank account to pay to or to be paid from'),
|
||||
'move_lines':fields.function(_get_lines , method=True,type='many2many' , relation='account.move.line',string='Move Lines'),
|
||||
'residual': fields.function(_amount_residual, method=True, digits=(16,2),string='Residual', store=True),
|
||||
|
||||
}
|
||||
_defaults = {
|
||||
'type': _get_type,
|
||||
|
|
Loading…
Reference in New Issue