1

I have a wizard defined like this:

    class OrderLineSelectionWizard(models.TransientModel):
        _name = 'order.line.selection.wizard'
        _description = 'Wizard selezione prodotti'
        _rec_name = 'order_id'

        def _get_default_order(self):
            if self.env.context.get('active_id'):
                return self.env.context.get('active_id', False)

        order_id = fields.Many2one('sale.order', 'Ordine', required=True, default=_get_default_order, ondelete='cascade')
        name = fields.Char('Prodotto')
        default_code = fields.Char('Codice')
        runflat = fields.Boolean('Run flat')
        only_with_stock = fields.Boolean('In stock', default=True)
        only_with_local_stock = fields.Boolean('In local stock', default=False)
        stagione_ids = fields.Many2many(comodel_name="mmac_stagione")
        line_ids = fields.One2many('order.line.selection.wizard.detail', 'wizard_id', 'Righe')
        line_supplier_ids = fields.One2many('order.line.selection.wizard.detsupplier', 'wizard_id', 'Righe supplier')


    class OrderLineSelectionWizardDetail(models.TransientModel):
        _name = 'order.line.selection.wizard.detail'
        _description = 'Wizard selezione prodotti dettagli'
        _rec_name = 'product_id'

        wizard_id = fields.Many2one('order.line.selection.wizard', 'Wizard', required=True, ondelete='cascade')
        product_id = fields.Many2one('product.template', 'Prodotto', required=True)
        prodotto = fields.Char(related='product_id.name',store=False)


    class OrderLineSelectionWizardDetailSupplier(models.TransientModel):
        _name = 'order.line.selection.wizard.detsupplier'
        _description = 'Wizard selezione prodotti dettagli supplier stock'
        _rec_name = 'supplier_stock_id'

        wizard_id = fields.Many2one('order.line.selection.wizard', 'Wizard', required=True, ondelete='cascade')
        wizard_detail_id = fields.Many2one('order.line.selection.wizard.detail', 'Wizard Detail', required=True, ondelete='cascade')
        supplier_stock_id = fields.Many2one('product.template.supplier.stock', 'Prodotto', required=True)
        supplier_id = fields.Many2one(related='supplier_stock_id.supplier_id',store=False)
        quotation = fields.Float(related='supplier_stock_id.quotation', store=False)
        stock_qty = fields.Float(related='supplier_stock_id.stock_qty', store=False)
        best_price = fields.Boolean(related='supplier_stock_id.best_price', store=False)

This wizard is called by a button present in the sale.order view.

In the form displaying these three models the line_ids field is displayed as a tree with paging every 10 lines

Is there any way to change the current page number of the line_ids field when I open the form by taking the page number from a field in the sale.order ? And is there any way to be able to update this field every time I switch pages?

thanks Alessandro

I try to use javascript to extend tree view object without success.

  • 1
    I don't see a way to directly do it with Odoo but definitely it's something that could be built to make it work that way – aekis.dev Aug 03 '23 at 16:41

0 Answers0