credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #00140
[Bug 890110] Re: new field default value is calculated only once during initialisation
** Attachment added: "Sequence.png"
https://bugs.launchpad.net/openobject-server/+bug/890110/+attachment/2607992/+files/Sequence.png
--
You received this bug notification because you are a member of OpenERP
Framework Experts, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/890110
Title:
new field default value is calculated only once during initialisation
Status in OpenERP Server:
Confirmed
Bug description:
OpenERP server 6.0.3
Steps to reproduce:
1) create new sequence
<record id="partner_code_sequence_code" model="ir.sequence.type">
<field name="name">Partner code sequence</field>
<field name="code">res.partner.code</field>
</record>
<record id="partner_code_sequence" model="ir.sequence">
<field name="name">Partner code sequence</field>
<field name="code">res.partner.code</field>
<field name="active">True</field>
<field name="prefix"></field>
<field name="padding">9</field>
<field name="number_increment">1</field>
<field name="number_next">1</field>
</record>
2) inherit res.partner, add new field with default value from sequence
class res_partner(osv.osv):
_inherit='res.partner'
_columns = {
'code': fields.char('Code', 9, required=True),
}
_defaults = {
'code': lambda self, cr, uid, *a: self.pool.get('ir.sequence').get(
cr, uid, 'res.partner.code'),
}
res_partner()
3) update database
Actual result: all existing partners have code "000000001"
Expected result: value of 'code' field calculated for each partner
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/890110/+subscriptions