Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
1037 Zobrazení

Hello,

when i am on the sale.order form to create a new sale.order

I select the customer and click to add a new line.

On the sale.order.line form, i added a button to open an other website

If the sale.order is already created, no problem

But if the sale.order is not created yet, i've got this error :

" The operation cannot be completed: - Create/update: a mandatory field is not set. - Delete: another model requires the record being deleted. If possible, archive it instead. Model: Sales Order Line (sale.order.line), Field: Order Reference (order_id)"

I understand that i need to create the SO before but i just want to open an other website (not odoo) on an other tab.

Is there a way to avoid this control ?

Vincent

Avatar
Zrušit
Nejlepší odpověď

Hello,

I believe that the order_id inside the sale.order.line will always be linked to sale.order. Since you are not yet creating the sale.order, the sale.order.line can never be created since it depends on the id of the sale.order itself as "foreign key".

The sale.order and sale.order.line model you inherited might using the model.Models so it needed to be saved first. If you wish to click on your button without creating sale.order, you might want to make that sale.order.line into a transient.Models instead

Best regards,

Altela (altelasoftware.com)

Avatar
Zrušit
Autor Nejlepší odpověď

Hello Altela,

Thank you for your answer, i will study transient model to know what it is.

In the same way, if i click on my button before select a product in the sale.order.line form, there is a red warning like below

And i don't understand why i need to create S.O and S.O.L or create those elements to open a website (like google.com) in an other browser tab!?


UPDATE :

Here a screen capture below

I create a new sale order and just select a customer

Then, i click on "Add a product"

And in the form of the sale.order.line, i added 2 buttons to open a website with python function like this :

return {
'type': 'ir.actions.act_url',
'target': 'new',
'url': url_interface,
}


Avatar
Zrušit

I'm a bit curious about where you put the button that open other website. could you please attach the image of it please?