Settings, Companies, Companies, Bank Accounts does not have a duplicate button.
How would I create a push button that would duplicate a Bank Account like exists for Customers, Products, Projects, and so many other objects in OpenERP?
I've heard you "put a button on list view of o2m bank and call copy()!" Because "copy() does it all (default values + new values + translations)!" So this goes in my view.xml:
<record id="view_partner_bank_form_inherit_dale" model="ir.ui.view">
<field name="name">Dale Bank Accounts - Journal</field>
<field name="model">res.partner.bank</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_bank_form"/>
<field name="arch" type="xml">
<group name="bank" position="after">
<group name="accounting" col="2" colspan="2" attrs="{'invisible': [('company_id','=', False)]}" groups="base.group_extended">
<separator string="Duplicate" colspan="2"/>
<button name="copy_bank" type="object" string="Duplicate"/>
</group>
</group>
</field>
</record>
The button size is a bit large and I hear that "col, colspan; will adjust the size" then this goes in my bank.py:
class bank(osv.osv):
_inherit = "res.partner.bank"
def copy_bank(self, cr, uid, ids, context=None):
for rec in self.browse(cr, uid, ids, context):
self.copy(cr,uid, rec.id , {},context)
return True
bank()
and everything works lovely.
I'd just like to move the Duplicate button up onto the same line with the Close button.
Hi Dale, you should not use the reserved keyword "copy" as a name of your method. Secondly it will be nice if you can post the python code that you have written for this method.