How to creat records in odoo tree view onclick button?
up vote
1
down vote
favorite
please help
I need when I click Enregistrer Button to create those fields in the tree view on the bottom
for this example, I have quantity equal 12 so I need 12 lines to be created on the tree view with the values on the wizard view
the wizard code :
class LinesWizard(models.Model):
_name = 'bons.wizard'
w_contrat_name = fields.Many2one('contrat.contrat', string='Contrat')
w_contrat_line = fields.Many2one('contrat.lignes', string='Ligne contrat')
w_product_name = fields.Many2one('product.product', string='Produit')
w_po_number = fields.Char(string='Numero PO')
w_qtt = fields.Float('quantite', related='w_contrat_line.quantity')
w_prix = fields.Float(string='Prix unitaire', related='w_contrat_line.unit_price')
@api.onchange('w_contrat_name')
def on_change_contrat_name(self):
if self.w_contrat_name:
self.w_contrat_line = False
return {'domain': {'w_contrat_line' : [('ligne_ids', '=', self.w_contrat_name.id)]}}
else:
return {'domain': {'w_contrat_line': }}
odoo odoo-10 odoo-9
|
show 2 more comments
up vote
1
down vote
favorite
please help
I need when I click Enregistrer Button to create those fields in the tree view on the bottom
for this example, I have quantity equal 12 so I need 12 lines to be created on the tree view with the values on the wizard view
the wizard code :
class LinesWizard(models.Model):
_name = 'bons.wizard'
w_contrat_name = fields.Many2one('contrat.contrat', string='Contrat')
w_contrat_line = fields.Many2one('contrat.lignes', string='Ligne contrat')
w_product_name = fields.Many2one('product.product', string='Produit')
w_po_number = fields.Char(string='Numero PO')
w_qtt = fields.Float('quantite', related='w_contrat_line.quantity')
w_prix = fields.Float(string='Prix unitaire', related='w_contrat_line.unit_price')
@api.onchange('w_contrat_name')
def on_change_contrat_name(self):
if self.w_contrat_name:
self.w_contrat_line = False
return {'domain': {'w_contrat_line' : [('ligne_ids', '=', self.w_contrat_name.id)]}}
else:
return {'domain': {'w_contrat_line': }}
odoo odoo-10 odoo-9
How did you open the wizard by a button. And why you are using a wizard for this.is it because you hate creating lines in the tree view. And is this view for a custom model or sale.order
– Cherif
23 hours ago
To open the wizard I create a button on the header of sale.order , and why wizard, because is a request of the work they need to create a multi-tree line in one click, depends on the quantity And this view sale.order @Cherif
– Mahmoud
20 hours ago
Can you show a minimum code to reproduce this?
– WaKo
19 hours ago
@WaKo done , I add the wizard code
– Mahmoud
19 hours ago
You can add a button to fill the order lines from the wizard.Odoo already provided a good example at odoo.com/documentation/10.0/howtos/…
– WaKo
19 hours ago
|
show 2 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
please help
I need when I click Enregistrer Button to create those fields in the tree view on the bottom
for this example, I have quantity equal 12 so I need 12 lines to be created on the tree view with the values on the wizard view
the wizard code :
class LinesWizard(models.Model):
_name = 'bons.wizard'
w_contrat_name = fields.Many2one('contrat.contrat', string='Contrat')
w_contrat_line = fields.Many2one('contrat.lignes', string='Ligne contrat')
w_product_name = fields.Many2one('product.product', string='Produit')
w_po_number = fields.Char(string='Numero PO')
w_qtt = fields.Float('quantite', related='w_contrat_line.quantity')
w_prix = fields.Float(string='Prix unitaire', related='w_contrat_line.unit_price')
@api.onchange('w_contrat_name')
def on_change_contrat_name(self):
if self.w_contrat_name:
self.w_contrat_line = False
return {'domain': {'w_contrat_line' : [('ligne_ids', '=', self.w_contrat_name.id)]}}
else:
return {'domain': {'w_contrat_line': }}
odoo odoo-10 odoo-9
please help
I need when I click Enregistrer Button to create those fields in the tree view on the bottom
for this example, I have quantity equal 12 so I need 12 lines to be created on the tree view with the values on the wizard view
the wizard code :
class LinesWizard(models.Model):
_name = 'bons.wizard'
w_contrat_name = fields.Many2one('contrat.contrat', string='Contrat')
w_contrat_line = fields.Many2one('contrat.lignes', string='Ligne contrat')
w_product_name = fields.Many2one('product.product', string='Produit')
w_po_number = fields.Char(string='Numero PO')
w_qtt = fields.Float('quantite', related='w_contrat_line.quantity')
w_prix = fields.Float(string='Prix unitaire', related='w_contrat_line.unit_price')
@api.onchange('w_contrat_name')
def on_change_contrat_name(self):
if self.w_contrat_name:
self.w_contrat_line = False
return {'domain': {'w_contrat_line' : [('ligne_ids', '=', self.w_contrat_name.id)]}}
else:
return {'domain': {'w_contrat_line': }}
odoo odoo-10 odoo-9
odoo odoo-10 odoo-9
edited 19 hours ago
asked yesterday
Mahmoud
719
719
How did you open the wizard by a button. And why you are using a wizard for this.is it because you hate creating lines in the tree view. And is this view for a custom model or sale.order
– Cherif
23 hours ago
To open the wizard I create a button on the header of sale.order , and why wizard, because is a request of the work they need to create a multi-tree line in one click, depends on the quantity And this view sale.order @Cherif
– Mahmoud
20 hours ago
Can you show a minimum code to reproduce this?
– WaKo
19 hours ago
@WaKo done , I add the wizard code
– Mahmoud
19 hours ago
You can add a button to fill the order lines from the wizard.Odoo already provided a good example at odoo.com/documentation/10.0/howtos/…
– WaKo
19 hours ago
|
show 2 more comments
How did you open the wizard by a button. And why you are using a wizard for this.is it because you hate creating lines in the tree view. And is this view for a custom model or sale.order
– Cherif
23 hours ago
To open the wizard I create a button on the header of sale.order , and why wizard, because is a request of the work they need to create a multi-tree line in one click, depends on the quantity And this view sale.order @Cherif
– Mahmoud
20 hours ago
Can you show a minimum code to reproduce this?
– WaKo
19 hours ago
@WaKo done , I add the wizard code
– Mahmoud
19 hours ago
You can add a button to fill the order lines from the wizard.Odoo already provided a good example at odoo.com/documentation/10.0/howtos/…
– WaKo
19 hours ago
How did you open the wizard by a button. And why you are using a wizard for this.is it because you hate creating lines in the tree view. And is this view for a custom model or sale.order
– Cherif
23 hours ago
How did you open the wizard by a button. And why you are using a wizard for this.is it because you hate creating lines in the tree view. And is this view for a custom model or sale.order
– Cherif
23 hours ago
To open the wizard I create a button on the header of sale.order , and why wizard, because is a request of the work they need to create a multi-tree line in one click, depends on the quantity And this view sale.order @Cherif
– Mahmoud
20 hours ago
To open the wizard I create a button on the header of sale.order , and why wizard, because is a request of the work they need to create a multi-tree line in one click, depends on the quantity And this view sale.order @Cherif
– Mahmoud
20 hours ago
Can you show a minimum code to reproduce this?
– WaKo
19 hours ago
Can you show a minimum code to reproduce this?
– WaKo
19 hours ago
@WaKo done , I add the wizard code
– Mahmoud
19 hours ago
@WaKo done , I add the wizard code
– Mahmoud
19 hours ago
You can add a button to fill the order lines from the wizard.Odoo already provided a good example at odoo.com/documentation/10.0/howtos/…
– WaKo
19 hours ago
You can add a button to fill the order lines from the wizard.Odoo already provided a good example at odoo.com/documentation/10.0/howtos/…
– WaKo
19 hours ago
|
show 2 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53365654%2fhow-to-creat-records-in-odoo-tree-view-onclick-button%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How did you open the wizard by a button. And why you are using a wizard for this.is it because you hate creating lines in the tree view. And is this view for a custom model or sale.order
– Cherif
23 hours ago
To open the wizard I create a button on the header of sale.order , and why wizard, because is a request of the work they need to create a multi-tree line in one click, depends on the quantity And this view sale.order @Cherif
– Mahmoud
20 hours ago
Can you show a minimum code to reproduce this?
– WaKo
19 hours ago
@WaKo done , I add the wizard code
– Mahmoud
19 hours ago
You can add a button to fill the order lines from the wizard.Odoo already provided a good example at odoo.com/documentation/10.0/howtos/…
– WaKo
19 hours ago