Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CalculoPapelStart(ModelView):
- 'Modelo Wizard Calculo Papel'
- _name = 'sale_imprenta.calculo.papel.start'
- producto_papel = fields.One2Many('product.template','products' ,u'Papel',
- domain=[('category', '=', Id('sale_imprenta', 'cat_papel'))],
- required=True, readonly=False,
- )
- 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()
- def transition_buscar_papel(self, session):
- return 'seleccion'
- def default_seleccion(self, session, fields):
- pool = Pool()
- product_obj = pool.get('product.template')
- line_obj = pool.get('sale.line')
- product = product_obj.search([])
- pro = product_obj.browse(product)[0]
- res = {
- 'producto_papel': {},
- }
- ## TODO: I want to relate some products to my One2Many field producto_papel
- res['producto_papel'].setdefault('add', [product])
- return res
- 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