跳至內容
選單
此問題已被標幟
2555 瀏覽次數

Hi,


I think there are some addons that can add booking feature but I want to implement it myself.


I am new to Odoo and I am trying to simulate a Booking feature in the Odoo webshop where customers can book a product, get a booking confirmation that they can print and use to collect the product in person from the store.


My products have a zero price so when a customer add them to the shopping cart and proceed to checkout then a quotation is created. This draft quotation does not update the webshop stock value which is a problem. The stock values is only updated when the quotation is manually confirmed to a sale order.


I used the following method to update the webshop stock. I used "Automated Actions" on a Sale order and a python script to auto confirm the draft quotation. The webshop stock is indeed updated but as a side effect the customer no longer gets the order confirmation page after confirming the shopping cart.


# My python script in Sale order automated action

for rec in records:

  if rec.user_id.id == odooBotUserId and not rec.partner_id.id == publicUserPartnerId and rec.state == "draft" and rec.team_id.id == websiteTeamId and rec.amount_total <= 0:

   rec.action_confirm()


Any suggestions or ideas on how to implement this booking feature in a better way?

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 25
905
2
11月 24
2136
1
9月 24
1180
4
2月 24
12263
1
1月 24
1636