From 1641ce147735a3548ddef2982dfb6873955dfebc Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 Jan 2023 10:30:07 +0700 Subject: add manufacture in sales > product pricelist item --- indoteknik_custom/models/product_pricelist.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_pricelist.py b/indoteknik_custom/models/product_pricelist.py index 7b850d57..190887cf 100644 --- a/indoteknik_custom/models/product_pricelist.py +++ b/indoteknik_custom/models/product_pricelist.py @@ -15,6 +15,8 @@ class ProductPricelist(models.Model): class ProductPricelistItem(models.Model): _inherit = 'product.pricelist.item' + manufacture_id = fields.Many2one('x_manufactures', string='Manufacture') + @api.onchange('fixed_price','price_discount') def update_solr_flag(self): for item in self: -- cgit v1.2.3 From e1a19093f74222251280bf598a6256d6766dc4a2 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 Jan 2023 16:54:57 +0700 Subject: add reklas for uang muka penjualan --- indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/invoice_reklas.py | 58 ++++++++++++++++++++++++++++++ indoteknik_custom/models/sale_order.py | 2 ++ 3 files changed, 61 insertions(+) create mode 100644 indoteknik_custom/models/invoice_reklas.py (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index d7d3e03c..4b9d4545 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -41,3 +41,4 @@ from . import purchase_outstanding from . import sales_outstanding from . import customer_review from . import website_content +from . import invoice_reklas diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py new file mode 100644 index 00000000..7c29ebca --- /dev/null +++ b/indoteknik_custom/models/invoice_reklas.py @@ -0,0 +1,58 @@ +from odoo import api, fields, models, _ +from odoo.exceptions import UserError +from datetime import datetime +from odoo.http import request + +import logging + +_logger = logging.getLogger(__name__) + + +class InvoiceReklas(models.TransientModel): + _name = 'invoice.reklas' + _description = "digunakan untuk reklas Uang Muka Penjualan" + reklas_id = fields.Many2one('account.move', string='Nomor CAB') + pay_amt = fields.Float(string='Yang dibayarkan') + + def create_reklas(self): + if not self.reklas_id: + raise UserError('Nomor CAB harus diisi') + invoices = self.env['account.move'].browse(self._context.get('active_ids', [])) + current_time = datetime.now() + for invoice in invoices: + + parameters_header = { + 'ref': 'REKLAS '+self.reklas_id.name+" UANG MUKA PENJUALAN "+invoice.name+" "+invoice.partner_id.name, + 'date': current_time, + 'journal_id': 13 + } + + account_move = request.env['account.move'].create([parameters_header]) + _logger.info('Success Reklas with %s' % account_move.name) + + parameter_debit = { + 'move_id': account_move.id, + 'account_id': 449, + 'partner_id': invoice.partner_id.id, + 'currency_id': 12, + 'debit': self.pay_amt, + 'credit': 0 + } + parameter_credit = { + 'move_id': account_move.id, + 'account_id': 395, + 'partner_id': invoice.partner_id.id, + 'currency_id': 12, + 'debit': 0, + 'credit': self.pay_amt + } + request.env['account.move.line'].create([parameter_debit, parameter_credit]) + return { + 'name': _('Journal Entries'), + 'view_mode': 'form', + 'res_model': 'account.move', + 'target': 'current', + 'view_id': False, + 'type': 'ir.actions.act_window', + 'res_id': account_move.id + } diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index e7b28c6d..c8937ca4 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -235,6 +235,8 @@ class SaleOrder(models.Model): def action_confirm(self): res = super(SaleOrder, self).action_confirm() for order in self: + if order.warehouse_id.id != 8: #GD Bandengan + raise UserError('Gudang harus Bandengan') if not order.sales_tax_id: raise UserError("Tax di Header harus diisi") if not order.carrier_id: -- cgit v1.2.3 From aff29db4fe020684f83e5e6449bf0a4061d77036 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 11 Jan 2023 09:26:02 +0700 Subject: add custom mail marketing --- indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/custom_mail_marketing.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 indoteknik_custom/models/custom_mail_marketing.py (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 4b9d4545..3d4d646b 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -42,3 +42,4 @@ from . import sales_outstanding from . import customer_review from . import website_content from . import invoice_reklas +from . import custom_mail_marketing diff --git a/indoteknik_custom/models/custom_mail_marketing.py b/indoteknik_custom/models/custom_mail_marketing.py new file mode 100644 index 00000000..8a81974f --- /dev/null +++ b/indoteknik_custom/models/custom_mail_marketing.py @@ -0,0 +1,16 @@ +from odoo import fields, models, api, _ + + +class CustomMailMarketing(models.Model): + _name = 'custom.mail.marketing' + + col1_string = fields.Char(string='col1_string') + col2_string = fields.Char(string='col2_string') + col3_string = fields.Char(string='col3_string') + col4_string = fields.Char(string='col4_string') + col5_string = fields.Char(string='col5_string') + col6_string = fields.Char(string='col6_string') + col7_string = fields.Char(string='col7_string') + col8_string = fields.Char(string='col8_string') + col9_string = fields.Char(string='col9_string') + col10_string = fields.Char(string='col10_string') -- cgit v1.2.3 From 0f8fbe56e89ec285c6fbcdd2bed5a67f62bcfe59 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 11 Jan 2023 11:59:54 +0700 Subject: add reklas uang muka pembelian feature --- indoteknik_custom/models/invoice_reklas.py | 73 +++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 21 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py index 7c29ebca..43736059 100644 --- a/indoteknik_custom/models/invoice_reklas.py +++ b/indoteknik_custom/models/invoice_reklas.py @@ -13,39 +13,70 @@ class InvoiceReklas(models.TransientModel): _description = "digunakan untuk reklas Uang Muka Penjualan" reklas_id = fields.Many2one('account.move', string='Nomor CAB') pay_amt = fields.Float(string='Yang dibayarkan') + reklas_type = fields.Selection([ + ('penjualan', 'Penjualan'), + ('pembelian', 'Pembelian'), + ], string='Reklas Tipe') def create_reklas(self): + if not self.reklas_type: + raise UserError('Reklas Tipe harus diisi') if not self.reklas_id: raise UserError('Nomor CAB harus diisi') invoices = self.env['account.move'].browse(self._context.get('active_ids', [])) current_time = datetime.now() for invoice in invoices: - parameters_header = { - 'ref': 'REKLAS '+self.reklas_id.name+" UANG MUKA PENJUALAN "+invoice.name+" "+invoice.partner_id.name, - 'date': current_time, - 'journal_id': 13 - } + if self.reklas_type == 'penjualan': + parameters_header = { + 'ref': 'REKLAS '+self.reklas_id.name+" UANG MUKA PENJUALAN "+invoice.name+" "+invoice.partner_id.name, + 'date': current_time, + 'journal_id': 13 + } + else: + parameters_header = { + 'ref': 'REKLAS ' + self.reklas_id.name + " UANG MUKA PEMBELIAN " + invoice.name + " " + invoice.partner_id.name, + 'date': current_time, + 'journal_id': 13 + } account_move = request.env['account.move'].create([parameters_header]) _logger.info('Success Reklas with %s' % account_move.name) - parameter_debit = { - 'move_id': account_move.id, - 'account_id': 449, - 'partner_id': invoice.partner_id.id, - 'currency_id': 12, - 'debit': self.pay_amt, - 'credit': 0 - } - parameter_credit = { - 'move_id': account_move.id, - 'account_id': 395, - 'partner_id': invoice.partner_id.id, - 'currency_id': 12, - 'debit': 0, - 'credit': self.pay_amt - } + if self.reklas_type == 'penjualan': + parameter_debit = { + 'move_id': account_move.id, + 'account_id': 449, + 'partner_id': invoice.partner_id.id, + 'currency_id': 12, + 'debit': self.pay_amt, + 'credit': 0 + } + parameter_credit = { + 'move_id': account_move.id, + 'account_id': 395, + 'partner_id': invoice.partner_id.id, + 'currency_id': 12, + 'debit': 0, + 'credit': self.pay_amt + } + else: + parameter_debit = { + 'move_id': account_move.id, + 'account_id': 438, + 'partner_id': invoice.partner_id.id, + 'currency_id': 12, + 'debit': self.pay_amt, + 'credit': 0 + } + parameter_credit = { + 'move_id': account_move.id, + 'account_id': 401, + 'partner_id': invoice.partner_id.id, + 'currency_id': 12, + 'debit': 0, + 'credit': self.pay_amt + } request.env['account.move.line'].create([parameter_debit, parameter_credit]) return { 'name': _('Journal Entries'), -- cgit v1.2.3