diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-05-17 02:50:46 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-05-17 02:50:46 +0000 |
| commit | 3d3cb07ee778c445b2f6be361a8749dab27822ec (patch) | |
| tree | 3036c34392651fa07ad14977b87d2863a0cbb5cf | |
| parent | 844339e517540826f6990456a63945dc879e37d5 (diff) | |
| parent | 39c13cc7ebe48344e3088bc5bb921458ba4f7972 (diff) | |
Merged in production (pull request #142)
Production
5 files changed, 23 insertions, 4 deletions
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py index 957d49c7..948ecd03 100644 --- a/indoteknik_api/controllers/api_v1/sale_order.py +++ b/indoteknik_api/controllers/api_v1/sale_order.py @@ -52,6 +52,7 @@ class SaleOrder(controller.Controller): params = self.get_request_params(kw, { 'partner_id': ['number'], 'name': [], + 'site': [], 'limit': ['default:0', 'number'], 'offset': ['default:0', 'number'], 'context': [] @@ -80,6 +81,12 @@ class SaleOrder(controller.Controller): ('partner_purchase_order_name', 'ilike', '%' + name + '%') ] + if params['value']['site']: + site = params['value']['site'].replace(' ', '%') + domain += [ + ('partner_id.site_id.name', 'ilike', '%' + site + '%') + ] + sale_orders = request.env['sale.order'].search( domain, offset=offset, limit=limit) data = { 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() diff --git a/indoteknik_custom/views/promotion/promotion_program_line.xml b/indoteknik_custom/views/promotion/promotion_program_line.xml index 7c8e403d..3f077a13 100644 --- a/indoteknik_custom/views/promotion/promotion_program_line.xml +++ b/indoteknik_custom/views/promotion/promotion_program_line.xml @@ -25,6 +25,7 @@ <field name="program_id" /> <field name="promotion_type" /> <field name="active" readonly="1" /> + <field name="description" /> </group> <group> <field name="package_limit" /> |
