summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-05-30 16:09:35 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-05-30 16:09:35 +0700
commit65fe5e9cb0865293eb6d0626d2c99f35d6862b3c (patch)
tree9b101f91df2be5e08a489991579b9edd691cbdfd /indoteknik_custom/models
parentc0bc0039928cdb7e2eef8e39dc5daad6e5ecfc28 (diff)
add invoice_date_due and terima faktur on bills
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rw-r--r--indoteknik_custom/models/account_move.py9
-rw-r--r--indoteknik_custom/models/account_move_multi_update_bills.py26
-rw-r--r--indoteknik_custom/models/purchasing_job.py15
-rwxr-xr-xindoteknik_custom/models/sale_order.py2
5 files changed, 48 insertions, 5 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 33aa0784..cd1e4d29 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -113,3 +113,4 @@ from . import sales_order_fullfillment
from . import res_partner_site
from . import external_api
from . import ged
+from . import account_move_multi_update_bills
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index b306b6af..aa8b97be 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -246,7 +246,7 @@ class AccountMove(models.Model):
due_date = tukar_date + timedelta(days=add_days)
invoice.invoice_date_due = due_date
- @api.onchange('date_terima_tukar_faktur')
+ @api.constrains('date_terima_tukar_faktur')
def change_date_terima_tukar_faktur(self):
for invoice in self:
if not invoice.date_terima_tukar_faktur:
@@ -266,6 +266,13 @@ class AccountMove(models.Model):
}
return action
+ def open_form_multi_update_bills(self):
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_account_move_multi_update_bills')
+ action['context'] = {
+ 'move_ids': [x.id for x in self]
+ }
+ return action
+
@api.constrains('efaktur_id', 'ref', 'date', 'journal_id', 'name')
def constrains_edit(self):
for rec in self.line_ids:
diff --git a/indoteknik_custom/models/account_move_multi_update_bills.py b/indoteknik_custom/models/account_move_multi_update_bills.py
new file mode 100644
index 00000000..d348beed
--- /dev/null
+++ b/indoteknik_custom/models/account_move_multi_update_bills.py
@@ -0,0 +1,26 @@
+from odoo import models, fields
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class AccountMoveMultiUpdateBills(models.TransientModel):
+ _name = 'account.move.multi_update_bills'
+
+ date_terima_tukar_faktur = fields.Date(string="Terima Faktur")
+
+ def save_multi_update_bills(self):
+ move_ids = self._context['move_ids']
+ moves = self.env['account.move'].browse(move_ids)
+ moves.update({
+ 'date_terima_tukar_faktur': self.date_terima_tukar_faktur
+ })
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'params': {
+ 'title': 'Notification',
+ 'message': 'Account Move berhasil diubah',
+ 'next': {'type': 'ir.actions.act_window_close'},
+ }
+ } \ No newline at end of file
diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py
index 86f8afcc..373e469a 100644
--- a/indoteknik_custom/models/purchasing_job.py
+++ b/indoteknik_custom/models/purchasing_job.py
@@ -188,9 +188,18 @@ class OutstandingSales(models.Model):
tools.drop_view_if_exists(self.env.cr, self._table)
self.env.cr.execute("""
CREATE OR REPLACE VIEW v_sales_outstanding AS (
- select sm.id, sm.id as move_id, sp.id as picking_id, sm.product_id, so.id as sale_id,
- sol.id as sale_line_id, rp.id as partner_id, so.user_id as salesperson_id, so.partner_invoice_id,
- sp.origin, rp2.name as salesperson, coalesce(pp.default_code, pt.default_code) as item_code, pt.name as product,
+ select sm.id,
+ sm.id as move_id,
+ sp.id as picking_id,
+ sm.product_id,
+ so.id as sale_id,
+ sol.id as sale_line_id,
+ rp.id as partner_id,
+ so.user_id as salesperson_id,
+ so.partner_invoice_id,
+ sp.origin,
+ rp2.name as salesperson,
+ coalesce(pp.default_code, pt.default_code) as item_code, pt.name as product,
sm.product_uom_qty as outgoing, xm.x_name as brand, rp.name as invoice_partner
from stock_move sm
join stock_picking sp on sp.id = sm.picking_id
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index dd6753aa..9a4f9035 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -423,7 +423,7 @@ class SaleOrder(models.Model):
if self.payment_term_id.id == 31 and self.total_percent_margin < 25:
raise UserError("Jika ingin menggunakan Tempo 90 Hari maka margin harus di atas 25%")
- if self.warehouse_id.id != 8: #GD Bandengan
+ if self.warehouse_id.id != 8 and self.warehouse_id.id != 10: #GD Bandengan
raise UserError('Gudang harus Bandengan')
if self.state not in ['draft', 'sent']: