3
0
Fork 0

[FIX] web_widget_one2many_product_picker: Update qty counter

13.0
Alexandre D. Díaz 2021-04-15 20:25:38 +02:00
parent 8c128aa3bf
commit 098df6a08f
3 changed files with 10 additions and 1 deletions

View File

@ -257,6 +257,9 @@ odoo.define(
this.trigger_up("create_quick_record", { this.trigger_up("create_quick_record", {
id: record.id, id: record.id,
callback: () => { callback: () => {
this.model.updateRecordContext(this.handle, {
saving: false,
});
this.model.unsetDirty(this.handle); this.model.unsetDirty(this.handle);
// Self._updateButtons(); // Self._updateButtons();
this._enableQuickCreate(); this._enableQuickCreate();

View File

@ -552,6 +552,7 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRecord", fu
this.trigger_up("create_quick_record", { this.trigger_up("create_quick_record", {
id: record.id, id: record.id,
callback: () => { callback: () => {
model.updateRecordContext(this.state.id, {saving: false});
this.$card this.$card
.find(".o_catch_attention") .find(".o_catch_attention")
.removeClass("o_catch_attention"); .removeClass("o_catch_attention");
@ -625,6 +626,11 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRecord", fu
// sends a creation with qty 1 but can still add more qty mean while // sends a creation with qty 1 but can still add more qty mean while
// wait for the Odoo response. // wait for the Odoo response.
const model_record_data = model.localData[this.state.id].data; const model_record_data = model.localData[this.state.id].data;
if (
_.isNull(model_record_data[this.options.fieldMap.product_uom_qty])
) {
model_record_data[this.options.fieldMap.product_uom_qty] = 1;
}
model_record_data[this.options.fieldMap.product_uom_qty] += amount; model_record_data[this.options.fieldMap.product_uom_qty] += amount;
return model return model
.notifyChanges(record.id, { .notifyChanges(record.id, {

View File

@ -99,7 +99,7 @@
t-attf-class="oe_flip_card_front p-0 {{((modified || is_saving) && 'border-warning') || (state && !is_virtual && 'border-success') || ''}}" t-attf-class="oe_flip_card_front p-0 {{((modified || is_saving) && 'border-warning') || (state && !is_virtual && 'border-success') || ''}}"
> >
<t t-if="state"> <t t-if="state">
<t t-if="is_saving || lazy_qty > 0"> <t t-if="is_saving &amp;&amp; lazy_qty > 0">
<div <div
class="safezone position-absolute m-0 pb-2 pr-2 text-left" class="safezone position-absolute m-0 pb-2 pr-2 text-left"
> >