← Back to team overview

openerp-community team mailing list archive

Re: How would you create a OEv6.1 Duplicate button?

 

Thanks Serpent Consulting Services; that helps!

So I've implemented this xml in a new module:

        <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" type="object"
string="Duplicate"/>
                    </group>
                </group>
            </field>
        </record>

And the Duplicate push button appears (though it's a bit big, I'm wondering
how to reduce it to normal size.) When I push the button I get:

OpenERP Server Error

------------------------------

Client Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py",
line 180, in dispatch
    response["result"] = method(controller, self, **self.params)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py",
line 1052, in call_button
    action = self.call_common(req, model, method, args, domain_id, context_id)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py",
line 996, in call_common
    return self._call_kw(req, model, method, args, {})
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py",
line 1010, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/openerplib/main.py",
line 250, in proxy
    args, kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/openerplib/main.py",
line 117, in proxy
    result = self.connector.send(self.service_name, method, *args)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py",
line 608, in send
    raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)


Server Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/common/http.py",
line 593, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 360, in
dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py",
line 586, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 167, in
execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 164, in
execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4769, in copy
    data = self.copy_data(cr, uid, id, default, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4649,
in copy_data
    data = self.read(cr, uid, [id,], context=context_wo_lang)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3416, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3467,
in _read_flat
    for sub_ids in cr.split_for_in_conditions(ids):
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 244, in
split_for_in_conditions
    return tools.misc.split_every(self.IN_MAX, set(ids))
TypeError: unhashable type: 'list'


I'm wondering what the "TypeError: unhashable type: 'list'" is in reference
to?
Dale




On Mon, Apr 1, 2013 at 11:09 AM, Serpent Consulting Services <
serpentcs.lp@xxxxxxxxx> wrote:

>  Dale,
>
> Welcome!
>
> The copy_data does a Copy of given record's data with all its fields
> values! (except translations)
>
> The copy() does it all (default values +  new values + translations)!
>
> Thanks.
>
>
> On Monday 01 April 2013 09:34 PM, Dale E. Moore wrote:
>
> Thanks Er. Jay Vora;
>
>  I appreciate your insight!
>
>  I've noticed some modules have copy_data(), would that be the preferred
> method?
>
>  I appreciate your time,
> DaleEMoore@xxxxxxxxx
>
>
> On Mon, Apr 1, 2013 at 2:58 AM, Er. Jay Vora <jay.vora4ce@xxxxxxxxx>wrote:
>
>>   Dale,
>>
>>  O2M does not have a duplicate button.
>>
>>  You have to put a button on list view of o2m bank and call copy()!
>>
>>  Thanks.
>>
>>
>>  On Sun, Mar 31, 2013 at 10:55 PM, Dale E. Moore <daleemoore@xxxxxxxxx>wrote:
>>
>>>   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 the duplicate button that exists for Customers, Products, Projects,
>>> and so many other objects in OpenERP?
>>>
>>>  _______________________________________________
>>> Mailing list: https://launchpad.net/~openerp-community
>>> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~openerp-community
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>>
>> Thanks,
>> Regards,
>>
>> *Er. Jay Vora*
>> M : 91 - 9879354457.
>> (Not miles, just an email away...)
>> Twitter <http://twitter.com/#%21/jaynvora> Facebook<http://www.facebook.com/jaynvora>
>> LinkedIn <http://www.linkedin.com/in/jaynvora> Blogger<http://jayvora.blogspot.com>
>> "No Seconds to be Wasted for Formalities, I have a lot to Execute !" -
>> Jay Vora
>>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>
>
> --
>
> Thanks,
> Regards,
>
> Serpent Consulting Services.
> Web : http://www.serpentcs.com
> Twitter: jaynvora, husendaudi
> Skype: jaynvora, husen.daudi
> Blog : http://www.serpentcs.com/blog
>

JPEG image


Follow ups

References