summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-07-25 08:53:19 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-07-25 08:53:19 +0000
commit5ead2c84fb9b56d51520f77af8227160b56aeaca (patch)
tree4c0e32918e1ddf4e7a3e9116d3abb186ad417c7f /indoteknik_custom/models
parentc344ccd81208b5b466ae047dbb9e084dd5d0f358 (diff)
parente933a05e9b03e489b581f27d1aa304774aafc320 (diff)
Merged in production (pull request #68)
Production
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/__init__.py3
-rw-r--r--indoteknik_custom/models/account_move.py9
-rw-r--r--indoteknik_custom/models/account_move_multi_update.py26
-rw-r--r--indoteknik_custom/models/voucher.py2
4 files changed, 37 insertions, 3 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 929fc8ba..5b8fcc54 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -71,4 +71,5 @@ from . import token_storage
from . import product_sla
from . import account_move_due_extension
from . import voucher
-from . import bill_receipt \ No newline at end of file
+from . import bill_receipt
+from . import account_move_multi_update \ No newline at end of file
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 33fb73b5..4db97706 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -115,4 +115,11 @@ class AccountMove(models.Model):
add_days += line.days
due_date = tukar_date + timedelta(days=add_days)
invoice.invoice_date_due = due_date
- \ No newline at end of file
+
+ def open_form_multi_update(self):
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_account_move_multi_update')
+ action['context'] = {
+ 'move_ids': [x.id for x in self]
+ }
+ return action
+ \ No newline at end of file
diff --git a/indoteknik_custom/models/account_move_multi_update.py b/indoteknik_custom/models/account_move_multi_update.py
new file mode 100644
index 00000000..4b650868
--- /dev/null
+++ b/indoteknik_custom/models/account_move_multi_update.py
@@ -0,0 +1,26 @@
+from odoo import models, fields
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class AccountMoveMultiUpdate(models.TransientModel):
+ _name = 'account.move.multi_update'
+
+ payment_schedule = fields.Date(string="Jadwal Pembayaran")
+
+ def save_multi_update(self):
+ move_ids = self._context['move_ids']
+ moves = self.env['account.move'].browse(move_ids)
+ moves.update({
+ 'payment_schedule': self.payment_schedule
+ })
+ 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/voucher.py b/indoteknik_custom/models/voucher.py
index b3a55499..a7151398 100644
--- a/indoteknik_custom/models/voucher.py
+++ b/indoteknik_custom/models/voucher.py
@@ -107,7 +107,7 @@ class Voucher(models.Model):
if self.discount_type == 'percentage':
discount = price * self.discount_amount / 100
max_disc = self.max_discount_amount
- return max_disc if discount > max_disc else discount
+ return discount if max_disc == 0 else min(discount, max_disc)
return 0