summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/promotion/promotion_program_line.py1
-rw-r--r--indoteknik_custom/models/purchasing_job_multi_update.py13
-rw-r--r--indoteknik_custom/models/stock_picking.py5
3 files changed, 15 insertions, 4 deletions
diff --git a/indoteknik_custom/models/promotion/promotion_program_line.py b/indoteknik_custom/models/promotion/promotion_program_line.py
index 4bf50ac9..34b70ca5 100644
--- a/indoteknik_custom/models/promotion/promotion_program_line.py
+++ b/indoteknik_custom/models/promotion/promotion_program_line.py
@@ -32,6 +32,7 @@ class PromotionProgramLine(models.Model):
order_promotion_ids = fields.One2many('sale.order.promotion', 'program_line_id', 'Promotions')
active = fields.Boolean(string="Active", default=True)
solr_flag = fields.Integer(string="Solr Flag", default=1)
+ description = fields.Char('Description')
def get_active_promotions(self, product_id):
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py
index 65feba71..0145b112 100644
--- a/indoteknik_custom/models/purchasing_job_multi_update.py
+++ b/indoteknik_custom/models/purchasing_job_multi_update.py
@@ -14,12 +14,17 @@ class PurchasingJobMultiUpdate(models.TransientModel):
for product in products:
# if product.status_apo == 'apo':
# raise UserError('Ada Purchase Order yang statusnya APO, proses dulu')
- purchasing_job_state = self.env['purchasing.job.state']
- purchasing_job_state.create({
+ purchasing_job_state = self.env['purchasing.job.state'].search([
+ ('purchasing_job_id', '=', product.id),
+ ('status_apo', '=', 'apo')
+ ])
+
+ if not purchasing_job_state:
+ purchasing_job_state.create({
'purchasing_job_id': product.id,
'status_apo': 'apo',
- })
-
+ })
+
apo = self.env['automatic.purchase'].generate_regular_purchase(products)
return {
'name': _('Automatic Purchase'),
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 9b4fffb1..22aceaf4 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -86,6 +86,11 @@ class StockPicking(models.Model):
date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True)
sale_order = fields.Char(string='Matches SO', copy=False)
+ @api.onchange('carrier_id')
+ def constrains_carrier_id(self):
+ if not self.env.user.is_logistic_approver:
+ raise UserError('Hanya Logistic yang bisa mengubah shipping method')
+
def do_unreserve(self):
res = super(StockPicking, self).do_unreserve()
current_time = datetime.datetime.utcnow()