summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-03-24 15:51:53 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-03-24 15:51:53 +0700
commitd7838ad087daf51826d3be27888df04eac09a293 (patch)
tree629154312c99d14f08d61f541165a2396f175561
parent056a719bbb24a931b119515f0483b96ad2f4d415 (diff)
parent3aa64db9c10d0fcb8009e9e6f942672a12669099 (diff)
fix conflict
-rwxr-xr-xindoteknik_custom/__manifest__.py2
-rwxr-xr-xindoteknik_custom/models/__init__.py2
-rw-r--r--indoteknik_custom/models/account_payment.py82
-rwxr-xr-xindoteknik_custom/models/crm_lead.py1
-rw-r--r--indoteknik_custom/models/invoice_reklas.py2
-rw-r--r--indoteknik_custom/models/stock_picking.py105
-rw-r--r--indoteknik_custom/models/uangmuka_pembelian.py107
-rw-r--r--indoteknik_custom/models/uangmuka_penjualan.py111
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv4
-rw-r--r--indoteknik_custom/views/account_move.xml2
-rwxr-xr-xindoteknik_custom/views/crm_lead.xml3
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml2
-rwxr-xr-xindoteknik_custom/views/sale_order.xml6
-rw-r--r--indoteknik_custom/views/stock_picking.xml5
-rw-r--r--indoteknik_custom/views/uangmuka_pembelian.xml33
-rw-r--r--indoteknik_custom/views/uangmuka_penjualan.xml33
16 files changed, 494 insertions, 6 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 701f33c0..84a604d8 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -21,6 +21,7 @@
'views/product_pricelist_item.xml',
'views/product_public_category.xml',
'views/product_template.xml',
+ 'views/uangmuka_pembelian.xml',
'views/purchase_order.xml',
'views/purchase_pricelist.xml',
'views/sale_monitoring.xml',
@@ -40,6 +41,7 @@
'views/x_product_tags.xml',
'views/stock_vendor.xml',
'views/crm_lead.xml',
+ 'views/uangmuka_penjualan.xml',
'views/sale_order.xml',
'views/account_asset_views.xml',
'views/ir_sequence.xml',
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 5a4a0cfd..7a4e445a 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -54,3 +54,5 @@ from . import ip_lookup
from . import wati
from . import wati_api
from . import wati_contact
+from . import uangmuka_penjualan
+from . import uangmuka_pembelian
diff --git a/indoteknik_custom/models/account_payment.py b/indoteknik_custom/models/account_payment.py
new file mode 100644
index 00000000..11c664eb
--- /dev/null
+++ b/indoteknik_custom/models/account_payment.py
@@ -0,0 +1,82 @@
+from odoo import models, api, fields
+from odoo.exceptions import AccessError, UserError, ValidationError
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class AccountPayment(models.Model):
+ _inherit = 'account.payment'
+
+ invoice_bill_ids = fields.Many2many('account.move', string='Invoice/Bill', help='Masukan invoice atau bill yang ingin di alokasi')
+ # lookup_line = fields.One2many('ip.lookup.line', 'ip_lookup_id', string='Lookup Lines', auto_join=True)
+ payment_line = fields.One2many('account.payment.line', 'payment_id', string='Payment Lines', auto_join=True)
+ total_allocated_amt = fields.Float(string='Total Allocated', help='Total Allocated Amount dari setiap Line', compute='_compute_total_payment_line')
+ total_difference = fields.Float(string='Total Difference', help='Total Difference dari setiap Line', compute='_compute_total_payment_line')
+
+ def _compute_total_payment_line(self):
+ for payment in self:
+ total_allocated_amt = total_difference = 0
+ for line in payment.payment_line:
+ total_allocated_amt += line.allocated_amt
+ total_difference += line.difference
+ payment.total_allocated_amt = total_allocated_amt
+ payment.total_difference = total_difference
+
+ def generate_account_payment_lines(self):
+ for payment in self:
+ for invoice in payment.invoice_bill_ids:
+ self.env['account.payment.line'].create([{
+ 'payment_id': payment.id,
+ 'account_move_id': invoice.id,
+ 'open_amt': invoice.amount_residual
+ }])
+
+ def write(self, vals):
+ res = super(AccountPayment, self).write(vals)
+
+ for line in self.payment_line:
+ line.difference = line.open_amt - line.allocated_amt
+
+ return res
+
+ def allocate_invoices(self):
+ for payment in self:
+ if self.
+ for line in payment.payment_line:
+ invoice = line.account_move_id
+ move_lines = payment.line_ids.filtered(lambda line: line.account_internal_type in ('receivable', 'payable'))
+ for line in move_lines:
+ invoice.js_assign_outstanding_line(line.id)
+ _logger.info('Allocated Invoice %s' % invoice.name)
+
+ # def _post(self, soft=True):
+ # # OVERRIDE
+ # # Auto-reconcile the invoice with payments coming from transactions.
+ # # It's useful when you have a "paid" sale order (using a payment transaction) and you invoice it later.
+ # posted = super()._post(soft)
+
+ # for invoice in posted.filtered(lambda move: move.is_invoice()):
+ # payments = invoice.mapped('transaction_ids.payment_id')
+ # move_lines = payments.line_ids.filtered(lambda line: line.account_internal_type in ('receivable', 'payable') and not line.reconciled)
+ # for line in move_lines:
+ # invoice.js_assign_outstanding_line(line.id)
+ # return posted
+
+class PaymentLine(models.Model):
+ _name = 'account.payment.line'
+ _description = 'Custom indoteknik untuk multiple allocation payment atau receipt'
+
+ payment_id = fields.Many2one('account.payment', string='Payment Reference', required=True, ondelete='cascade', index=True, copy=False)
+ # order_id = fields.Many2one('sale.order', string='Order Reference', required=True, ondelete='cascade', index=True, copy=False)
+ account_move_id = fields.Many2one('account.move', string='Invoice/Bill', help='Pilih invoice / bill yang akan dialokasi dengan uang masuk atau uang keluar')
+ open_amt = fields.Float(string='Open', help='Jumlah open amount dari invoice / bill tersebut')
+ allocated_amt = fields.Float(string='Allocated', help='Berapa yang ingin di alokasi untuk invoice / bill tersebut')
+ difference = fields.Float(string='Difference', help='Sisa setelah alokasi')
+
+ def _compute_difference(self):
+ for record in self:
+ if record.open_amt and record.allocated_amt:
+ print(record.open_amt-record.allocated_amt)
+ record.difference = record.open_amt - record.allocated_amt
+ \ No newline at end of file
diff --git a/indoteknik_custom/models/crm_lead.py b/indoteknik_custom/models/crm_lead.py
index 47325b01..be4bbf5d 100755
--- a/indoteknik_custom/models/crm_lead.py
+++ b/indoteknik_custom/models/crm_lead.py
@@ -16,6 +16,7 @@ class CrmLead(models.Model):
ticket_id = fields.Char('Ticket ID', help='Ticket ID yang ada di WATI')
operator_email = fields.Char('Operator Email', help='Operator yang membalas')
operator_name = fields.Char('Operator Name', help='Operator yang membalas')
+ order_id = fields.Many2one('sale.order', string='Sales Order', help='Link ke sales order id')
def revert_to_leads(self):
opportunities = self.env['crm.lead'].search([
diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py
index 43736059..70469b72 100644
--- a/indoteknik_custom/models/invoice_reklas.py
+++ b/indoteknik_custom/models/invoice_reklas.py
@@ -46,7 +46,7 @@ class InvoiceReklas(models.TransientModel):
if self.reklas_type == 'penjualan':
parameter_debit = {
'move_id': account_move.id,
- 'account_id': 449,
+ 'account_id': 449, # uang muka penjualan
'partner_id': invoice.partner_id.id,
'currency_id': 12,
'debit': self.pay_amt,
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 5bf774f4..77af676c 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -1,5 +1,7 @@
from odoo import fields, models, api, _
from odoo.exceptions import AccessError, UserError, ValidationError
+from odoo.tools.float_utils import float_is_zero
+from itertools import groupby
class StockPicking(models.Model):
@@ -58,6 +60,109 @@ class StockPicking(models.Model):
], string='Approval Return Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Return")
date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ, tidak berpengaruh ke Accounting")
+ def action_create_invoice_from_mr(self):
+ """Create the invoice associated to the PO.
+ """
+ if not self.env.user.is_accounting:
+ raise UserError('Hanya Accounting yang bisa membuat Bill')
+
+ precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
+
+ #custom here
+ po = self.env['purchase.order'].search([
+ ('name', '=', self.group_id.name)
+ ])
+
+ # 1) Prepare invoice vals and clean-up the section lines
+ invoice_vals_list = []
+ for order in po:
+ if order.invoice_status != 'to invoice':
+ continue
+
+ order = order.with_company(order.company_id)
+ pending_section = None
+ # Invoice values.
+ invoice_vals = order._prepare_invoice()
+ # Invoice line values (keep only necessary sections).
+ for line in order.order_line:
+ if line.display_type == 'line_section':
+ pending_section = line
+ continue
+ if not float_is_zero(line.qty_to_invoice, precision_digits=precision):
+ if pending_section:
+ invoice_vals['invoice_line_ids'].append((0, 0, pending_section._prepare_account_move_line()))
+ pending_section = None
+ invoice_vals['invoice_line_ids'].append((0, 0, line._prepare_account_move_line()))
+ invoice_vals_list.append(invoice_vals)
+
+ if not invoice_vals_list:
+ raise UserError(_('There is no invoiceable line. If a product has a control policy based on received quantity, please make sure that a quantity has been received.'))
+
+ # 2) group by (company_id, partner_id, currency_id) for batch creation
+ new_invoice_vals_list = []
+ for grouping_keys, invoices in groupby(invoice_vals_list, key=lambda x: (x.get('company_id'), x.get('partner_id'), x.get('currency_id'))):
+ origins = set()
+ payment_refs = set()
+ refs = set()
+ ref_invoice_vals = None
+ for invoice_vals in invoices:
+ if not ref_invoice_vals:
+ ref_invoice_vals = invoice_vals
+ else:
+ ref_invoice_vals['invoice_line_ids'] += invoice_vals['invoice_line_ids']
+ origins.add(invoice_vals['invoice_origin'])
+ payment_refs.add(invoice_vals['payment_reference'])
+ refs.add(invoice_vals['ref'])
+ ref_invoice_vals.update({
+ 'ref': ', '.join(refs)[:2000],
+ 'invoice_origin': ', '.join(origins),
+ 'payment_reference': len(payment_refs) == 1 and payment_refs.pop() or False,
+ })
+ new_invoice_vals_list.append(ref_invoice_vals)
+ invoice_vals_list = new_invoice_vals_list
+
+ # 3) Create invoices.
+ moves = self.env['account.move']
+ AccountMove = self.env['account.move'].with_context(default_move_type='in_invoice')
+ for vals in invoice_vals_list:
+ moves |= AccountMove.with_company(vals['company_id']).create(vals)
+
+ # 4) Some moves might actually be refunds: convert them if the total amount is negative
+ # We do this after the moves have been created since we need taxes, etc. to know if the total
+ # is actually negative or not
+ moves.filtered(lambda m: m.currency_id.round(m.amount_total) < 0).action_switch_invoice_into_refund_credit_note()
+
+ return self.action_view_invoice_from_mr(moves)
+
+ def action_view_invoice_from_mr(self, invoices=False):
+ """This function returns an action that display existing vendor bills of
+ given purchase order ids. When only one found, show the vendor bill
+ immediately.
+ """
+ if not invoices:
+ # Invoice_ids may be filtered depending on the user. To ensure we get all
+ # invoices related to the purchase order, we read them in sudo to fill the
+ # cache.
+ self.sudo()._read(['invoice_ids'])
+ invoices = self.invoice_ids
+
+ result = self.env['ir.actions.act_window']._for_xml_id('account.action_move_in_invoice_type')
+ # choose the view_mode accordingly
+ if len(invoices) > 1:
+ result['domain'] = [('id', 'in', invoices.ids)]
+ elif len(invoices) == 1:
+ res = self.env.ref('account.view_move_form', False)
+ form_view = [(res and res.id or False, 'form')]
+ if 'views' in result:
+ result['views'] = form_view + [(state, view) for state, view in result['views'] if view != 'form']
+ else:
+ result['views'] = form_view
+ result['res_id'] = invoices.id
+ else:
+ result = {'type': 'ir.actions.act_window_close'}
+
+ return result
+
@api.onchange('date_doc_kirim')
def update_date_doc_kirim_so(self):
if not self.sale_id:
diff --git a/indoteknik_custom/models/uangmuka_pembelian.py b/indoteknik_custom/models/uangmuka_pembelian.py
new file mode 100644
index 00000000..797d7a01
--- /dev/null
+++ b/indoteknik_custom/models/uangmuka_pembelian.py
@@ -0,0 +1,107 @@
+from odoo import fields, models, _, api
+from odoo.exceptions import UserError
+from datetime import datetime
+from odoo.http import request
+
+import logging, math
+
+_logger = logging.getLogger(__name__)
+
+
+class UangmukaPembelian(models.TransientModel):
+ _name = 'uangmuka.pembelian'
+ _description = 'digunakan untuk membuat Uang Muka Pembelian'
+
+ pay_amt = fields.Float(string='Uang Muka', help='berapa nilai yang terbentuk untuk COA Uang Muka Pembelian')
+ account_id = fields.Many2one('account.account', string='Bank Intransit', default=389, help='pilih COA intransit bank')
+ ongkir_amt = fields.Float(string='Ongkir', help='masukan nilai yang akan menjadi Pendapatan Ongkos Kirim')
+ selisih_amt = fields.Float(string='Selisih', help='masukan nilai yang akan menjadi Selisih Pembayaran')
+ total_amt = fields.Float(string='Total', help='Total yang akan masuk di journal entries')
+
+ @api.onchange('pay_amt', 'ongkir_amt', 'selisih_amt')
+ def _compute_total_amt(self):
+ for o in self:
+ o.total_amt = o.pay_amt + o.ongkir_amt + o.selisih_amt
+
+ def create_uangmukapembelian(self):
+ if self.pay_amt <= 0:
+ raise UserError('Payment Amount harus diisi')
+ if not self.account_id:
+ raise UserError('Bank Intransit harus diisi')
+ if not self.env.user.is_accounting:
+ raise UserError('Hanya Finance yang dapat membuat Uang Muka Pembelian')
+
+ orders = self.env['purchase.order'].browse(self._context.get('active_ids',[]))
+ current_time = datetime.now()
+
+ is_have_ongkir = is_have_selisih = False
+ if self.ongkir_amt > 0:
+ is_have_ongkir = True
+ if not math.isclose(self.selisih_amt, 0):
+ is_have_selisih = True
+
+ for order in orders:
+ ref_label = 'UANG MUKA PEMBELIAN '+order.name+' '+order.partner_id.name
+ param_header = {
+ 'ref': ref_label,
+ 'date': current_time,
+ 'journal_id': 11
+ }
+
+ account_move = request.env['account.move'].create([param_header])
+ _logger.info('Success Create Uang Muka Pembelian %s' % account_move.name)
+
+ param_debit = {
+ 'move_id': account_move.id,
+ 'account_id': 401, # uang muka persediaan barang dagang
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': self.pay_amt,
+ 'credit': 0,
+ 'name': ref_label,
+ }
+ param_debit_ongkir = {
+ 'move_id': account_move.id,
+ 'account_id': 536, # biaya ongkos kirim
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': self.ongkir_amt,
+ 'credit': 0,
+ 'name': ref_label,
+ }
+ param_debit_selisih = {
+ 'move_id': account_move.id,
+ 'account_id': 561, # selisih pembayaran
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': self.selisih_amt,
+ 'credit': 0,
+ 'name': ref_label,
+ }
+
+ param_credit = {
+ 'move_id': account_move.id,
+ 'account_id': self.account_id.id, # bank in transit
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': 0,
+ 'credit': self.pay_amt + self.ongkir_amt + self.selisih_amt,
+ 'name': ref_label,
+ }
+ if is_have_ongkir and is_have_selisih:
+ request.env['account.move.line'].create([param_debit, param_debit_ongkir, param_debit_selisih, param_credit])
+ elif is_have_ongkir:
+ request.env['account.move.line'].create([param_debit, param_debit_ongkir, param_credit])
+ elif is_have_selisih:
+ request.env['account.move.line'].create([param_debit, param_debit_selisih, param_credit])
+ else:
+ request.env['account.move.line'].create([param_debit, param_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/uangmuka_penjualan.py b/indoteknik_custom/models/uangmuka_penjualan.py
new file mode 100644
index 00000000..ef0e9196
--- /dev/null
+++ b/indoteknik_custom/models/uangmuka_penjualan.py
@@ -0,0 +1,111 @@
+from odoo import fields, models, _, api
+from odoo.exceptions import UserError
+from datetime import datetime
+from odoo.http import request
+
+import logging, math
+
+_logger = logging.getLogger(__name__)
+
+
+class UangmukaPenjualan(models.TransientModel):
+ _name = 'uangmuka.penjualan'
+ _description = 'digunakan untuk membuat Uang Muka Penjualan'
+
+ pay_amt = fields.Float(string='Uang Muka', help='berapa nilai yang terbentuk untuk COA Uang Muka Penjualan')
+ account_id = fields.Many2one('account.account', string='Bank Intransit', default=389, help='pilih COA intransit bank')
+ ongkir_amt = fields.Float(string='Ongkir', help='masukan nilai yang akan menjadi Pendapatan Ongkos Kirim')
+ selisih_amt = fields.Float(string='Selisih', help='masukan nilai yang akan menjadi Selisih Pembayaran')
+ total_amt = fields.Float(string='Total', help='Total yang akan masuk di journal entries')
+
+ @api.onchange('pay_amt', 'ongkir_amt', 'selisih_amt')
+ def _compute_total_amt(self):
+ for o in self:
+ o.total_amt = o.pay_amt + o.ongkir_amt + o.selisih_amt
+
+ def create_uangmukapenjualan(self):
+ if self.pay_amt <= 0:
+ raise UserError('Payment Amount harus diisi')
+ if not self.account_id:
+ raise UserError('Bank Intransit harus diisi')
+ if not self.env.user.is_accounting:
+ raise UserError('Hanya Finance yang dapat membuat Uang Muka Penjualan')
+
+ is_have_ongkir = is_have_selisih = False
+
+ if self.ongkir_amt > 0:
+ is_have_ongkir = True
+ if not math.isclose(self.selisih_amt, 0):
+ is_have_selisih = True
+ # elif self.selisih_amt > 0:
+ # is_have_selisih = True
+
+ orders = self.env['sale.order'].browse(self._context.get('active_ids',[]))
+ current_time = datetime.now()
+
+ for order in orders:
+ ref_label = 'UANG MUKA PENJUALAN '+order.name+' '+order.partner_id.name
+ param_header = {
+ 'ref': ref_label,
+ 'date': current_time,
+ 'journal_id': 11
+ }
+
+ account_move = request.env['account.move'].create([param_header])
+ _logger.info('Success Create Uang Muka Penjualan %s' % account_move.name)
+
+ param_debit = {
+ 'move_id': account_move.id,
+ 'account_id': self.account_id.id, # intransit
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': self.pay_amt + self.ongkir_amt + self.selisih_amt,
+ 'credit': 0,
+ 'name': ref_label,
+ }
+ # sisa di credit untuk uang muka penjualan, diluar ongkir dan selisih
+ param_credit = {
+ 'move_id': account_move.id,
+ 'account_id': 449, # uang muka penjualan
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': 0,
+ 'credit': self.pay_amt,
+ 'name': ref_label,
+ }
+ param_ongkir_credit = {
+ 'move_id': account_move.id,
+ 'account_id': 550, # pendapatan ongkos kirim
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': 0,
+ 'credit': self.ongkir_amt,
+ 'name': ref_label,
+ }
+ param_selisih_credit = {
+ 'move_id': account_move.id,
+ 'account_id': 561, # selisih pembayaran
+ 'partner_id': order.partner_id.id,
+ 'currency_id': 12,
+ 'debit': 0,
+ 'credit': self.selisih_amt,
+ 'name': ref_label,
+ }
+
+ if is_have_ongkir and is_have_selisih:
+ request.env['account.move.line'].create([param_debit, param_credit, param_ongkir_credit, param_selisih_credit])
+ elif is_have_ongkir:
+ request.env['account.move.line'].create([param_debit, param_credit, param_ongkir_credit])
+ elif is_have_selisih:
+ request.env['account.move.line'].create([param_debit, param_credit, param_selisih_credit])
+ else:
+ request.env['account.move.line'].create([param_debit, param_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/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index e704f5a1..65ab0a6c 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -38,4 +38,6 @@ access_wati_notification,access.wati.notification,model_wati_notification,,1,1,1
access_wati_api,access.wati.api,model_wati_api,,1,1,1,1
access_wati_contact,access.wati.contact,model_wati_contact,,1,1,1,1
access_user_company_request,access.user.company.request,model_user_company_request,,1,1,1,1
-access_res_partner_company_type,access.res.partner.company_type,model_res_partner_company_type,,1,1,1,1 \ No newline at end of file
+access_res_partner_company_type,access.res.partner.company_type,model_res_partner_company_type,,1,1,1,1
+access_uangmuka_penjualan,access.uangmuka.penjualan,model_uangmuka_penjualan,,1,1,1,1
+access_uangmuka_pembelian,access.uangmuka.pembelian,model_uangmuka_pembelian,,1,1,1,1 \ No newline at end of file
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index af4eaa05..4c99692d 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -34,8 +34,6 @@
<field name="payment_state" position="after">
<field name="invoice_payment_term_id"/>
<field name="date_kirim_tukar_faktur"/>
- <field name="shipper_faktur_id"/>
- <field name="resi_tukar_faktur"/>
<field name="date_terima_tukar_faktur"/>
</field>
</field>
diff --git a/indoteknik_custom/views/crm_lead.xml b/indoteknik_custom/views/crm_lead.xml
index 5d9969a0..58c3987a 100755
--- a/indoteknik_custom/views/crm_lead.xml
+++ b/indoteknik_custom/views/crm_lead.xml
@@ -44,6 +44,9 @@
</group>
</page>
</page>
+ <field name="message_bounce" position="after">
+ <field name="order_id"/>
+ </field>
</field>
</record>
</data>
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 3220c1da..fb85f4c1 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -25,6 +25,8 @@
string="Ask Approval"
type="object"
/>
+ <button name="indoteknik_custom.action_view_uangmuka_pembelian" string="UangMuka"
+ type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
</button>
<field name="date_order" position="before">
<field name="sale_order_id" attrs="{'readonly': [('state', 'not in', ['draft'])]}"/>
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index d6df24a0..203b2d13 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -15,6 +15,8 @@
string="Ask Approval"
type="object"
/>
+ <button name="indoteknik_custom.action_view_uangmuka_penjualan" string="UangMuka"
+ type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
</button>
<field name="payment_term_id" position="after">
<field name="shipping_cost_covered"/>
@@ -44,7 +46,7 @@
</attribute>
</xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_total']" position="after">
- <field name="vendor_id" attrs="{'readonly': [('parent.state', 'not in', ['draft', 'sent', 'sale'])]}"/>
+ <field name="vendor_id" attrs="{'readonly': [('parent.approval_status', '=', 'approved')]}"/>
<field name="purchase_price" attrs="
{
'readonly': [
@@ -54,7 +56,7 @@
]
}
"/>
- <field name="purchase_tax_id" attrs="{'readonly': [('parent.state', 'not in', ['draft', 'sent', 'sale'])]}" domain="[('type_tax_use','=','purchase')]"/>
+ <field name="purchase_tax_id" attrs="{'readonly': [('parent.approval_status', '!=', False)]}" domain="[('type_tax_use','=','purchase')]"/>
<field name="item_percent_margin"/>
</xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" position="before">
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index 866c1aac..0ff79ea8 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -31,6 +31,11 @@
type="object"
attrs="{'invisible': ['|', ('state', '=', 'draft'), ('state', '=', 'cancel'), ('approval_return_status', '=', 'pengajuan1')]}"
/>
+ <button name="action_create_invoice_from_mr"
+ string="Create Bill"
+ type="object"
+ attrs="{'invisible': [('state', '!=', 'done')]}"
+ />
</button>
<field name="backorder_id" position="after">
<field name="is_internal_use"
diff --git a/indoteknik_custom/views/uangmuka_pembelian.xml b/indoteknik_custom/views/uangmuka_pembelian.xml
new file mode 100644
index 00000000..7bc6e7a6
--- /dev/null
+++ b/indoteknik_custom/views/uangmuka_pembelian.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="view_uangmuka_pembelian" model="ir.ui.view">
+ <field name="name">Uangmuka Pembelian</field>
+ <field name="model">uangmuka.pembelian</field>
+ <field name="arch" type="xml">
+ <form string="Invoice Sales Order">
+ <p class="oe_grey">
+ Pembuatan semi otomatis Uang Muka Pembelian, mohon dicek kembali
+ </p>
+ <group>
+ <field name="pay_amt"/>
+ <field name="ongkir_amt"/>
+ <field name="selisih_amt"/>
+ <field name="account_id" domain="[('name', 'ilike', 'intransit')]"/>
+ <field name="total_amt" readonly="1"/>
+ </group>
+ <footer>
+ <button name="create_uangmukapembelian" id="create_uangmukapembelian" string="Create" type="object" required="1"/>
+ </footer>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_view_uangmuka_pembelian" model="ir.actions.act_window">
+ <field name="name">Create Uang Muka Pembelian</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">uangmuka.pembelian</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+
+</odoo>
diff --git a/indoteknik_custom/views/uangmuka_penjualan.xml b/indoteknik_custom/views/uangmuka_penjualan.xml
new file mode 100644
index 00000000..f2fc83bc
--- /dev/null
+++ b/indoteknik_custom/views/uangmuka_penjualan.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="view_uangmuka_penjualan" model="ir.ui.view">
+ <field name="name">Uangmuka Penjualan</field>
+ <field name="model">uangmuka.penjualan</field>
+ <field name="arch" type="xml">
+ <form string="Invoice Sales Order">
+ <p class="oe_grey">
+ Pembuatan semi otomatis Uang Muka Penjualan, mohon dicek kembali
+ </p>
+ <group>
+ <field name="pay_amt"/>
+ <field name="ongkir_amt"/>
+ <field name="selisih_amt"/>
+ <field name="account_id" domain="[('name', 'ilike', 'intransit')]"/>
+ <field name="total_amt" readonly="1"/>
+ </group>
+ <footer>
+ <button name="create_uangmukapenjualan" id="create_uangmukapenjualan" string="Create" type="object" required="1"/>
+ </footer>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_view_uangmuka_penjualan" model="ir.actions.act_window">
+ <field name="name">Create Uang Muka Penjualan</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">uangmuka.penjualan</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+
+</odoo>