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



enter image description here



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': }}









share|improve this question
























  • 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















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



enter image description here



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': }}









share|improve this question
























  • 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













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



enter image description here



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': }}









share|improve this question















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



enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen