Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
855 Visualizzazioni

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ott 24
1440
1
lug 25
548
3
giu 25
2357
4
lug 25
1121
0
nov 24
1262