Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
868 Lượt xem

Hello,


I have an appointment button in POS session when click on it the POS order line is created with appointment details however when reload the page or change the qty, the price return back to the price related to the product and ignore the one I set during the creation.

const line_values = {
pos: this.pos,
order: this.pos.get_order(),
product: appointment.is_package ? this.pos.db.get_product_by_id(line.product_id) : this.pos.db.get_product_by_id(line.product_id[0]),
description: line.name,
price: appointment.is_package ? line.price : appointment.price,
price_manually_set: true,
resource_names: appointment.is_package ? await this._getResourceNames(line.resource_ids) : appointment.resource_id[1],
resource_ids: appointment.is_package ? await line.resource_ids : [appointment.resource_id[0]],
appointment_origin_id: clickedAppointment,
customer_note: line.description ? line.description : "",
};
const new_line = new Orderline({ env: this.env }, line_values); new_line.setQuantityFromService(qty);
new_line.set_unit_price(line_values.price);
this.pos.get_order().add_orderline(new_line);


class BusinessAppointment(models.Model):
_inherit = "business.appointment"



membership_id = fields.Many2one('customer.membership', string='Customer Membership', readonly= True, domain="[('partner_id', '=', partner_id),('status','=','active')]")
membership_package= fields.Many2one(related='membership_id.membership_package_id')
has_membership = fields.Boolean(string="Has Membership", compute='_compute_has_membership', store=False)
price = fields.Float(String="price", compute="get_price", store=False, )
service_price= fields.Float(String="price",)

@api.depends("service_id", "membership_id")
def get_price(self):
for rec in self:
rec.price = rec.service_id.product_id.lst_price
if rec.membership_id:
for consumed_service in rec.membership_id.consumed_service_ids:
if rec.service_id.product_id == consumed_service.product_id and consumed_service.remaining_times > 0:
rec.price = 0.0
break

how can Make the price not changed when reload the page or change the qty

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 24
1448
1
thg 7 25
568
3
thg 6 25
2362
Change resume view Đã xử lý
4
thg 7 25
1121
0
thg 11 24
1262