diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-12-14 14:13:32 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-12-14 14:13:32 +0700 |
| commit | eabbbadc5114f6c1edb9ec6bb74a296477f02b5a (patch) | |
| tree | ee182a8121e3e66b4c78e28c028ff860914d279e | |
| parent | bb2a3647ac1f5885bc6481ce10bfcd91813bfe81 (diff) | |
initial commit purchasing job
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/purchasing_job.py | 42 | ||||
| -rw-r--r-- | indoteknik_custom/models/purchasing_job_multi_update.py | 22 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/purchasing_job.xml | 83 | ||||
| -rw-r--r-- | indoteknik_custom/views/purchasing_job_multi_update.xml | 31 |
7 files changed, 185 insertions, 1 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 39e5cdd9..d31ac21a 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -104,6 +104,8 @@ 'views/stock_warehouse_orderpoint.xml', 'views/customer_commision.xml', 'views/wati_history.xml', + 'views/purchasing_job.xml', + 'views/purchasing_job_multi_update.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 35f06f03..7a6b4251 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -93,3 +93,5 @@ from . import product_monitoring from . import account_bank_statement from . import stock_warehouse_orderpoint from . import commision +from . import purchasing_job +from . import purchasing_job_multi_update diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py new file mode 100644 index 00000000..c660b937 --- /dev/null +++ b/indoteknik_custom/models/purchasing_job.py @@ -0,0 +1,42 @@ +from odoo import fields, models, api, tools +import logging + +_logger = logging.getLogger(__name__) + + +class PurchasingJob(models.Model): + _name = 'v.purchasing.job' + _auto = False + _rec_name = 'product_id' + + id = fields.Integer() + product_id = fields.Many2one('product.product', string="Product") + brand = fields.Char(string='Brand') + item_code = fields.Char(string='Item Code') + product = fields.Char(string='Product Name') + onhand = fields.Float(string='OnHand') + incoming = fields.Float(string="Incoming") + outgoing = fields.Float(string="Outgoing") + action = fields.Char(string="Status") + + def init(self): + tools.drop_view_if_exists(self.env.cr, self._table) + self.env.cr.execute(""" + CREATE OR REPLACE VIEW %s AS ( + select product_id as id, product_id, brand, item_code, product, onhand, incoming, outgoing, action + from v_procurement_monitoring_by_product + where action = 'kurang beli' + ) + """ % self._table) + + def open_form_multi_generate_request_po(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_generate_request_po') + action['context'] = { + 'product_ids': [x.id for x in self] + } + return action + + def generate_request_po(self): + # print(1) + for product in self: + print(product) diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py new file mode 100644 index 00000000..e455c5a4 --- /dev/null +++ b/indoteknik_custom/models/purchasing_job_multi_update.py @@ -0,0 +1,22 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class PurchasingJobMultiUpdate(models.TransientModel): + _name = 'purchasing.job.multi.update' + + def save_multi_update_purchasing_job(self): + product_ids = self._context['product_ids'] + product = self.env['product.product'].browse(product_ids) + product.action_multi_update_invoice_status() + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'Invoice Status berhasil diubah', + 'next': {'type': 'ir.actions.act_window_close'}, + } + }
\ No newline at end of file diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 56d00b3e..6dfa3ee4 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -83,4 +83,6 @@ access_customer_commision,access.customer.commision,model_customer_commision,,1, access_customer_commision_line,access.customer.commision.line,model_customer_commision_line,,1,1,1,1 access_customer_rebate,access.customer.rebate,model_customer_rebate,,1,1,1,1 access_wati_history,access.wati.history,model_wati_history,,1,1,1,1 -access_wati_history_line,access.wati.history.line,model_wati_history_line,,1,1,1,1
\ No newline at end of file +access_wati_history_line,access.wati.history.line,model_wati_history_line,,1,1,1,1 +access_v_purchasing_job,access.v.purchasing.job,model_v_purchasing_job,,1,1,1,1 +access_purchasing_job_multi_update,access.purchasing.job.multi.update,model_purchasing_job_multi_update,,1,1,1,1
\ No newline at end of file diff --git a/indoteknik_custom/views/purchasing_job.xml b/indoteknik_custom/views/purchasing_job.xml new file mode 100644 index 00000000..0af4455d --- /dev/null +++ b/indoteknik_custom/views/purchasing_job.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo> + <record id="v_purchasing_job_tree" model="ir.ui.view"> + <field name="name">v.purchasing.job.tree</field> + <field name="model">v.purchasing.job</field> + <field name="arch" type="xml"> + <tree create="false" multi_edit="1"> + <field name="product_id"/> + <field name="brand"/> + <field name="item_code"/> + <field name="product"/> + <field name="onhand"/> + <field name="incoming"/> + <field name="outgoing"/> + <field name="action"/> + </tree> + </field> + </record> + + <record id="v_purchasing_job_form" model="ir.ui.view"> + <field name="name">v.purchasing.job.form</field> + <field name="model">v.purchasing.job</field> + <field name="arch" type="xml"> + <form create="false" edit="false"> + <sheet> + <group> + <group> + <field name="product_id"/> + <field name="brand"/> + <field name="item_code"/> + <field name="product"/> + <field name="action"/> + </group> + <group> + <field name="onhand"/> + <field name="incoming"/> + <field name="outgoing"/> + </group> + </group> + </sheet> + </form> + </field> + </record> + + <record id="view_purchasing_job_filter" model="ir.ui.view"> + <field name="name">v.purchasing.job.list.select</field> + <field name="model">v.purchasing.job</field> + <field name="priority" eval="15"/> + <field name="arch" type="xml"> + <search string="Search"> + <field name="product_id"/> + <field name="item_code"/> + <field name="brand"/> + </search> + </field> + </record> + + <record id="v_purchasing_job_action" model="ir.actions.act_window"> + <field name="name">Purchasing Job</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">v.purchasing.job</field> + <field name="search_view_id" ref="view_purchasing_job_filter"/> + <field name="view_mode">tree,form</field> + </record> + + <record id="purchasing_job_multi_update_ir_actions_server" model="ir.actions.server"> + <field name="name">Generate Automatic PO</field> + <field name="model_id" ref="indoteknik_custom.v_purchasing_job_tree"/> + <field name="binding_model_id" ref="indoteknik_custom.v_purchasing_job_tree"/> + <field name="binding_view_types">form,list</field> + <field name="state">code</field> + <field name="code">action = records.open_form_multi_generate_request_po()</field> + </record> + + <menuitem + id="menu_purchasing_job" + name="Purchasing Job" + parent="menu_monitoring_in_purchase" + sequence="201" + action="v_purchasing_job_action" + /> + +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/purchasing_job_multi_update.xml b/indoteknik_custom/views/purchasing_job_multi_update.xml new file mode 100644 index 00000000..422d9e3c --- /dev/null +++ b/indoteknik_custom/views/purchasing_job_multi_update.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<odoo> + <data> + <record id="view_purchasing_job_multi_update_form" model="ir.ui.view"> + <field name="name">View Purchasing Job Multi Update</field> + <field name="model">purchasing.job.multi.update</field> + <field name="arch" type="xml"> + <form> + <sheet> + <group> + <span>Apakah Anda Yakin Ingin Mengubah Invoice Status?</span> + </group> + </sheet> + <footer> + <button name="save_multi_update_purchasing_job" string="Multi Update" type="object" default_focus="1" class="oe_highlight"/> + <button string="Cancel" class="btn btn-secondary" special="cancel" /> + </footer> + </form> + </field> + </record> + + <record id="action_purchasing_job_multi_update" model="ir.actions.act_window"> + <field name="name">Action Purchasing Job Multi Update</field> + <field name="res_model">purchasing.job.multi.update</field> + <field name="type">ir.actions.act_window</field> + <field name="view_mode">form</field> + <field name="view_id" ref="view_purchasing_job_multi_update_form"/> + <field name="target">new</field> + </record> + </data> +</odoo>
\ No newline at end of file |
