Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CalculoPapelProducto(ModelSQL, ModelView):
- 'Modelo Wizard Calculo Papel'
- _name = 'sale_imprenta.producto'
- #Campos definidos en modelo product.template
- orientacion = fields.Selection([
- ('H', 'Horizontal'),
- ('V', 'Vertical'),
- ], u'Orientación')
- cantidad_hojas_necesarias = fields.Integer('Cantidad de Hojas')
- desperdicio = fields.Numeric('Desperdicio', digits=(3, 2))
- paginas_por_hoja = fields.Integer('Paginas por Hoja')
- name = fields.Char('Name', size=None, translate=True,
- select=True)
- producto = fields.Many2One('product.template', 'Producto',
- select=True)
- height = fields.Float('Height', digits=(16, 2))
- width = fields.Float('Width', digits=(16, 2))
- id_wizard = fields.Integer('id del wizard')
- CalculoPapelProducto()
- class CalculoPapelStart(ModelView):
- 'Modelo Wizard Calculo Papel'
- _name = 'sale_imprenta.calculo.papel.start'
- producto_papel = fields.Many2One('sale_imprenta.producto',u'Papel',
- domain=[('id_wizard', '=', Get(Eval('context', {}), 'active_id', '0'))],
- required=False
- )
- #######
- ## The domain it's not working :(
- CalculoPapelStart()
- class CalculoPapel(Wizard):
- 'Wizard Calcular Papel'
- _name = 'sale_imprenta.calculo.papel'
- start = StateView('sale_imprenta.calculo.papel.start',
- 'sale_imprenta.calculo_papel_start_view_form', [
- Button('Cancelar', 'end', 'tryton-cancel'),
- Button('Siguiente', 'buscar_papel', 'tryton-go-next', True),
- ])
- buscar_papel = StateTransition()
- seleccion = StateView('sale_imprenta.calculo.papel.start',
- 'sale_imprenta.calculo_papel_seleccion_view_form', [
- Button('Cancelar', 'end', 'tryton-cancel'),
- Button('Atras', 'volver_start', 'tryton-go-previous'),
- Button('Finalizar', 'terminar', 'tryton-ok', True),
- ])
- volver_start = StateTransition()
- terminar = StateTransition()
- def transition_buscar_papel(self, session):
- return 'seleccion'
- def default_seleccion(self, session, fields):
- res = {}
- pool = Pool()
- wiz_obj = pool.get('sale_imprenta.calculo.papel.start')
- t = Transaction()
- id_wizard = t.context.get('active_id')
- producto_wiz_obj = pool.get('sale_imprenta.producto')
- producto_wiz_obj.create({'name':'Basura '+ str(id_wizard), 'id_wizard': id_wizard})
- return res
- def default_start(self, session, fields):
- return session.data['start']
- def transition_volver_start(self, session):
- return 'start'
- def transition_terminar(self, session):
- return 'end'
- CalculoPapel()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement