Browse Source

APR 30: [ADD] Initial commit 'sale_purchase_previous_product_cost'

pull/346/merge
Cybrosys Technologies 3 months ago
parent
commit
da3a58cab2
  1. 4
      auto_save_restrict/__manifest__.py
  2. 4
      auto_save_restrict/doc/RELEASE_NOTES.md
  3. BIN
      auto_save_restrict/static/description/assets/screenshots/ss3.png
  4. 29
      auto_save_restrict/static/description/index.html
  5. 103
      auto_save_restrict/static/src/js/view_button.js

4
auto_save_restrict/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': 'Auto Save Restrict', 'name': 'Auto Save Restrict',
'version': '18.0.1.0.0', 'version': '18.0.1.1.0',
'category': 'Extra Tools', 'category': 'Extra Tools',
'summary': """Restrict auto save in all models""", 'summary': """Restrict auto save in all models""",
'description': 'Using this module,we can restrict' 'description': 'Using this module,we can restrict'
@ -38,6 +38,8 @@
'auto_save_restrict/static/src/js/form_controller.js', 'auto_save_restrict/static/src/js/form_controller.js',
'auto_save_restrict/static/src/js/list_controller.js', 'auto_save_restrict/static/src/js/list_controller.js',
'auto_save_restrict/static/src/js/list_renderer.js', 'auto_save_restrict/static/src/js/list_renderer.js',
'auto_save_restrict/static/src/js/view_button.js',
], ],
}, },
'images': ['static/description/banner.jpg'], 'images': ['static/description/banner.jpg'],

4
auto_save_restrict/doc/RELEASE_NOTES.md

@ -5,3 +5,7 @@
#### ADD #### ADD
- Initial commit for Auto Save Restrict - Initial commit for Auto Save Restrict
#### 30.04.2025
#### Version 18.0.1.1.0
#### UPDATE
- Auto save restrict for smart button

BIN
auto_save_restrict/static/description/assets/screenshots/ss3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

29
auto_save_restrict/static/description/index.html

@ -425,6 +425,35 @@
</div> </div>
</div> </div>
</div> </div>
<div class="position-relative mb-4"
style="border-radius:10px; background-color:#f4f4f4">
<div class="p-md-5 p-3 position-relative">
<div class="row">
<div class="col-md-12">
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px;
font-weight: 700;">
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">In
</span>
<span style="color: #7f54b3; font-size:calc(1.1rem + 1vw)">Smart button</span>
</h1>
</div>
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:#64728f">
The user will see a popup when clicking the smart button, asking whether they want to save their changes that made in the form view.
</p>
</div>
<div class="col-md-12 text-center">
<div class="d-inline-block p-3 shadow-sm"
style="background-color:#fff; border-radius:10px">
<img alt="" class="img-fluid"
loading="lazy"
src="./assets/screenshots/ss3.png"
style="min-height: 1px;">
</div>
</div>
</div>
</div>
</div>
</div> </div>
<div aria-labelledby="feature-tab" <div aria-labelledby="feature-tab"
class="tab-pane fade show py-1" id="feature" class="tab-pane fade show py-1" id="feature"

103
auto_save_restrict/static/src/js/view_button.js

@ -0,0 +1,103 @@
import { patch } from "@web/core/utils/patch";
import { ViewButton } from "@web/views/view_button/view_button";
import { SettingsConfirmationDialog } from "@web/webclient/settings_form_view/settings_confirmation_dialog";
import { useService } from "@web/core/utils/hooks";
import { _t } from "@web/core/l10n/translation";
import { pick } from "@web/core/utils/objects";
patch(ViewButton.prototype, {
setup() {
super.setup(...arguments);
this.dialogService = useService("dialog");
},
async onClick(ev) {
const proceed = await this._confirmSave();
if (!proceed) {
return;
}
if (this.props.tag === "a") {
ev.preventDefault();
}
if (this.props.onClick) {
return this.props.onClick();
}
},
discard() {
const model = this.props.record || this.props.model;
if (!model) {
console.warn("No model available to discard or save.");
return;
}
this.env.onClickViewButton({
clickParams: {
name: "cancel",
type: "object",
special: "cancel",
},
getResParams: () =>
pick(model, "context", "evalContext", "resModel", "resId", "resIds"),
});
},
async _confirmSave() {
let _continue = true;
await new Promise((resolve) => {
this.dialogService.add(SettingsConfirmationDialog, {
body: _t("Would you like to save your changes?"),
confirm: async () => {
// Check if `clickParams` is available
const clickParams = this.clickParams || {
name: "execute",
type: "object",
};
const model = this.props.record || this.props.model;
if (model) {
await this.env.onClickViewButton({
clickParams,
getResParams: () =>
pick(
model,
"context",
"evalContext",
"resModel",
"resId",
"resIds"
),
});
} else {
console.warn("No model available to execute save.");
}
_continue = true;
resolve();
},
cancel: async () => {
const model = this.props.record || this.props.model;
if (model) {
await model?.discard?.();
await model?.save?.();
} else {
console.warn("No model available to discard or save.");
}
_continue = true;
resolve();
},
stayHere: () => {
_continue = false;
resolve();
},
});
});
return _continue;
},
});
Loading…
Cancel
Save