diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-01-07 16:02:47 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-01-07 16:02:47 +0700 |
| commit | 61c9291070da3ef7f81774290db1923789792210 (patch) | |
| tree | c010ebacb209dfb57fb5fe1d23e986c4b051cac1 | |
| parent | c971e71a19426de6c210100e2e110319df81aafa (diff) | |
| parent | 1ec4b411c91851202a6058b531257f45fdd76457 (diff) | |
Merge branch 'production' into iman/pengajuan-tempo
| -rw-r--r-- | indoteknik_api/controllers/api_v1/flash_sale.py | 2 | ||||
| -rw-r--r-- | indoteknik_api/controllers/api_v1/sale_order.py | 2 | ||||
| -rw-r--r-- | indoteknik_api/models/product_product.py | 20 | ||||
| -rw-r--r-- | indoteknik_custom/models/logbook_bill.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 15 | ||||
| -rw-r--r-- | indoteknik_custom/models/promotion/sale_order.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_pricelist.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/requisition.py | 8 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 42 | ||||
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_move.py | 11 | ||||
| -rw-r--r-- | indoteknik_custom/models/website_user_cart.py | 6 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 1 | ||||
| -rw-r--r-- | indoteknik_custom/views/res_partner.xml | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 14 |
16 files changed, 103 insertions, 38 deletions
diff --git a/indoteknik_api/controllers/api_v1/flash_sale.py b/indoteknik_api/controllers/api_v1/flash_sale.py index 00b1f2e0..6c4ad8c0 100644 --- a/indoteknik_api/controllers/api_v1/flash_sale.py +++ b/indoteknik_api/controllers/api_v1/flash_sale.py @@ -20,6 +20,7 @@ class FlashSale(controller.Controller): query = [ ('pricelist_id', '=', pricelist.id) ] + formatted_end_date = pricelist.end_date.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z' if pricelist.end_date else None data.append({ 'pricelist_id': pricelist.id, 'option': pricelist.flashsale_option, @@ -29,6 +30,7 @@ class FlashSale(controller.Controller): 'banner_mobile': request.env['ir.attachment'].api_image('product.pricelist', 'banner_mobile', pricelist.id), 'banner_top': request.env['ir.attachment'].api_image('product.pricelist', 'banner_top', pricelist.id), 'duration': pricelist._remaining_time_in_second(), + 'end_date': formatted_end_date, 'product_total': request.env['product.pricelist.item'].search_count(query), }) return self.response(data) diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py index 8b95ade8..f972fd46 100644 --- a/indoteknik_api/controllers/api_v1/sale_order.py +++ b/indoteknik_api/controllers/api_v1/sale_order.py @@ -398,7 +398,7 @@ class SaleOrder(controller.Controller): parameters = { 'warehouse_id': 8, 'carrier_id': 1, - 'sales_tax_id': 23, + 'sales_tax_id': 218, 'pricelist_id': user_pricelist or product_pricelist_default_discount_id, 'payment_term_id': 26, 'team_id': 2, diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index f8869c7d..d7e20ac3 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -139,39 +139,39 @@ class ProductProduct(models.Model): return retValue def _get_website_price_exclude_tax(self): - default_divide_tax = float(1.11) + default_divide_tax = float(1.12) price_incl = self._get_website_price_include_tax() res = price_incl / default_divide_tax return math.floor(res) def _v2_get_website_price_exclude_tax(self): - default_divide_tax = float(1.11) + default_divide_tax = float(1.12) price_incl = self._v2_get_website_price_include_tax() res = price_incl / default_divide_tax return math.floor(res) def _get_website_price_after_disc_and_tax(self): - default_divide_tax = float(1.11) + default_divide_tax = float(1.12) price_after_disc = self._get_website_price_after_disc() res = price_after_disc / default_divide_tax res = math.ceil(res) return res def _v2_get_website_price_after_disc_and_tax(self): - default_divide_tax = float(1.11) + default_divide_tax = float(1.12) price_after_disc = self._v2_get_website_price_after_disc() res = price_after_disc / default_divide_tax res = math.ceil(res) return res def _get_website_tax(self): - default_percent_tax = float(11) + default_percent_tax = float(12) price_after_disc = self._get_website_price_after_disc_and_tax() res = price_after_disc * default_percent_tax / 100 return math.floor(res) def _v2_get_website_tax(self): - default_percent_tax = float(11) + default_percent_tax = float(12) price_after_disc = self._v2_get_website_price_after_disc_and_tax() res = price_after_disc * default_percent_tax / 100 return math.floor(res) @@ -229,7 +229,7 @@ class ProductProduct(models.Model): def _get_pricelist_tier(self, tier_number): config_param_name = f'product.pricelist.tier{tier_number}' product_pricelist_tier = int(self.env['ir.config_parameter'].get_param(config_param_name)) - default_divide_tax = float(1.11) + default_divide_tax = float(1.12) base_price = discount = price = 0 pricelist_item = self.env['product.pricelist.item'].search([ ('pricelist_id', '=', int(product_pricelist_tier)), @@ -273,12 +273,12 @@ class ProductProduct(models.Model): base_price = 0 if base_pricelist: base_price = base_pricelist.computed_price - # base_price = base_pricelist.computed_price / 1.11 + # base_price = base_pricelist.computed_price / 1.12 discount = 0 price_flashsale = 0 - default_divide_tax = float(1.11) - default_tax = float(11) + default_divide_tax = float(1.12) + default_tax = float(12) if item.price_discount > 0: discount = item.price_discount price_flashsale = base_price - (base_price * discount // 100) diff --git a/indoteknik_custom/models/logbook_bill.py b/indoteknik_custom/models/logbook_bill.py index bb956092..3c33aeb7 100644 --- a/indoteknik_custom/models/logbook_bill.py +++ b/indoteknik_custom/models/logbook_bill.py @@ -22,7 +22,7 @@ class LogbookBill(models.TransientModel): ('product_id', '=', line.product_id.id), ], order='id desc', limit=1) total += line.quantity_done * po.price_unit - total_with_tax = total * 1.11 + total_with_tax = total * 1.12 return total_with_tax diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 00e756c9..9007dd71 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -404,12 +404,17 @@ class ProductProduct(models.Model): qr_code_variant = fields.Binary("QR Code Variant", compute='_compute_qr_code_variant') def _compute_qr_code_variant(self): - for rec in self.product_variant_ids: + for rec in self: + # Skip inactive variants + if not rec.active: + rec.qr_code_variant = False # Clear the QR Code for archived variants + continue + qr = qrcode.QRCode( - version=1, - error_correction=qrcode.constants.ERROR_CORRECT_L, - box_size=5, - border=4, + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=5, + border=4, ) qr.add_data(rec.display_name) qr.make(fit=True) diff --git a/indoteknik_custom/models/promotion/sale_order.py b/indoteknik_custom/models/promotion/sale_order.py index 1c31d060..6cb56914 100644 --- a/indoteknik_custom/models/promotion/sale_order.py +++ b/indoteknik_custom/models/promotion/sale_order.py @@ -37,7 +37,7 @@ class SaleOrder(models.Model): else: all_products = self._merge_promotion_products(promotion) - promotion_price = promotion['price']['price_discount'] * line.quantity * 1.11 + promotion_price = promotion['price']['price_discount'] * line.quantity * 1.12 promotion_amt_total = sum(product['price']['price'] * product['qty'] for product in all_products) promotion_used_price = 0 diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 9388ae4c..0e39d12a 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -74,6 +74,7 @@ class PurchaseOrder(models.Model): approve_by = fields.Many2one('res.users', string='Approve By') exclude_incoming = fields.Boolean(string='Exclude Incoming', default=False, help='Centang jika tidak mau masuk perhitungan Incoming Qty') + not_update_purchasepricelist = fields.Boolean(string='Not Update Purchase Pricelist?') def _compute_total_margin_match(self): for purchase in self: @@ -620,7 +621,8 @@ class PurchaseOrder(models.Model): raise UserError("Tidak ada link dengan SO, harus approval Merchandise") send_email = False - self.add_product_to_pricelist() + if not self.not_update_purchasepricelist: + self.add_product_to_pricelist() for line in self.order_line: if not line.product_id.purchase_ok: raise UserError("Terdapat barang yang tidak bisa diproses") diff --git a/indoteknik_custom/models/purchase_pricelist.py b/indoteknik_custom/models/purchase_pricelist.py index e5b35d7f..c543070a 100755 --- a/indoteknik_custom/models/purchase_pricelist.py +++ b/indoteknik_custom/models/purchase_pricelist.py @@ -48,9 +48,9 @@ class PurchasePricelist(models.Model): def _constrains_include_price(self): price, taxes = self._get_valid_price() - # When have tax is excluded or empty tax, then multiply by 1.11 + # When have tax is excluded or empty tax, then multiply by 1.12 if (taxes and not taxes.price_include) or not taxes: - price *= 1.11 + price *= 1.12 self.include_price = price diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py index 32a9f94f..78cdf80d 100644 --- a/indoteknik_custom/models/requisition.py +++ b/indoteknik_custom/models/requisition.py @@ -82,11 +82,11 @@ class Requisition(models.Model): state = ['done', 'sale'] if self.sale_order_id.state in state: raise UserError('SO sudah Confirm, akan berakibat double Purchase melalui PJ') - if self.env.user.id not in [377, 19]: + if self.env.user.id not in [377, 19, 28]: raise UserError('Hanya Vita dan Darren Yang Bisa Approve') - if self.env.user.id == 377: + if self.env.user.id == 377 or self.env.user.id == 28: self.sales_approve = True - elif self.env.user.id == 19: + elif self.env.user.id == 19 or self.env.user.id == 28: if not self.sales_approve: raise UserError('Vita Belum Approve') self.merchandise_approve = True @@ -159,7 +159,7 @@ class Requisition(models.Model): offset=i * PRODUCT_PER_PO, limit=PRODUCT_PER_PO ) - tax = [22] + tax = [220] for line in lines: product = line.product_id diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 7fc6d96a..2b448874 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -758,6 +758,7 @@ class SaleOrder(models.Model): raise UserError("Salesperson sudah tidak aktif, mohon diisi yang benar pada data SO dan Contact") def sale_order_approve(self): + self.check_credit_limit() if self.validate_different_vendor() and not self.vendor_approval: return self._create_notification_action('Notification', 'Terdapat Vendor yang berbeda dengan MD Vendor') self.check_due() @@ -890,6 +891,37 @@ class SaleOrder(models.Model): 'email_to': salesperson_email, }).send() + def check_credit_limit(self): + for rec in self: + outstanding_amount = rec.outstanding_amount + check_credit_limit = False + ###### + block_stage = 0 + if rec.partner_id.parent_id: + if rec.partner_id.parent_id.active_limit and rec.partner_id.parent_id.enable_credit_limit: + check_credit_limit = True + else: + if rec.partner_id.active_limit and rec.partner_id.enable_credit_limit: + check_credit_limit = True + + term_days = 0 + for term_line in rec.payment_term_id.line_ids: + term_days += term_line.days + if term_days == 0: + check_credit_limit = False + + if check_credit_limit: + if rec.partner_id.parent_id: + block_stage = rec.partner_id.parent_id.blocking_stage or 0 + else: + block_stage = rec.partner_id.blocking_stage or 0 + + if (outstanding_amount + rec.amount_total) >= block_stage: + if block_stage != 0: + remaining_credit_limit = block_stage - outstanding_amount + raise UserError(_("%s is in Blocking Stage, Remaining credit limit is %s, from %s and outstanding %s") + % (rec.partner_id.name, remaining_credit_limit, block_stage, outstanding_amount)) + def validate_different_vendor(self): if self.vendor_approval_id.filtered(lambda v: v.state == 'draft'): draft_names = ", ".join(self.vendor_approval_id.filtered(lambda v: v.state == 'draft').mapped('number')) @@ -1185,7 +1217,7 @@ class SaleOrder(models.Model): line_voucher = used_discount * line_contribution line_voucher_item = line_voucher / line.product_uom_qty - line_price_unit = line.price_unit / 1.11 if any(tax.id == 23 for tax in line.tax_id) else line.price_unit + line_price_unit = line.price_unit / 1.12 if any(tax.id == 217 for tax in line.tax_id) else line.price_unit line_discount_item = line_price_unit * line.discount / 100 + line_voucher_item line_voucher_item = line_discount_item / line_price_unit * 100 @@ -1298,13 +1330,13 @@ class SaleOrder(models.Model): if last_so and rec_purchase_price != last_so.purchase_price: rec_taxes = self.env['account.tax'].search([('id', '=', rec_taxes_id)], limit=1) if rec_taxes.price_include: - selling_price = (rec_purchase_price / 1.11) / (1 - (last_so.item_percent_margin_without_deduction / 100)) + selling_price = (rec_purchase_price / 1.12) / (1 - (last_so.item_percent_margin_without_deduction / 100)) else: selling_price = rec_purchase_price / (1 - (last_so.item_percent_margin_without_deduction / 100)) tax_id = last_so.tax_id for tax in tax_id: if tax.price_include: - selling_price = selling_price + (selling_price*11/100) + selling_price = selling_price + (selling_price*12/100) else: selling_price = selling_price discount = 0 @@ -1320,13 +1352,13 @@ class SaleOrder(models.Model): elif last_so and rec_vendor_id == order_line.vendor_id.id and rec_purchase_price != last_so.purchase_price: rec_taxes = self.env['account.tax'].search([('id', '=', rec_taxes_id)], limit=1) if rec_taxes.price_include: - selling_price = (rec_purchase_price / 1.11) / (1 - (last_so.item_percent_margin_without_deduction / 100)) + selling_price = (rec_purchase_price / 1.12) / (1 - (last_so.item_percent_margin_without_deduction / 100)) else: selling_price = rec_purchase_price / (1 - (last_so.item_percent_margin_without_deduction / 100)) tax_id = last_so.tax_id for tax in tax_id: if tax.price_include: - selling_price = selling_price + (selling_price*11/100) + selling_price = selling_price + (selling_price*12/100) else: selling_price = selling_price discount = 0 diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index a31ff569..a82bcc8a 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -96,7 +96,7 @@ class SaleOrderLine(models.Model): purchase_price = line.purchase_price if line.purchase_tax_id.price_include: - purchase_price = line.purchase_price / 1.11 + purchase_price = line.purchase_price / 1.12 purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -124,7 +124,7 @@ class SaleOrderLine(models.Model): purchase_price = line.purchase_price if line.purchase_tax_id.price_include: - purchase_price = line.purchase_price / 1.11 + purchase_price = line.purchase_price / 1.12 purchase_price = purchase_price * line.product_uom_qty margin_per_item = sales_price - purchase_price @@ -175,7 +175,7 @@ class SaleOrderLine(models.Model): # # tax_id = last_so.tax_id # if rec_vendor_id == self.vendor_id and rec_purchase_price != last_so.purchase_price: # if rec_taxes.price_include: - # selling_price = (rec_purchase_price/1.11) / (1-(last_so.line_item_margin / 100)) + # selling_price = (rec_purchase_price/1.12) / (1-(last_so.line_item_margin / 100)) # else: # selling_price = rec_purchase_price / (1-(last_so.line_item_margin / 100)) # tax_id = last_so.tax_id diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 8214a057..c0ac341c 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -11,6 +11,15 @@ class StockMove(models.Model): string="Print Barcode", default=lambda self: self.product_id.print_barcode, ) + qr_code_variant = fields.Binary("QR Code Variant", compute='_compute_qr_code_variant') + + def _compute_qr_code_variant(self): + for rec in self: + if rec.print_barcode and rec.print_barcode == True and rec.product_id and rec.product_id.qr_code_variant: + rec.qr_code_variant = rec.product_id.qr_code_variant + else: + rec.qr_code_variant = False + def write(self, vals): res = super(StockMove, self).write(vals) @@ -103,7 +112,7 @@ class StockMove(models.Model): # 440 is static id for "PPN Keluaran" on account.account model debit_account_id = self.picking_id.account_id.id if self.picking_id.account_id.id else 538 - tax = cost * (11 / 100) + tax = cost * (12 / 100) move_lines = self._prepare_account_move_line(qty, cost, credit_account_id, debit_account_id, description) move_lines += self._prepare_account_move_line(qty, tax, 440, debit_account_id, description) diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py index 44393cf1..8da716a1 100644 --- a/indoteknik_custom/models/website_user_cart.py +++ b/indoteknik_custom/models/website_user_cart.py @@ -163,7 +163,7 @@ class WebsiteUserCart(models.Model): voucher_shipping_info = voucher_shipping.apply(order_line) discount_voucher_shipping = voucher_shipping_info['discount']['all'] - tax = round(subtotal * 0.11) + tax = round(subtotal * 0.12) grand_total = subtotal + tax total_weight = sum(x['weight'] * x['quantity'] for x in products) total_weight = round(total_weight, 2) @@ -240,7 +240,7 @@ class WebsiteUserCart(models.Model): total_voucher += voucher_product if total_discount > 0: - ppn = total_discount * 0.11 + ppn = total_discount * 0.12 return { 'total_discount': self.format_currency(total_discount), 'total_voucher': self.format_currency(total_voucher), @@ -352,7 +352,7 @@ class WebsiteUserCart(models.Model): discounted_price = fixed_price - (fixed_price * discount / 100) - final_price = discounted_price / 1.11 + final_price = discounted_price / 1.12 return { 'price': final_price, diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 0e6b6792..d22c3b5c 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -41,6 +41,7 @@ </field> <field name="approval_status" position="after"> <field name="revisi_po"/> + <field name="not_update_purchasepricelist"/> </field> <field name="incoterm_id" position="after"> <field name="amount_total_without_service"/> diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index 96cfcd62..7e759e31 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -75,7 +75,7 @@ <field name="site_id" attrs="{'readonly': [('parent_id', '=', False)]}" domain="[('partner_id', '=', main_parent_id)]" context="{'default_partner_id': active_id}" /> </xpath> <xpath expr="//field[@name='property_payment_term_id']" position="attributes"> - <attribute name="readonly">1</attribute> + <attribute name="readonly">0</attribute> </xpath> <xpath expr="//field[@name='property_supplier_payment_term_id']" position="attributes"> <attribute name="readonly">1</attribute> diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 8a3ea1cb..26fe7c1e 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -123,6 +123,7 @@ <field name="product_uom" position="after"> <field name="sale_id" attrs="{'readonly': 1}" optional="hide"/> <field name="print_barcode" optional="hide"/> + <field name="qr_code_variant" widget="image" optional="hide"/> </field> <page name="note" position="after"> <page string="E-Faktur" name="efaktur" attrs="{'invisible': [['is_internal_use', '=', False]]}"> @@ -171,11 +172,24 @@ </group> </group> </page> + <!-- <page string="Check Product" name="check_product"> + <field name="check_product_lines"/> + </page> --> </page> </field> </record> + <!-- <record id="check_product_tree" model="ir.ui.view"> + <field name="name">check.product.tree</field> + <field name="model">check.product</field> + <field name="arch" type="xml"> + <tree editable="bottom"> + <field name="product_id"/> + </tree> + </field> + </record> --> + <record id="view_stock_move_line_detailed_operation_tree_inherit" model="ir.ui.view"> <field name="name">stock.move.line.operations.tree.inherit</field> <field name="model">stock.move.line</field> |
