diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-06-16 16:11:05 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-06-16 16:11:05 +0700 |
| commit | 2b55220a09fa15c22fb0a4e405c6495153604f54 (patch) | |
| tree | f10220540680ca1ad25abb9507c82f09041c75f4 | |
| parent | ab71c4b64074ec7471954e3c8f652887549950b9 (diff) | |
| parent | e2ccd5719de9cf03a422e93fbef9a7f035b854a5 (diff) | |
Merge branch 'release' into nathan-dev
# Conflicts:
# indoteknik_custom/models/purchase_order.py
| -rw-r--r-- | indoteknik_api/controllers/api_v1/sale_order.py | 2 | ||||
| -rw-r--r-- | indoteknik_api/models/account_move.py | 8 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_monitoring.py | 15 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_monitoring_detail.py | 18 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_monitoring.xml | 33 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_monitoring_detail.xml | 34 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 7 |
9 files changed, 82 insertions, 41 deletions
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py index 35361ba4..ec33495e 100644 --- a/indoteknik_api/controllers/api_v1/sale_order.py +++ b/indoteknik_api/controllers/api_v1/sale_order.py @@ -246,7 +246,7 @@ class SaleOrder(controller.Controller): parameters = { 'warehouse_id': 8, 'carrier_id': 1, - 'sales_tax_id': 21, + 'sales_tax_id': 23, 'pricelist_id': product_pricelist_default_discount_id, 'payment_term_id': 26, 'team_id': 2, diff --git a/indoteknik_api/models/account_move.py b/indoteknik_api/models/account_move.py index 54e06f84..23a7076c 100644 --- a/indoteknik_api/models/account_move.py +++ b/indoteknik_api/models/account_move.py @@ -6,6 +6,10 @@ class AccountMove(models.Model): _inherit = 'account.move' def api_v1_single_response(self, account_move, context=False): + sale_order = self.env['sale.order'].search([('name', '=', account_move.invoice_origin), ('state', '=', 'done')], limit=1) + amount_residual = account_move.amount_residual + if sale_order.payment_status == 'settlement' or sale_order.payment_status == 'capture': + amount_residual = 0 data = { 'token': self.env['rest.api'].md5_salt(account_move.id, 'account.move'), 'id': account_move.id, @@ -14,7 +18,7 @@ class AccountMove(models.Model): 'payment_term': account_move.invoice_payment_term_id.name or '', 'sales': account_move.invoice_user_id.name, 'amount_total': account_move.amount_total, - 'amount_residual': account_move.amount_residual, + 'amount_residual': amount_residual, 'invoice_date': account_move.invoice_date.strftime('%d/%m/%Y') or '', 'efaktur': True if account_move.efaktur_document else False, } @@ -30,7 +34,7 @@ class AccountMove(models.Model): 'payment_term': account_move.invoice_payment_term_id.name or '', 'sales': account_move.invoice_user_id.name, 'amount_total': account_move.amount_total, - 'amount_residual': account_move.amount_residual, + 'amount_residual': amount_residual, 'invoice_date_due': account_move.invoice_date_due.strftime('%d/%m/%Y') or '', 'customer': res_users.api_address_response(account_move.partner_id), 'products': [], diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py index a3265a8b..e79ff9ab 100755 --- a/indoteknik_custom/models/sale_monitoring.py +++ b/indoteknik_custom/models/sale_monitoring.py @@ -20,6 +20,7 @@ class SaleMonitoring(models.Model): date_order = fields.Datetime(string="Date Order") status = fields.Char(string="Status") po_number = fields.Char(string="PO Number") + qty_reserved = fields.Integer(string="Qty Reserved") def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -36,14 +37,14 @@ class SaleMonitoring(models.Model): SUM(smd.qty_po_received) AS qty_po_received, SUM(smd.qty_so_delivered) AS qty_so_delivered, SUM(smd.qty_so_invoiced) AS qty_so_invoiced, + sum(smd.qty_reserved) as qty_reserved, CASE - WHEN SUM(qty_po) < SUM(qty_so) AND SUM(qty_po) <= 0 THEN 'Belum PO sama sekali' - WHEN SUM(qty_po) < SUM(qty_so) THEN 'Belum PO full' - WHEN SUM(qty_po_received) < SUM(qty_so) AND SUM(qty_po_received) <= 0 THEN 'Belum Received sama sekali' - WHEN SUM(qty_po_received) < SUM(qty_so) THEN 'Belum Received full' - WHEN SUM(qty_to_delivered) = SUM(qty_so) THEN 'SIAP KIRIM' - WHEN SUM(qty_to_delivered) < SUM(qty_so) and SUM(qty_to_delivered) > 0 THEN 'KIRIM SISANYA' - ELSE 'Belum Invoiced' + when sum(qty_so_invoiced) = sum(qty_so) then 'Invoiced' + when sum(qty_so_delivered) = sum(qty_so) then 'Delivered' + when sum(qty_reserved) >= sum(qty_so) then 'Siap kirim' + when sum(qty_po) + sum(qty_reserved) - sum(qty_po_received) < sum(qty_so) then 'Belum/Kurang PO' + when sum(qty_po_received) = 0 then 'Belum terima' + when sum(qty_po_received) < sum(qty_po) then 'Terima sebagian' END AS status, get_po_number(smd.sale_order_id) as po_number FROM sale_monitoring_detail smd diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index a578f67b..2bcda50c 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -21,6 +21,7 @@ class SaleMonitoringDetail(models.Model): qty_so_invoiced = fields.Integer(string="Qty SO Invoiced") date_order = fields.Datetime(string="Date Order") status = fields.Char(string="Status") + qty_reserved = fields.Integer(string="Qty Reserved") def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -29,14 +30,12 @@ class SaleMonitoringDetail(models.Model): SELECT *, CASE - WHEN qty_so = qty_so_invoiced then 'Done' - WHEN qty_po < qty_so AND qty_po <= 0 THEN 'Belum PO sama sekali' - WHEN qty_po < qty_so THEN 'Belum PO full' - WHEN qty_po_received < qty_so and qty_po_received <= 0 THEN 'Belum Received sama sekali' - WHEN qty_po_received < qty_so THEN 'Belum Received full' - WHEN qty_to_delivered = qty_so THEN 'SIAP KIRIM' - WHEN qty_to_delivered < qty_so and qty_to_delivered > 0 THEN 'KIRIM SISANYA' - ELSE 'Belum Invoiced' + when qty_so_invoiced = qty_so then 'Invoiced' + when qty_so_delivered = qty_so then 'Delivered' + when qty_reserved >= qty_so then 'Siap kirim' + when qty_po + qty_reserved - qty_po_received < qty_so then 'Belum/Kurang PO' + when qty_po_received = 0 then 'Belum terima' + when qty_po_received < qty_po then 'Terima sebagian' END AS status FROM ( @@ -52,7 +51,8 @@ class SaleMonitoringDetail(models.Model): sol.qty_invoiced AS qty_so_invoiced, so.date_order AS date_order, get_qty_po(so.id, sol.product_id) AS qty_po, - get_qty_received(so.id, sol.product_id) AS qty_po_received + get_qty_received(so.id, sol.product_id) AS qty_po_received, + get_qty_reserved(so.id, sol.product_id) as qty_reserved FROM sale_order so JOIN sale_order_line sol ON sol.order_id = so.id JOIN product_product p ON p.id = sol.product_id diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index cbc6a60a..52b959db 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -336,8 +336,8 @@ class SaleOrder(models.Model): raise UserError("Invoice harus di Cancel dahulu") elif self.have_outstanding_picking: raise UserError("DO harus di Cancel dahulu") - elif self.have_outstanding_po: - raise UserError("PO harus di Cancel dahulu") + # elif self.have_outstanding_po: + # raise UserError("PO harus di Cancel dahulu") self.approval_status = False return super(SaleOrder, self).action_cancel() diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index a4c77c58..7a397ff6 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -43,7 +43,7 @@ <field name="total_so_percent_margin"/> </field> <field name="product_id" position="before"> - <field name="line_no" attrs="{'readonly': 1}"/> + <field name="line_no" attrs="{'readonly': 1}" optional="hide"/> </field> <field name="product_qty" position="before"> <field name="qty_available_store"/> diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml index b3b186e9..0a9a5aa5 100755 --- a/indoteknik_custom/views/sale_monitoring.xml +++ b/indoteknik_custom/views/sale_monitoring.xml @@ -13,16 +13,17 @@ <field name="partner_id"/> <field name="user_id"/> <field name="qty_so"/> + <field name="qty_reserved"/> <field name="qty_po"/> <field name="qty_po_received"/> <field name="qty_so_delivered"/> <field name="qty_so_invoiced"/> <field name="status" widget="badge" - decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" - decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" - decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced'" + decoration-danger="status == 'Belum/Kurang PO'" + decoration-warning="status == 'Belum terima' or status == 'Terima sebagian'" + decoration-success="status == 'Siap kirim'" + decoration-info="status == 'Delivered' or status == 'Invoiced'" /> </tree> </field> @@ -41,15 +42,16 @@ <field name="user_id"/> <field name="status" widget="badge" - decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" - decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" - decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced'" + decoration-danger="status == 'Belum/Kurang PO'" + decoration-warning="status == 'Belum terima' or status == 'Terima sebagian'" + decoration-success="status == 'Siap kirim'" + decoration-info="status == 'Delivered' or status == 'Invoiced'" /> <field name="po_number"/> </group> <group> <field name="qty_so"/> + <field name="qty_reserved"/> <field name="qty_po"/> <field name="qty_po_received"/> <field name="qty_so_delivered"/> @@ -61,10 +63,25 @@ </field> </record> + <record id="view_monitoring_filter" model="ir.ui.view"> + <field name="name">sale.monitoring.list.select</field> + <field name="model">sale.monitoring</field> + <field name="priority" eval="15"/> + <field name="arch" type="xml"> + <search string="Search Monitoring"> + <field name="sale_order_id"/> + <field name="partner_id"/> + <field name="user_id"/> + <field name="status"/> + </search> + </field> + </record> + <record id="sale_monitoring_action" model="ir.actions.act_window"> <field name="name">Sale Monitoring</field> <field name="type">ir.actions.act_window</field> <field name="res_model">sale.monitoring</field> + <field name="search_view_id" ref="view_monitoring_filter"/> <field name="view_mode">tree,form</field> </record> diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml index b9602abd..824e65e8 100755 --- a/indoteknik_custom/views/sale_monitoring_detail.xml +++ b/indoteknik_custom/views/sale_monitoring_detail.xml @@ -11,16 +11,17 @@ <field name="user_id"/> <field name="product_id"/> <field name="qty_so"/> + <field name="qty_reserved"/> <field name="qty_po"/> <field name="qty_po_received"/> <field name="qty_so_delivered"/> <field name="qty_so_invoiced"/> <field name="status" widget="badge" - decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" - decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" - decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced' or status == 'Done'" + decoration-danger="status == 'Belum/Kurang PO'" + decoration-warning="status == 'Belum terima' or status == 'Terima sebagian'" + decoration-success="status == 'Siap kirim'" + decoration-info="status == 'Delivered' or status == 'Invoiced'" /> </tree> </field> @@ -40,14 +41,15 @@ <field name="product_id"/> <field name="status" widget="badge" - decoration-danger="status == 'Belum PO sama sekali' or status == 'Belum PO full'" - decoration-warning="status == 'Belum Received sama sekali' or status == 'Belum Received full'" - decoration-success="status == 'SIAP KIRIM' or status == 'KIRIM SISANYA'" - decoration-info="status == 'Belum Invoiced'" + decoration-danger="status == 'Belum/Kurang PO'" + decoration-warning="status == 'Belum terima' or status == 'Terima sebagian'" + decoration-success="status == 'Siap kirim'" + decoration-info="status == 'Delivered' or status == 'Invoiced'" /> </group> <group> <field name="qty_so"/> + <field name="qty_reserved"/> <field name="qty_po"/> <field name="qty_po_received"/> <field name="qty_so_delivered"/> @@ -59,10 +61,26 @@ </field> </record> + <record id="view_monitoring_detail_filter" model="ir.ui.view"> + <field name="name">sale.monitoring.detail.list.select</field> + <field name="model">sale.monitoring.detail</field> + <field name="priority" eval="15"/> + <field name="arch" type="xml"> + <search string="Search Monitoring"> + <field name="sale_order_id"/> + <field name="partner_id"/> + <field name="user_id"/> + <field name="product_id"/> + <field name="status"/> + </search> + </field> + </record> + <record id="sale_monitoring_detail_action" model="ir.actions.act_window"> <field name="name">Sale Monitoring Detail</field> <field name="type">ir.actions.act_window</field> <field name="res_model">sale.monitoring.detail</field> + <field name="search_view_id" ref="view_monitoring_detail_filter"/> <field name="view_mode">tree,form</field> </record> diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index ea13c954..b160d9b1 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -19,8 +19,9 @@ type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/> </button> <field name="payment_term_id" position="after"> - <field name="shipping_cost_covered" required="1"/> - <field name="shipping_paid_by" required="1"/> + <field name="create_date" invisible="1"/> + <field name="shipping_cost_covered" attrs="{'required': ['|', ('create_date', '>', '2023-06-15'), ('create_date', '=', False)]}"/> + <field name="shipping_paid_by" attrs="{'required': ['|', ('create_date', '>', '2023-06-15'), ('create_date', '=', False)]}"/> <field name="delivery_amt"/> <field name="fee_third_party"/> <field name="total_percent_margin"/> @@ -62,7 +63,7 @@ <field name="item_percent_margin"/> </xpath> <xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" position="before"> - <field name="line_no" readonly="1"/> + <field name="line_no" readonly="1" optional="hide"/> </xpath> <field name="amount_total" position="after"> <field name="grand_total"/> |
