Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wizard
- import pooler
- from osv import osv, fields
- qty1_form = '''<?xml version="1.0"?>
- <form string="Offer Builder">
- <field name="customer_name" />
- <field name="address_invoice" colspan="2" />
- <field name="pricelist" colspan="2" />
- </form>'''
- qty1_fields = {
- 'customer_name' : {'string' : 'Customer Name', 'type' : 'many2one', 'relation' : 'res.partner', 'required':True },
- 'address_invoice': {'string':'Address', 'type':'many2one', 'relation' : 'res.partner.address'},
- 'pricelist': {'string':'Pricelist', 'type':'many2one', 'relation' : 'product.pricelist'},
- }
- def _onchange_partner_id(obj, cursor, user, data, context): #working in log but not returning value to field in form
- pool = pooler.get_pool(cursor.dbname)
- part = data['form']['customer_name']
- print part
- if not part:
- return {'value':{'adresss_invoice': False}}
- addr = pool.get('res.partner').address_get(cursor, user, [part], ['default'])
- part = pool.get('res.partner').browse(cursor, user, part)
- print addr['default']
- return {'value':{'adresss_invoice': addr['default']}}
- class wizard_offer(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'form', 'arch':qty1_form, 'fields':qty1_fields, 'state':[('customer','Continue')]}
- },
- 'customer': {
- 'actions': [_onchange_partner_id],
- 'result': {'type':'form', 'arch':qty1_form, 'fields':qty1_fields, 'state':[('end','Cancel'),('offer','Print')]}
- },
- 'offer': {
- 'actions': [],
- 'result': {'type':'print', 'report':'product.product', 'state':'end'}
- }
- }
- wizard_offer('product.offer_gen')
Add Comment
Please, Sign In to add comment