summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-11-03 10:46:02 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-11-03 10:46:02 +0700
commita4cd5ce9cd8d5ef38062732a16a61d6d5c094e30 (patch)
tree324faf41d77339169cb95df7efe8275915c00fc2
parent6b49797aca36574497f93a06f8e1c0622e5ad009 (diff)
initial commit for new window of customer commision
-rwxr-xr-xindoteknik_custom/__manifest__.py1
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rw-r--r--indoteknik_custom/models/commision.py41
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv4
-rw-r--r--indoteknik_custom/views/customer_commision.xml82
-rw-r--r--indoteknik_custom/views/ir_sequence.xml10
6 files changed, 138 insertions, 1 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 3bc4be60..a758d636 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -100,6 +100,7 @@
'views/stock_move_line.xml',
'views/product_monitoring.xml',
'views/stock_warehouse_orderpoint.xml',
+ 'views/customer_commision.xml',
'report/report.xml',
'report/report_banner_banner.xml',
'report/report_banner_banner2.xml',
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 6a5eac00..e842b511 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -91,3 +91,4 @@ from . import sale_orders_multi_update
from . import quotation_so_multi_update
from . import product_monitoring
from . import stock_warehouse_orderpoint
+from . import commision
diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py
new file mode 100644
index 00000000..e39deb63
--- /dev/null
+++ b/indoteknik_custom/models/commision.py
@@ -0,0 +1,41 @@
+from odoo import models, api, fields
+from odoo.exceptions import UserError
+from datetime import datetime
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class CustomerCommision(models.Model):
+ _name = 'customer.commision'
+ _order = 'id desc'
+
+ number = fields.Char(string='Document No', index=True, copy=False, readonly=True)
+ date_from = fields.Date(string='Date From', required=True)
+ date_to = fields.Date(string='Date To', required=True)
+ partner_id = fields.Many2one('res.partner', String='Customer', required=True)
+ description = fields.Char(string='Description')
+ notification = fields.Char(string='Notification')
+ commision_lines = fields.One2many('customer.commision.line', 'customer_commision_id', string='Lines', auto_join=True)
+
+ @api.model
+ def create(self, vals):
+ vals['number'] = self.env['ir.sequence'].next_by_code('customer.commision') or '0'
+ result = super(CustomerCommision, self).create(vals)
+ return result
+
+ def generate_customer_commision(self):
+ print("masuk")
+ return
+
+class CustomerCommisionLine(models.Model):
+ _name = 'customer.commision.line'
+ _order = 'id'
+
+ customer_commision_id = fields.Many2one('customer.commision', string='Ref', required=True, ondelete='cascade', copy=False)
+ invoice_id = fields.Many2one('account.move', string='Invoice')
+ partner_id = fields.Many2one('res.partner', string='Customer')
+ state = fields.Char(string='InvStatus')
+ dpp = fields.Float(string='DPP')
+ tax = fields.Float(string='TaxAmt')
+ total = fields.Float(string='Total')
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index 7a074c71..ed8d4725 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -78,4 +78,6 @@ access_stock_scheduler_compute,access.stock.scheduler.compute,model_stock_schedu
access_sale_order_promotion,access.sale.order.promotion,model_sale_order_promotion,,1,1,1,1
access_sale_orders_multi_update,access.sale.orders.multi_update,model_sale_orders_multi_update,,1,1,1,1
access_quotation_so_multi_update,access.quotation.so.multi_update,model_quotation_so_multi_update,,1,1,1,1
-access_product_monitoring,access.product.monitoring,model_product_monitoring,,1,1,1,1 \ No newline at end of file
+access_product_monitoring,access.product.monitoring,model_product_monitoring,,1,1,1,1
+access_customer_commision,access.customer.commision,model_customer_commision,,1,1,1,1
+access_customer_commision_line,access.customer.commision.line,model_customer_commision_line,,1,1,1,1 \ No newline at end of file
diff --git a/indoteknik_custom/views/customer_commision.xml b/indoteknik_custom/views/customer_commision.xml
new file mode 100644
index 00000000..a714cb80
--- /dev/null
+++ b/indoteknik_custom/views/customer_commision.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <record id="customer_commision_tree" model="ir.ui.view">
+ <field name="name">customer.commision.tree</field>
+ <field name="model">customer.commision</field>
+ <field name="arch" type="xml">
+ <tree>
+ <field name="number"/>
+ <field name="date_from"/>
+ <field name="date_to"/>
+ <field name="partner_id"/>
+ <field name="description"/>
+ <field name="notification" readonly="1"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="customer_commision_line_tree" model="ir.ui.view">
+ <field name="name">customer.commision.line.tree</field>
+ <field name="model">customer.commision.line</field>
+ <field name="arch" type="xml">
+ <tree editable="top" create="false" delete="false">
+ <field name="partner_id" readonly="1"/>
+ <field name="invoice_id" readonly="1"/>
+ <field name="state" readonly="1"/>
+ <field name="dpp" readonly="1"/>
+ <field name="tax" readonly="1"/>
+ <field name="total" readonly="1"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="customer_commision_form" model="ir.ui.view">
+ <field name="name">customer_commision_form</field>
+ <field name="model">customer.commision</field>
+ <field name="arch" type="xml">
+ <form>
+ <sheet string="Customer Commision">
+ <div class="oe_button_box" name="button_box"/>
+ <group>
+ <group>
+ <field name="number"/>
+ <field name="date_from"/>
+ <field name="date_to"/>
+ <field name="partner_id"/>
+ <field name="description"/>
+ <field name="notification" readonly="1"/>
+ </group>
+ <group>
+ <div>
+ <button name="generate_customer_commision"
+ string="Generate Line"
+ type="object"
+ class="mr-2 oe_highlight"
+ />
+ </div>
+ </group>
+ </group>
+ <notebook>
+ <page string="Lines">
+ <field name="commision_lines"/>
+ </page>
+ </notebook>
+ </sheet>
+ </form>
+ </field>
+ </record>
+
+ <record id="customer_commision_action" model="ir.actions.act_window">
+ <field name="name">Customer Commision</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">customer.commision</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem id="menu_customer_commision"
+ name="Customer Commision"
+ action="customer_commision_action"
+ parent="account.menu_finance_entries"
+ sequence="113"
+ />
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml
index 6798e5b4..86259b12 100644
--- a/indoteknik_custom/views/ir_sequence.xml
+++ b/indoteknik_custom/views/ir_sequence.xml
@@ -60,5 +60,15 @@
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>
+
+ <record id="sequence_commision_customer" model="ir.sequence">
+ <field name="name">Customer Commision</field>
+ <field name="code">customer.commision</field>
+ <field name="active">TRUE</field>
+ <field name="prefix">CC/%(year)s/</field>
+ <field name="padding">5</field>
+ <field name="number_next">1</field>
+ <field name="number_increment">1</field>
+ </record>
</data>
</odoo> \ No newline at end of file