Browse Source

Oct 13 : [UPDT] Bug Fixed 'edit_save_button'

pull/295/head
AjmalCybro 2 years ago
parent
commit
b4ecc6bafb
  1. 7
      edit_save_button/__manifest__.py
  2. 5
      edit_save_button/doc/RELEASE_NOTES.md
  3. 13
      edit_save_button/static/src/views/form/form_controller.js
  4. 35
      edit_save_button/views/product_views.xml

7
edit_save_button/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': 'Edit Button In Odoo16', 'name': 'Edit Button In Odoo16',
'version': '16.0.1.0.1', 'version': '16.0.1.0.2',
'summary': 'Edit Button Odoo16', 'summary': 'Edit Button Odoo16',
'description': 'Edit Button in Odoo16', 'description': 'Edit Button in Odoo16',
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
@ -30,7 +30,10 @@
'maintainer': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions',
'images': ['static/description/banner.png'], 'images': ['static/description/banner.png'],
'website': 'https://www.cybrosys.com', 'website': 'https://www.cybrosys.com',
'depends': ['base'], 'depends': ['base', 'product'],
'data': [
'views/product_views.xml',
],
'assets': { 'assets': {
'web.assets_backend': [ 'web.assets_backend': [
'/edit_save_button/static/src/views/form/form_controller.js', '/edit_save_button/static/src/views/form/form_controller.js',

5
edit_save_button/doc/RELEASE_NOTES.md

@ -11,3 +11,8 @@
#### Fix #### Fix
- Bug fixed - Bug fixed
#### 10.10.2023
#### Version 16.0.1.0.2
#### Fix
- Bug fixed

13
edit_save_button/static/src/views/form/form_controller.js

@ -20,6 +20,7 @@ var data = false;
patch(FormController.prototype, "save",{ patch(FormController.prototype, "save",{
setup() { setup() {
data = false;
this.props.preventEdit = !data this.props.preventEdit = !data
this._super(); this._super();
}, },
@ -38,6 +39,16 @@ patch(FormController.prototype, "save",{
this._super(); this._super();
data = false; data = false;
await this.model.root.switchMode("readonly"); await this.model.root.switchMode("readonly");
} },
async beforeLeave() {
if (this.model.root.isDirty) {
if (confirm("The changes you have made will save Automatically!")) {
return this.model.root.save({noReload: true, stayInEdition: true});
} else {
this.model.root.discard();
return true;
}
}
}
}) })

35
edit_save_button/views/product_views.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="view_product_form_inherit_">
<field name="name">view.product.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='group_standard_price']" position='replace'>
<group name="group_standard_price">
<label for="list_price"/>
<div name="pricing">
<field name="list_price" class="oe_inline" widget='monetary'
options="{'currency_field': 'currency_id', 'field_digits': True}"/>
</div>
<label for="standard_price" attrs="{'invisible': [('product_variant_count', '&gt;', 1), ('is_product_variant', '=', False)]}"/>
<div name="standard_price_uom" style="display: flex;" attrs="{'invisible': [('product_variant_count', '&gt;', 1), ('is_product_variant', '=', False)]}">
<field name="standard_price" class="oe_inline" widget='monetary' options="{'currency_field': 'cost_currency_id', 'field_digits': True}"/>
<div style="margin-left:10px;">
<span groups="uom.group_uom">per
<field name="uom_name" class="oe_inline"/>
</span>
</div>
</div>
<field name="categ_id" string="Product Category"/>
<field name="product_tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
<field name="company_id" groups="base.group_multi_company"
options="{'no_create': True}"/>
<field name="currency_id" invisible="1"/>
<field name="cost_currency_id" invisible="1"/>
<field name="product_variant_id" invisible="1"/>
</group>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save