diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-16 11:39:21 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-16 11:39:21 +0700 |
| commit | 31dafc8b2e6e672afe597439983c07641c10e078 (patch) | |
| tree | 4c6ccc6d2b066c5609b8691a42334d685d5c2124 | |
| parent | 3a954e59343d2d3a3df5436297f7007008ae62e8 (diff) | |
| parent | 43ccd7dae4940fcbf40f069e6b5a36aeedc59555 (diff) | |
Merge branch 'production' of https://bitbucket.org/altafixco/indoteknik-addons into production
| -rw-r--r-- | indoteknik_custom/models/account_financial_report.py | 13 | ||||
| -rwxr-xr-x | indoteknik_custom/models/crm_lead.py | 21 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 7 | ||||
| -rwxr-xr-x | indoteknik_custom/views/crm_lead.xml | 3 | ||||
| -rw-r--r-- | indoteknik_custom/views/mail_template_po.xml | 8 |
6 files changed, 41 insertions, 13 deletions
diff --git a/indoteknik_custom/models/account_financial_report.py b/indoteknik_custom/models/account_financial_report.py index 315515f6..6147a3f3 100644 --- a/indoteknik_custom/models/account_financial_report.py +++ b/indoteknik_custom/models/account_financial_report.py @@ -23,10 +23,11 @@ class AccountingReport(models.TransientModel): output = io.BytesIO() workbook = xlsxwriter.Workbook(output, {'in_memory': True}) - + journal_entries = self.env['account.move'].search([('move_type', '=', 'entry')], order='date asc', limit=1) + first_journal_date = journal_entries.date data = {} data['form'] = obj.read([])[0] - + date_from = data['form']['date_from'] date_to = data['form']['date_to'] @@ -69,7 +70,7 @@ class AccountingReport(models.TransientModel): for date_range in date_ranges: row_number = 9 data['form']['used_context']['date_to'] = date_range['date_to'] - data['form']['used_context']['date_from'] = date_range['date_from'] + data['form']['used_context']['date_from'] = first_journal_date comp_dic['state'] = 'posted' comp_dic['journal_ids'] = data['form']['journal_ids'] data['form']['comparison_context'] = comp_dic @@ -164,9 +165,7 @@ class AccountingReport(models.TransientModel): while current_date <= date_to: next_month = current_date.replace(day=1) + timedelta(days=32) - end_of_month = next_month - timedelta(days=next_month.day) - if end_of_month > date_to: - end_of_month = date_to + end_of_month = min(next_month - timedelta(days=next_month.day), date_to) date_ranges.append({ "date_from": current_date, @@ -175,4 +174,4 @@ class AccountingReport(models.TransientModel): current_date = end_of_month + timedelta(days=1) - return date_ranges
\ No newline at end of file + return date_ranges diff --git a/indoteknik_custom/models/crm_lead.py b/indoteknik_custom/models/crm_lead.py index e5d9953b..0c38ae56 100755 --- a/indoteknik_custom/models/crm_lead.py +++ b/indoteknik_custom/models/crm_lead.py @@ -1,6 +1,7 @@ from odoo import fields, models, api import logging import random +from odoo.exceptions import AccessError, UserError, ValidationError _logger = logging.getLogger(__name__) @@ -21,7 +22,27 @@ class CrmLead(models.Model): 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') + reason = fields.Selection([ + ('new_so', 'Diganti SO Baru'), + ('out_stock', 'Stock Tidak Tersedia'), + ('wrong_price', 'Salah Memberikan Informasi Harga'), + ('discontinue', 'Barang Discontinue'), + ('change_of_mind', 'Konsumen Berubah Pikiran'), + ('problematic_items', 'Barang Yang Dibeli Bermasalah'), + ('no_tempo', 'Konsumen Tidak Mendapatkan Tempo'), + ('payment_issues', 'Konsumen Memiliki Masalah Pembayaran'), + ('disagree_shipping', 'Tidak Sepakat Dengan Biaya Kirim'), + ('payment_not_received', 'Pembayaran Belum Diterima'), + ('delivery_time', 'Tidak Sanggup Memenuhi Delivery Time'), + ('fraud_indication', 'Indikasi Penipuan'), + ], string='Reason Mark Lost', tracking=True) + def action_set_lost(self): + result = super(CrmLead, self).action_set_lost() + if not self.reason: + raise UserError('Jika ingin Mark as Lost, Isi Reason nya terlebih dahulu') + return result + @api.onchange('user_id') def _change_salesperson_so(self): if self.order_id: diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index d73f9037..9e851ef9 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -196,7 +196,7 @@ class PurchaseOrder(models.Model): for line in self.order_line: if not line.product_id.purchase_ok: raise UserError("Terdapat barang yang tidak bisa diproses") - if line.price_vendor != 0 and line.price_unit != line.price_vendor: + if line.price_unit != line.price_vendor: send_email = True break diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 1695639d..bc2a24b1 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -1,4 +1,4 @@ -from odoo import models, fields +from odoo import models, fields, api from odoo.exceptions import UserError, ValidationError class GroupPartner(models.Model): @@ -28,6 +28,11 @@ class ResPartner(models.Model): partner_child_ids += [partner.parent_id.id] return partner_child_ids + @api.constrains('kota_id') + def update_product_solr_flag(self): + for partner in self: + partner.city = partner.kota_id.name + def unlink(self): if self._name == 'res.partner': raise UserError('Maaf anda tidak bisa delete contact') diff --git a/indoteknik_custom/views/crm_lead.xml b/indoteknik_custom/views/crm_lead.xml index 58c3987a..9e4a43f2 100755 --- a/indoteknik_custom/views/crm_lead.xml +++ b/indoteknik_custom/views/crm_lead.xml @@ -47,6 +47,9 @@ <field name="message_bounce" position="after"> <field name="order_id"/> </field> + <field name="lang_id" position="after"> + <field name="reason"/> + </field> </field> </record> </data> diff --git a/indoteknik_custom/views/mail_template_po.xml b/indoteknik_custom/views/mail_template_po.xml index 410520b3..4eca1ab2 100644 --- a/indoteknik_custom/views/mail_template_po.xml +++ b/indoteknik_custom/views/mail_template_po.xml @@ -1,12 +1,12 @@ <?xml version="1.0" ?> <odoo> - <data noupdate="0"> + <data noupdate="1"> <record id="mail_template_po_sync_price" model="mail.template"> <field name="name">PO: Sync Unit Price Purchase Pricelist</field> <field name="model_id" ref="model_purchase_order" /> <field name="subject">Your PO ${object.name}</field> <field name="email_from"></field> - <field name="email_to">darren@indoteknik.co.id</field> + <field name="email_to">darren@indoteknik.co.id, tyas@indoteknik.com, azkan4elll@gmail.com</field> <field name="body_html" type="html"> <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"> @@ -45,13 +45,13 @@ <tr> <td valign="top" style="font-size: 13px;"> <div> - Dear Stefanus Darren, + Dear Stefanus Darren & Tyas K Putra, <br/><br/> Terdapat PO yang harga Unit Price nya tidak sama dengan yang ada di purchase pricelist nya. <br/><br/> Berikut adalah rincian PO: % for line in object.order_line: - % if line.price_vendor != 0 and line.price_unit != line.price_vendor + % if line.price_unit != line.price_vendor <ul> <li>Nama Produk: ${line.product_id.name}</li> <li>Harga Unit dalam PO: Rp ${'{:,.2f}'.format(line.price_unit)}</li> |
