*commit for bazaar

bzr revid: qdp-11752b1069b56beffcceb8d980dc9f34db6ed666
This commit is contained in:
qdp 2008-07-09 11:44:28 +00:00
parent 4864df6759
commit 7af7a5fa1c
2 changed files with 180 additions and 42 deletions

View File

@ -231,6 +231,8 @@ class payment_line(osv.osv):
where pl.id in (%s)"""%
(self.translate(name), ','.join(map(str,ids))) )
res = dict(cr.fetchall())
print "res: ", res
print "name ", name
if name == 'partner_id':
partner_name = {}
@ -314,7 +316,7 @@ class payment_line(osv.osv):
ctx = context.copy()
ctx['date'] = line.order_id.date_done or time.strftime('%Y-%m-%d')
res[line.id] = currency_obj.compute(cursor, user, line.currency.id,
line.company_currency_id.id,
line.company_currency.id,
line.amount_currency, context=ctx)
return res
@ -338,9 +340,46 @@ class payment_line(osv.osv):
else:
return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
def select_move_lines(*a):
print a
return []
# def select_move_lines(*a):
# print a
# return []
# def create(self, cr, uid, vals, context):
# print "created!!!"
# vals['company_currency'] = self._get_currency(cr, uid, context)
# return super(payment_line, self).create(cr, uid, vals, context)
def _get_ml_inv_ref(self, cr, uid, ids, *a):
res={}
for id in self.browse(cr, uid, ids):
res[id.id] = ""
print "test"
if id.move_line_id:
print "blablabl"
res[id.id] = "pas de invoice"
if id.move_line_id.invoice:
res[id.id] = str(id.move_line_id.invoice.number)
if id.move_line_id.invoice.name:
res[id.id] += " " + id.move_line_id.invoice.name
return res
def _get_ml_maturity_date(self, cr, uid, ids, *a):
res={}
for id in self.browse(cr, uid, ids):
if id.move_line_id:
res[id.id] = id.move_line_id.date_maturity
else:
res[id.id] = ""
return res
def _get_ml_created_date(self, cr, uid, ids, *a):
res={}
for id in self.browse(cr, uid, ids):
if id.move_line_id:
res[id.id] = id.move_line_id.date_created
else:
res[id.id] = ""
return res
_columns = {
'name': fields.char('Your Reference', size=64, required=True),
@ -365,19 +404,22 @@ class payment_line(osv.osv):
help='Payment amount in the company currency'),
# 'to_pay': fields.function(select_by_name, string="To Pay", method=True,
# type='float', help='Amount to pay in the company currency'),
'due_date': fields.function(select_by_name, string="Due date",
method=True, type='date'),
'date_created': fields.function(select_by_name, string="Creation date",
method=True, type='date'),
'reference': fields.function(select_by_name, string="Ref", method=True,
type='char'),
# 'due_date': fields.function(select_by_name, string="Due date",
# method=True, type='date'),
'ml_date_created': fields.function(_get_ml_created_date, string="Effective Date",
method=True, type='date',help="Invoice Effective Date"),
# 'reference': fields.function(select_by_name, string="Ref", method=True,
# type='char'),
'ml_maturity_date': fields.function(_get_ml_maturity_date, method=True, type='char', string='Maturity Date'),
'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='char', string='Invoice Ref'),
'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text"),
'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text"),
'partner_payable': fields.function(partner_payable,
string="Partner payable", method=True, type='float'),
'value_date': fields.function(_value_date, string='Value Date',
method=True, type='date'),
# 'value_date': fields.function(_value_date, string='Value Date',
# method=True, type='date'),
'date': fields.date('Payment Date'),
'create_date': fields.datetime('Created' ,readonly=True),
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True)
}
_defaults = {

View File

@ -1,6 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<terp>
<data>
<!-- View used in the wizard -->
<record model="ir.ui.view" id="view_move_line_tree_wiz">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
<field name="type">tree</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<tree string="Account Entry Line">
<field name="partner_id"/>
<field name="ref"/>
<field name="name"/>
<field name="date_maturity"/>
<field name="date"/>
<field name="debit" sum="Total debit"/>
<field name="credit" sum="Total credit"/>
<field name="amount_currency"/>
<field name="currency_id"/>
</tree>
</field>
</record>
<menuitem id="menu_main" name="Payment" parent="account.menu_finance"/>
<record id="view_payment_type_form" model="ir.ui.view">
@ -61,15 +83,76 @@
<field name="date_prefered"/>
<field name="date_planned" select="1"/>
<field name="user_id" select="2"/>
<button colspan="2" name="%(wizard_populate_payment)d" string="Add payment lines" type="action"/>
<field colspan="4" name="line_ids" nolabel="1"/>
<button colspan="2" name="%(wizard_populate_payment)d" string="Select Invoices to Pay" type="action"/>
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1">
<form string="Payment Line">
<notebook>
<page string="Payment">
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)" select="1"/>
<!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
<group colspan="2">
<field name="amount_currency" select="2"/>
<field name="currency" nolabel="1"/>
</group>
<field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
<separator colspan="2" string="Owner Account"/>
<separator colspan="2" string="Desitination Account"/>
<field colspan="2" name="info_owner" nolabel="1"/>
<field colspan="2" name="info_partner" nolabel="1"/>
<field colspan="4" name="communication"/>
<field colspan="4" name="communication2"/>
<field name="name"/>
<field name="state"/>
</page>
<page string="Information">
<separator colspan="4" string="General Information"/>
<group colspan="2">
<field name="amount" select="1"/>
<!--<field name="currency"/>-->
<field name="company_currency" nolabel="1"/>
</group>
<field name="partner_payable"/>
<separator colspan="4" string="Entry Information"/>
<field name="create_date" readonly="1"/>
<field name="ml_maturity_date"/>
<field name="ml_inv_ref"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
</page>
</notebook>
</form>
<tree string="Payment Line"> <!-- editable="bottom" colors="red:to_pay_currency&lt;amount_currency" -->
<field name="ml_inv_ref" />
<field name="partner_id" select="1"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
<field name="ml_maturity_date"/>
<field name="ml_date_created"/>
<!--<field name="value_date"/>-->
<field name="amount" sum="Amount Total"/>
<field name="amount_currency" sum="Currency Amount Total" select="2"/>
<field name="currency"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
<!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
<field name="name"/>
<!--<field name="communication"/>
<field name="state"/>
<field name="date"/>-->
<!-- <field invisible="1" name="to_pay_currency"/>-->
</tree>
</field>
<field name="date_created" select="2"/>
<field name="date_done" select="2"/>
<field name="state" readonly="1" select="1"/>
<group col="4" colspan="2">
<button name="cancel" states="draft,open" string="Cancel"/>
<button name="open" states="draft" string="Open"/>
<button name="%(wizard_pay_payment)d" states="open,done" string="Make Payment" type="action"/>
<button name="%(wizard_pay_payment)d" states="open" string="Make Payment" type="action"/>
<button name="set_to_draft" states="cancel" string="Set to draft" type="object"/>
</group>
</form>
@ -85,7 +168,7 @@
<tree string="Payment order">
<field name="reference"/>
<field name="mode"/>
<field name="line_ids"/>
<!--<field name="line_ids"/>-->
<field name="date_planned"/>
<field name="date_created" select="2"/>
<field name="date_done" select="2"/>
@ -129,16 +212,18 @@
<form string="Payment Line">
<notebook>
<page string="Payment">
<field domain="[('reconcile_id','=', False), ('credit', '&gt;',0)] " name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)" select="1"/>
<field name="order_id" select="1"/>
<!--<field name="reference" />-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)" select="1"/>
<!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
<group colspan="2">
<field name="amount_currency" select="1"/>
<field name="amount_currency" select="2"/>
<field name="currency" nolabel="1"/>
</group>
<field name="partner_id"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
<field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
<separator colspan="2" string="Owner Account"/>
<separator colspan="2" string="Desitination Account"/>
<field colspan="2" name="info_owner" nolabel="1"/>
@ -151,23 +236,23 @@
</page>
<page string="Information">
<separator colspan="2" string="General Information"/>
<separator colspan="2" string="Entry Information"/>
<group col="2" colspan="2">
<separator colspan="4" string="General Information"/>
<group colspan="2">
<field name="amount" select="1"/>
<!--<field name="currency"/>-->
<newline/>
<field name="partner_payable"/>
</group>
<group col="2" colspan="2">
<field name="date_created"/>
<field name="due_date"/>
<field name="to_pay_currency"/>
<field name="to_pay"/>
<!--<field name="currency"/>-->
<field name="company_currency" nolabel="1"/>
</group>
<field name="partner_payable"/>
<separator colspan="4" string="Entry Information"/>
<field name="create_date"/>
<field name="ml_maturity_date"/>
<field name="ml_inv_ref"/>
<!--<field name="due_date"/>-->
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
</page>
</notebook>
</form>
</field>
</record>
@ -177,18 +262,29 @@
<field name="type">tree</field>
<field eval="4" name="priority"/>
<field name="arch" type="xml">
<tree colors="red:to_pay_currency&lt;amount_currency" editable="bottom" string="Payment Line">
<field name="partner_id"/>
<field domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '&gt;', 0)]" name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
<tree string="Payment Line"> <!-- editable="bottom" colors="red:to_pay_currency&lt;amount_currency" -->
<field name="order_id"/>
<field name="ml_inv_ref" />
<field name="ml_maturity_date"/>
<!--<field name="value_date"/>-->
<field name="partner_id" select="1"/>
<field name="amount" sum="Amount Total"/>
<field name="amount_currency" sum="Currency Amount Total" select="2"/>
<field name="currency"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
<!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
<field domain="[('partner_id', '=', partner_id)]" name="bank_id"/>
<field name="amount_currency" sum="Total Amount"/>
<field name="communication"/>
<field name="partner_payable"/>
<field name="create_date"/>
<field name="name"/>
<!--<field name="communication"/>
<field name="state"/>
<field name="date"/>
<field invisible="1" name="to_pay_currency"/>
<field name="date"/>-->
<!-- <field invisible="1" name="to_pay_currency"/>-->
</tree>
</field>