class orderline_module(models.Model):
_inherit = 'sale.order.line'
def button_function(self):
self.ensure_one()
view = self.env.ref('orderline_module.orderline_wizard_form_view_ext')
return {
'name': ('Vendor Management'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'orderline.wizard',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'context': {'default_active_id': self.id, },
# 'res_id': self.vendor_ids.id,
}
class wizardmodule(models.TransientModel):
_name = 'orderline.wizard'
_description = "orderline wizard"
vendor_lines = fields.One2many('orderline.wizard.detail', 'line_id')
def btnprocess(self):
print(self._context.get('active_id'))
productobj = self.env['sale.order.line'].search([('id', '=', self._context.get('active_id'))]).product_id
# new_line = []
for vendor in productobj.seller_ids:
self.env['orderline.wizard.detail'].create({
'seller_ids': vendor.name.id,
'min_qty': vendor.min_qty,
'price': vendor.price,
'line_id': self.id,
})
class wizardmodule_line(models.TransientModel):
_name = 'orderline.wizard.detail'
line_id = fields.Many2one('orderline.wizard', string='vendors')
seller_ids = fields.Many2one('res.partner', 'product_supplierinfo')
min_qty = fields.Float()
price = fields.Float()
orderline.wizard.form
orderline.wizard