Skip to content

Commit

Permalink
Merge PR #1035 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Aug 6, 2023
2 parents 986a093 + b3a0bc8 commit b71fbdf
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions pos_order_to_sale_order/static/src/js/CreateOrderPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,38 @@ odoo.define("point_of_sale.CreateOrderPopup", function (require) {
}

async createDraftSaleOrder() {
await this._createSaleOrder("draft");
await this._actionCreateSaleOrder("draft");
}

async createConfirmedSaleOrder() {
await this._createSaleOrder("confirmed");
await this._actionCreateSaleOrder("confirmed");
}

async createDeliveredSaleOrder() {
await this._createSaleOrder("delivered");
await this._actionCreateSaleOrder("delivered");
}

async createInvoicedSaleOrder() {
await this._createSaleOrder("invoiced");
await this._actionCreateSaleOrder("invoiced");
}

async _createSaleOrder(order_state) {
var current_order = this.env.pos.get_order();
async _actionCreateSaleOrder(order_state) {
// Create Sale Order
await this._createSaleOrder(order_state);

framework.blockUI();
// Delete current order
const current_order = this.env.pos.get_order();
this.env.pos.removeOrder(current_order);
this.env.pos.add_new_order();

// Close popup
return await super.confirm();
}

await this.rpc({
async _createSaleOrder(order_state) {
const current_order = this.env.pos.get_order();
framework.blockUI();
return await this.rpc({
model: "sale.order",
method: "create_order_from_pos",
args: [current_order.export_as_JSON(), order_state],
Expand All @@ -43,13 +54,6 @@ odoo.define("point_of_sale.CreateOrderPopup", function (require) {
.finally(function () {
framework.unblockUI();
});

// Delete current order
this.env.pos.removeOrder(current_order);
this.env.pos.add_new_order();

// Close popup
return await super.confirm();
}
}

Expand Down

0 comments on commit b71fbdf

Please sign in to comment.