8713-testToMaster #3523
|
@ -113,7 +113,11 @@ module.exports = Self => {
|
||||||
const salesPerson = sale.ticket().client().salesPersonUser();
|
const salesPerson = sale.ticket().client().salesPersonUser();
|
||||||
if (salesPerson) {
|
if (salesPerson) {
|
||||||
const url = await Self.app.models.Url.getUrl();
|
const url = await Self.app.models.Url.getUrl();
|
||||||
const ticketWeekly = await models.Sale.ticketWeekly(sale.id);
|
|
||||||
|
const saleCloned = await Self.app.models.SaleCloned.findById(sale.id, {
|
||||||
|
include: 'saleOriginal',
|
||||||
|
});
|
||||||
|
const ticketWeekly = saleCloned?.saleOriginal()?.ticketFk || null;
|
||||||
|
|
||||||
const message = $t('Changed sale price', {
|
const message = $t('Changed sale price', {
|
||||||
ticketId: sale.ticket().id,
|
ticketId: sale.ticket().id,
|
||||||
|
|
|
@ -72,7 +72,12 @@ module.exports = Self => {
|
||||||
const salesPerson = sale.ticket().client().salesPersonUser();
|
const salesPerson = sale.ticket().client().salesPersonUser();
|
||||||
if (salesPerson) {
|
if (salesPerson) {
|
||||||
const url = await Self.app.models.Url.getUrl();
|
const url = await Self.app.models.Url.getUrl();
|
||||||
const ticketWeekly = await models.Sale.ticketWeekly(sale.id);
|
|
||||||
|
const saleCloned = await Self.app.models.SaleCloned.findById(sale.id, {
|
||||||
|
include: 'saleOriginal',
|
||||||
|
});
|
||||||
|
const ticketWeekly = saleCloned?.saleOriginal()?.ticketFk || null;
|
||||||
|
|
||||||
const change = $t('Changes in sales', {
|
const change = $t('Changes in sales', {
|
||||||
itemId: sale.itemFk,
|
itemId: sale.itemFk,
|
||||||
concept: sale.concept,
|
concept: sale.concept,
|
||||||
|
|
|
@ -166,8 +166,12 @@ module.exports = Self => {
|
||||||
const salesPerson = ticket.client().salesPersonUser();
|
const salesPerson = ticket.client().salesPersonUser();
|
||||||
if (salesPerson) {
|
if (salesPerson) {
|
||||||
const url = await Self.app.models.Url.getUrl();
|
const url = await Self.app.models.Url.getUrl();
|
||||||
|
|
||||||
const saleId = sales[0].id;
|
const saleId = sales[0].id;
|
||||||
const ticketWeekly = await models.Sale.ticketWeekly(saleId);
|
const saleCloned = await Self.app.models.SaleCloned.findById(saleId, {
|
||||||
|
include: 'saleOriginal',
|
||||||
|
});
|
||||||
|
const ticketWeekly = saleCloned?.saleOriginal()?.ticketFk || null;
|
||||||
|
|
||||||
const message = $t('Changed sale discount', {
|
const message = $t('Changed sale discount', {
|
||||||
ticketId: id,
|
ticketId: id,
|
||||||
|
|
|
@ -136,19 +136,5 @@ module.exports = Self => {
|
||||||
if (!saleGrouping?.newPrice || saleGrouping.newPrice > instance.price)
|
if (!saleGrouping?.newPrice || saleGrouping.newPrice > instance.price)
|
||||||
throw new UserError('The price of the item changed');
|
throw new UserError('The price of the item changed');
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.ticketWeekly = async function(saleId) {
|
|
||||||
const SaleCloned = Self.app.models.SaleCloned;
|
|
||||||
|
|
||||||
const saleCloned2 = await SaleCloned.findOne({
|
|
||||||
where: {
|
|
||||||
saleClonedFk: saleId
|
|
||||||
},
|
|
||||||
include: {
|
|
||||||
relation: 'saleOriginal'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return saleCloned2?.saleOriginal()?.ticketFk || null;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue