summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2022-08-23 09:29:19 +0700
committerIT Fixcomart <it@fixcomart.co.id>2022-08-23 09:29:19 +0700
commitc369d67e08b50350705011e01b3f5ec78dcb7d11 (patch)
treeff62225d7d409a2dc7c62f12a3be8944d4247649
parent055e68b5c1c20795c569d67d6bf7363c90182470 (diff)
parent2d82c8d8baf38be2349a87c9f8e9919c9e9de78a (diff)
Merge branch 'development' of bitbucket.org:altafixco/indoteknik-addons into development
# Conflicts: # indoteknik_custom/models/__init__.py
-rwxr-xr-xindoteknik_custom/__manifest__.py1
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rw-r--r--indoteknik_custom/models/account_asset.py12
-rwxr-xr-xindoteknik_custom/models/sale_monitoring.py8
-rwxr-xr-xindoteknik_custom/models/sale_monitoring_detail.py6
-rwxr-xr-xindoteknik_custom/models/sale_order.py91
-rwxr-xr-xindoteknik_custom/models/x_manufactures.py1
-rw-r--r--indoteknik_custom/views/account_asset_views.xml18
-rwxr-xr-xindoteknik_custom/views/sale_monitoring.xml4
-rwxr-xr-xindoteknik_custom/views/sale_monitoring_detail.xml4
-rwxr-xr-xindoteknik_custom/views/sale_order.xml8
11 files changed, 101 insertions, 53 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 61b51eed..919a61a2 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -31,6 +31,7 @@
'views/stock_vendor.xml',
'views/crm_lead.xml',
'views/sale_order.xml',
+ 'views/account_asset_views.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 f4b2f27d..25341923 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -18,3 +18,4 @@ from . import sale_order
from . import sale_monitoring_detail
from . import sale_monitoring
from . import account_move
+from . import account_asset
diff --git a/indoteknik_custom/models/account_asset.py b/indoteknik_custom/models/account_asset.py
new file mode 100644
index 00000000..bd5f9adb
--- /dev/null
+++ b/indoteknik_custom/models/account_asset.py
@@ -0,0 +1,12 @@
+from odoo import fields, models, api, _
+from odoo.exceptions import AccessError, UserError, ValidationError
+
+
+class AccountAsset(models.Model):
+ _inherit = 'account.asset.asset'
+
+ def action_close_asset(self):
+ for asset in self:
+ if asset.value > 0:
+ raise UserError("Asset masih mempunyai Value")
+ asset.state = 'close'
diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py
index 70c51132..97e96e72 100755
--- a/indoteknik_custom/models/sale_monitoring.py
+++ b/indoteknik_custom/models/sale_monitoring.py
@@ -8,6 +8,8 @@ class SaleMonitoring(models.Model):
id = fields.Integer()
sale_order_id = fields.Many2one("sale.order", string="Sale Order")
+ partner_id = fields.Many2one("res.partner", string="Customer")
+ user_id = fields.Many2one("res.users", string="Salesperson")
qty_so = fields.Integer(string="Qty SO")
qty_po = fields.Integer(string="Qty PO")
qty_po_received = fields.Integer(string="Qty PO Received")
@@ -23,7 +25,9 @@ class SaleMonitoring(models.Model):
SELECT
smd.sale_order_id AS id,
smd.date_order,
- smd.sale_order_id,
+ smd.sale_order_id,
+ smd.partner_id,
+ smd.user_id,
SUM(smd.qty_so) AS qty_so,
SUM(smd.qty_po) AS qty_po,
SUM(smd.qty_po_received) AS qty_po_received,
@@ -39,6 +43,6 @@ class SaleMonitoring(models.Model):
ELSE 'Belum Invoiced'
END AS status
FROM sale_monitoring_detail smd
- GROUP BY smd.date_order, smd.sale_order_id
+ GROUP BY smd.date_order, smd.sale_order_id, smd.partner_id, smd.user_id
)
""" % self._table)
diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py
index ec9fe222..cb412c98 100755
--- a/indoteknik_custom/models/sale_monitoring_detail.py
+++ b/indoteknik_custom/models/sale_monitoring_detail.py
@@ -8,6 +8,8 @@ class SaleMonitoringDetail(models.Model):
id = fields.Integer()
sale_order_id = fields.Many2one("sale.order", string="Sale Order")
+ partner_id = fields.Many2one("res.partner", string="Customer")
+ user_id = fields.Many2one("res.users", string="Salesperson")
product_id = fields.Many2one("product.product", string="Product")
qty_so = fields.Integer(string="Qty SO")
qty_po = fields.Integer(string="Qty PO")
@@ -36,7 +38,9 @@ class SaleMonitoringDetail(models.Model):
(
SELECT
p.id AS id,
- so.id AS sale_order_id,
+ so.id AS sale_order_id,
+ so.partner_id as partner_id,
+ so.user_id,
p.id AS product_id,
sol.product_uom_qty AS qty_so,
sol.qty_delivered AS qty_so_delivered,
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 44eeae60..50e6baa3 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -12,40 +12,39 @@ class SaleOrder(models.Model):
total_percent_margin = fields.Float(
'Total Percent Margin', compute='compute_total_margin',
help="Total % Margin in Sales Order Header")
- # approval_status = fields.Integer('Approval Status', copy=False)
approval_status = fields.Selection([
('pengajuan1', 'Approval Adela'),
('pengajuan2', 'Approval Tyas'),
('approved', 'Approved'),
], string='Approval Status', readonly=True, copy=False, index=True, tracking=3)
- def sale_order_approve(self):
- for order in self:
- if order.state == 'cancel' or order.state == 'done' or order.state == 'sale':
- raise UserError("Status harus draft atau sent")
- approval1 = approval2 = 0
- for line in order.order_line:
- if not line.product_id:
- continue
- if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and (
- self.env.user.id != 6 and self.env.user.id != 7):
- approval2 += 1
- # order.approval_status = "pengajuan2"
- # break
- elif line.item_percent_margin <= 40 and (self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7):
- approval1 += 1
- # order.approval_status = 'pengajuan1'
- # break
- if approval2 > 0:
- order.approval_status = 'pengajuan2'
- elif approval1 > 0:
- order.approval_status = 'pengajuan1'
- else:
- raise UserError("Bisa langsung Confirm")
+ # def sale_order_approve(self):
+ # for order in self:
+ # if order.state == 'cancel' or order.state == 'done' or order.state == 'sale':
+ # raise UserError("Status harus draft atau sent")
+ # approval1 = approval2 = 0
+ # for line in order.order_line:
+ # if not line.product_id:
+ # continue
+ # if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and (
+ # self.env.user.id != 6 and self.env.user.id != 7):
+ # approval2 += 1
+ # # order.approval_status = "pengajuan2"
+ # # break
+ # elif line.item_percent_margin <= 40 and (self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7):
+ # approval1 += 1
+ # # order.approval_status = 'pengajuan1'
+ # # break
+ # if approval2 > 0:
+ # order.approval_status = 'pengajuan2'
+ # elif approval1 > 0:
+ # order.approval_status = 'pengajuan1'
+ # else:
+ # raise UserError("Bisa langsung Confirm")
- def action_cancel(self):
- self.approval_status = False
- return super(SaleOrder, self).action_cancel()
+ # def action_cancel(self):
+ # self.approval_status = False
+ # return super(SaleOrder, self).action_cancel()
def compute_total_margin(self):
for order in self:
@@ -61,25 +60,25 @@ class SaleOrder(models.Model):
total_percent_margin = round((total_margin / order.amount_untaxed), 4) * 100
order.total_percent_margin = total_percent_margin
- def action_confirm(self):
- res = super(SaleOrder, self).action_confirm()
- for order in self:
- approval1 = approval2 = 0
- for line in order.order_line:
- if not line.product_id:
- continue
- if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and (
- self.env.user.id != 6 and self.env.user.id != 7):
- approval2 += 1
- elif line.item_percent_margin <= 40 and (
- self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7):
- approval1 += 1
- if approval2 > 0:
- raise UserError("Need Tyas / Akbar Approval, atau Approval manual dan lampirkan di Log Internal")
- elif approval1 > 0:
- raise UserError("Need Adela Approval")
- order.approval_status = 'approved'
- return res
+ # def action_confirm(self):
+ # res = super(SaleOrder, self).action_confirm()
+ # for order in self:
+ # approval1 = approval2 = 0
+ # for line in order.order_line:
+ # if not line.product_id:
+ # continue
+ # if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and (
+ # self.env.user.id != 6 and self.env.user.id != 7):
+ # approval2 += 1
+ # elif line.item_percent_margin <= 40 and (
+ # self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7):
+ # approval1 += 1
+ # if approval2 > 0:
+ # raise UserError("Need Tyas / Akbar Approval, atau Approval manual dan lampirkan di Log Internal")
+ # elif approval1 > 0:
+ # raise UserError("Need Adela Approval")
+ # order.approval_status = 'approved'
+ # return res
class SaleOrderLine(models.Model):
diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py
index 8aff7f26..e07f724e 100755
--- a/indoteknik_custom/models/x_manufactures.py
+++ b/indoteknik_custom/models/x_manufactures.py
@@ -9,6 +9,7 @@ class XManufactures(models.Model):
x_name = fields.Char(string="Name")
x_description = fields.Html(string="Description")
x_logo_manufacture = fields.Binary(string="Logo Manufacture")
+ x_logo_manufacture_128 = fields.Image("Image 128", related="x_logo_manufacture", max_width=128, max_height=128, store=True)
x_manufacture_level = fields.Selection([
('prioritas', 'Prioritas'),
('gold', 'Gold'),
diff --git a/indoteknik_custom/views/account_asset_views.xml b/indoteknik_custom/views/account_asset_views.xml
new file mode 100644
index 00000000..90c53623
--- /dev/null
+++ b/indoteknik_custom/views/account_asset_views.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+ <data>
+ <record id="account_asset_form_view_inherit" model="ir.ui.view">
+ <field name="name">Account Asset</field>
+ <field name="model">account.asset.asset</field>
+ <field name="inherit_id" ref="base_accounting_kit.view_account_asset_asset_form"/>
+ <field name="arch" type="xml">
+ <button name="set_to_draft" position="after">
+ <button name="action_close_asset"
+ string="Close Asset"
+ type="object"
+ />
+ </button>
+ </field>
+ </record>
+ </data>
+</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml
index 15b55e2e..e4139677 100755
--- a/indoteknik_custom/views/sale_monitoring.xml
+++ b/indoteknik_custom/views/sale_monitoring.xml
@@ -7,6 +7,8 @@
<tree create="false">
<field name="date_order"/>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="qty_so"/>
<field name="qty_po"/>
<field name="qty_po_received"/>
@@ -32,6 +34,8 @@
<group>
<group>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="status"
widget="badge"
decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'"
diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml
index 3a3ea787..9e4734d3 100755
--- a/indoteknik_custom/views/sale_monitoring_detail.xml
+++ b/indoteknik_custom/views/sale_monitoring_detail.xml
@@ -7,6 +7,8 @@
<tree create="false">
<field name="date_order"/>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="product_id"/>
<field name="qty_so"/>
<field name="qty_po"/>
@@ -33,6 +35,8 @@
<group>
<group>
<field name="sale_order_id"/>
+ <field name="partner_id"/>
+ <field name="user_id"/>
<field name="product_id"/>
<field name="status"
widget="badge"
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index e0b4ab4d..82058837 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -7,10 +7,10 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<button id="action_confirm" position="after">
- <button name="sale_order_approve"
- string="Ask Approval"
- type="object"
- />
+<!-- <button name="sale_order_approve"-->
+<!-- string="Ask Approval"-->
+<!-- type="object"-->
+<!-- />-->
</button>
<field name="payment_term_id" position="after">
<field name="approval_status" />