From a4cd5ce9cd8d5ef38062732a16a61d6d5c094e30 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 3 Nov 2023 10:46:02 +0700 Subject: initial commit for new window of customer commision --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/commision.py | 41 +++++++++++++ indoteknik_custom/security/ir.model.access.csv | 4 +- indoteknik_custom/views/customer_commision.xml | 82 ++++++++++++++++++++++++++ indoteknik_custom/views/ir_sequence.xml | 10 ++++ 6 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 indoteknik_custom/models/commision.py create mode 100644 indoteknik_custom/views/customer_commision.xml 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 @@ + + + + customer.commision.tree + customer.commision + + + + + + + + + + + + + + customer.commision.line.tree + customer.commision.line + + + + + + + + + + + + + + customer_commision_form + customer.commision + +
+ +
+ + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + Customer Commision + ir.actions.act_window + customer.commision + tree,form + + + + \ 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 @@ 1 1 + + + Customer Commision + customer.commision + TRUE + CC/%(year)s/ + 5 + 1 + 1 + \ No newline at end of file -- cgit v1.2.3