In any record, when I select duplicates Odoo creates a duplicate even if I do not save (DISCARD).
this is true for anything; be it contacts, product, sales orders, BOM, operation, etc,
I expect a duplicate ONLY if I save.
using odoo14
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
In any record, when I select duplicates Odoo creates a duplicate even if I do not save (DISCARD).
this is true for anything; be it contacts, product, sales orders, BOM, operation, etc,
I expect a duplicate ONLY if I save.
using odoo14
This is by design. The "Duplicate" in Action menu is calling the copy() method and direct to edit enable view mode.
To accomplish what you like, you could create a custom button with corresponding function.
This function should return a window action to form view with context and default_field.
Should look like this
def action_duplicate(self):
self.ensure_one()
context = {
'default_field_1': self.field_1,
'default_field_2': self.field_2,
'default_field_3': self.field_3,
......
......
...... and so on
}
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'model.name',
'views': [(self.env.ref('module_name.form_view_xml_id').id, 'form')],
'view_id': self.env.ref('module_name.form_view_xml_id').id,
'target': 'current',
'context': context,
}
If you hit save, record is duplicated, discard will have nothing happen since you only open a form with default value.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Nov 24
|
1484 | ||
|
1
Nov 24
|
1191 | ||
|
2
Sep 24
|
1047 | ||
Update stock quantity
Solved
|
|
1
Aug 24
|
2453 | |
|
3
Aug 24
|
2687 |