Merge branch 'dev_odex25_donation' into you_dev_odex25_donation
This commit is contained in:
commit
78d96c78c5
|
|
@ -23,38 +23,38 @@ jobs:
|
|||
#######################################################
|
||||
# 🟦 1) Allowed Users List
|
||||
#######################################################
|
||||
ALLOWED_USERS=(
|
||||
"expsa"
|
||||
"moutazmuhammad"
|
||||
"ronozoro"
|
||||
"Abubaker-Altaib"
|
||||
"altexp"
|
||||
"the5abir"
|
||||
"ahmadaking"
|
||||
"kchyounes19"
|
||||
"abdurrahman-saber"
|
||||
"maltayyar2"
|
||||
"esam-sermah"
|
||||
"mohammed-alkhazrji"
|
||||
)
|
||||
# ALLOWED_USERS=(
|
||||
# "expsa"
|
||||
# "moutazmuhammad"
|
||||
# "ronozoro"
|
||||
# "Abubaker-Altaib"
|
||||
# "altexp"
|
||||
# "the5abir"
|
||||
# "ahmadaking"
|
||||
# "kchyounes19"
|
||||
# "abdurrahman-saber"
|
||||
# "maltayyar2"
|
||||
# "esam-sermah"
|
||||
# "mohammed-alkhazrji"
|
||||
# )
|
||||
|
||||
IS_ALLOWED="false"
|
||||
for user in "${ALLOWED_USERS[@]}"; do
|
||||
if [[ "$CREATOR" == "$user" ]]; then
|
||||
IS_ALLOWED="true"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# IS_ALLOWED="false"
|
||||
# for user in "${ALLOWED_USERS[@]}"; do
|
||||
# if [[ "$CREATOR" == "$user" ]]; then
|
||||
# IS_ALLOWED="true"
|
||||
# break
|
||||
# fi
|
||||
# done
|
||||
|
||||
if [[ "$IS_ALLOWED" == "false" ]]; then
|
||||
echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..."
|
||||
curl -s -X DELETE \
|
||||
-H "Authorization: token $GH_TOKEN" \
|
||||
https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME
|
||||
exit 1
|
||||
fi
|
||||
# if [[ "$IS_ALLOWED" == "false" ]]; then
|
||||
# echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..."
|
||||
# curl -s -X DELETE \
|
||||
# -H "Authorization: token $GH_TOKEN" \
|
||||
# https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
echo "✔ User '$CREATOR' is allowed."
|
||||
# echo "✔ User '$CREATOR' is allowed."
|
||||
|
||||
#######################################################
|
||||
# 🟦 2) Reserved Branch Names (Your Existing List)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ on:
|
|||
- dev_odex25_helpdesk
|
||||
- dev_odex25_donation
|
||||
- dev_odex25_ensan
|
||||
|
||||
jobs:
|
||||
check_pr_author:
|
||||
runs-on: linting_odex25-standard-modules_runner
|
||||
|
|
@ -74,29 +75,35 @@ jobs:
|
|||
});
|
||||
return;
|
||||
}
|
||||
core.info("All PR authors are allowed.");
|
||||
|
||||
// Check commit authors
|
||||
const commitList = await github.rest.pulls.listCommits({
|
||||
owner,
|
||||
repo,
|
||||
pull_number: pr.number
|
||||
});
|
||||
# // Check commit authors
|
||||
# const commitList = await github.rest.pulls.listCommits({
|
||||
# owner,
|
||||
# repo,
|
||||
# pull_number: pr.number
|
||||
# });
|
||||
|
||||
for (const commit of commitList.data) {
|
||||
const commitAuthor = commit.author ? commit.author.login : null;
|
||||
# core.info("PR author is allowed.");
|
||||
|
||||
if (commitAuthor && !allowed.includes(commitAuthor)) {
|
||||
core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
|
||||
# // Uncomment below if you want to block unauthorized commit authors also
|
||||
# /*
|
||||
# for (const commit of commitList.data) {
|
||||
# const commitAuthor = commit.author ? commit.author.login : null;
|
||||
|
||||
await github.rest.pulls.update({
|
||||
owner,
|
||||
repo,
|
||||
pull_number: pr.number,
|
||||
state: "closed"
|
||||
});
|
||||
# if (commitAuthor && !allowed.includes(commitAuthor)) {
|
||||
# core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
# await github.rest.pulls.update({
|
||||
# owner,
|
||||
# repo,
|
||||
# pull_number: pr.number,
|
||||
# state: "closed"
|
||||
# });
|
||||
|
||||
core.info("All PR authors and committers are allowed.");
|
||||
# return;
|
||||
# }
|
||||
# }
|
||||
|
||||
# core.info("All PR authors and committers are allowed.");
|
||||
# */
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class ProductTemplate_Inherit(models.Model):
|
|||
|
||||
line_ids = self.env['account.move.line'].search([
|
||||
('product_id.product_tmpl_id', 'in', products.ids),
|
||||
('reconciled', '=', True),
|
||||
('move_id.payment_state', '=', 'paid'),
|
||||
('move_id.move_type', '=', 'out_invoice')
|
||||
])
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ class SaleOrder(models.Model):
|
|||
def write(self, vals):
|
||||
if 'order_mobile_number' in vals and not self._context.get('skip_partner_mobile_sync'):
|
||||
vals['order_mobile_number'] = self.phone_format(vals['order_mobile_number'])
|
||||
orders = self.search([('state', '=', 'sale'), ('id', 'not in', self.ids)])
|
||||
numbers = set(orders.mapped('order_mobile_number'))
|
||||
if vals['order_mobile_number'] in numbers:
|
||||
old_orders = self.search([('state', '=', 'sale'), ('id', 'not in', self.ids), ('order_mobile_number', '=', vals['order_mobile_number'])], limit=1, order='id desc')
|
||||
if old_orders:
|
||||
vals['donor_type'] = 'returning'
|
||||
orders.filtered(lambda o: o.order_mobile_number == vals['order_mobile_number']).write({'donor_type': 'returning'})
|
||||
old_orders.write({'donor_type': 'returning'})
|
||||
else:
|
||||
vals['donor_type'] = 'new'
|
||||
partner_sudo = self.env['res.partner'].sudo()
|
||||
|
|
@ -100,24 +99,25 @@ class SaleOrder(models.Model):
|
|||
})
|
||||
|
||||
def action_confirm(self):
|
||||
old_state = self.state
|
||||
res = super().action_confirm()
|
||||
bot = self.env.ref('base.partner_root').id
|
||||
if res:
|
||||
sms_template_id = self.env.ref('ensan_sale_management.sms_template_data_donation')
|
||||
donar_sms_template_id = self.env.ref('ensan_sale_management.sms_template_donors_data_donation')
|
||||
for rec in self:
|
||||
if rec.state == 'sale' and not self._context.get('skip_donation_sms'):
|
||||
if old_state in ('draft', 'sent') and rec.state in ('sale', 'done') and not self._context.get('skip_donation_sms'):
|
||||
if rec.order_mobile_number:
|
||||
rec._message_sms_with_template(
|
||||
template=sms_template_id,
|
||||
put_in_queue=False,
|
||||
put_in_queue=True,
|
||||
partner_ids=rec.partner_id.ids,
|
||||
author_id=bot
|
||||
)
|
||||
for donator in rec.donators_ids:
|
||||
donator._message_sms_with_template(
|
||||
template=donar_sms_template_id,
|
||||
put_in_queue=False,
|
||||
put_in_queue=True,
|
||||
sms_numbers=[donator.donator_mobile_number],
|
||||
author_id=bot
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue