diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-07-22 09:55:08 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-07-22 09:55:08 +0700 |
| commit | e2d42ebca210467698f163558e6e4390dcecaae9 (patch) | |
| tree | b86fc1a2d5b30d04dfef6b7deef9424d06738503 /indoteknik_custom | |
| parent | 5d27587d8c84d74e4fa26f8aaf34843d0261b985 (diff) | |
add compute web price and stock vendor
Diffstat (limited to 'indoteknik_custom')
| -rw-r--r-- | indoteknik_custom/__manifest__.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/__init__.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/product_template.py | 19 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_vendor.py (renamed from indoteknik_custom/models/stock_altama.py) | 6 | ||||
| -rw-r--r-- | indoteknik_custom/security/ir.model.access.csv | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_vendor.xml (renamed from indoteknik_custom/views/stock_altama.xml) | 26 |
6 files changed, 38 insertions, 19 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 2c3c0b7e..fbfac6ea 100644 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -23,7 +23,7 @@ 'views/x_manufactures.xml', 'views/x_partner_purchase_order.xml', 'views/x_product_tags.xml', - 'views/stock_altama.xml', + 'views/stock_vendor.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 3da85d05..ee089698 100644 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -7,4 +7,4 @@ from . import product_public_category from . import product_template from . import x_partner_purchase_order from . import x_product_tags -from . import stock_altama +from . import stock_vendor diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index b2816d3f..61cf09e2 100644 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -17,3 +17,22 @@ class ProductTemplate(models.Model): x_lazada = fields.Text(string="Lazada") x_tokopedia = fields.Text(string="Tokopedia") +class ProductProduct(models.Model): + _inherit = "product.product" + web_price = fields.Float( + 'Web Price', compute='_compute_product_discount_price', + digits='Product Price', inverse='_set_product_lst_price', + help="Web Price with pricelist_id = 1") + qty_stock_vendor = fields.Float( + 'Qty Stock Vendor', compute='_compute_stock_vendor', + help="Stock Vendor") + + def _compute_product_discount_price(self): + for product in self: + product_pricelist_item = self.env['product.pricelist.item'].search([('pricelist_id', '=', 1),('product_id', '=', product.id)],limit=1) + product.web_price = product_pricelist_item.fixed_price + + def _compute_stock_vendor(self): + for product in self: + stock_vendor = self.env['stock.vendor'].search([('product_variant_id', '=', product.id)],limit=1) + product.qty_stock_vendor = stock_vendor.quantity+product.qty_available
\ No newline at end of file diff --git a/indoteknik_custom/models/stock_altama.py b/indoteknik_custom/models/stock_vendor.py index 9dae06e2..78baf14c 100644 --- a/indoteknik_custom/models/stock_altama.py +++ b/indoteknik_custom/models/stock_vendor.py @@ -1,9 +1,9 @@ from odoo import fields, models -class StockAltama(models.Model): - _name = "stock.altama" - _description = "Stock Altama" +class StockVendor(models.Model): + _name = "stock.vendor" + _description = "Stock Vendor" _rec_name = "product_variant_id" product_variant_id = fields.Many2one("product.product", string="Product Variant") diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 7592f687..92417f01 100644 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -5,4 +5,4 @@ access_x_biaya_kirim,access.x.biaya.kirim,model_x_biaya_kirim,,1,1,1,1 access_x_manufactures,access.x.manufactures,model_x_manufactures,,1,1,1,1 access_x_partner_purchase_order,access.x.partner.purchase.order,model_x_partner_purchase_order,,1,1,1,1 access_x_product_tags,access.x.product.tags,model_x_product_tags,,1,1,1,1 -access_stock_altama,access.stock.altama,model_stock_altama,,1,1,1,1
\ No newline at end of file +access_stock_vendor,access.stock.vendor,model_stock_vendor,,1,1,1,1
\ No newline at end of file diff --git a/indoteknik_custom/views/stock_altama.xml b/indoteknik_custom/views/stock_vendor.xml index f9b7b861..70970fb6 100644 --- a/indoteknik_custom/views/stock_altama.xml +++ b/indoteknik_custom/views/stock_vendor.xml @@ -1,19 +1,19 @@ <odoo> <data> - <record id="stock_altama_action" model="ir.actions.act_window"> - <field name="name">Stock Altama</field> - <field name="res_model">stock.altama</field> + <record id="stock_vendor_action" model="ir.actions.act_window"> + <field name="name">Stock vendor</field> + <field name="res_model">stock.vendor</field> <field name="view_mode">tree,form</field> <field name="help" type="html"> <p class="o_view_nocontent_smiling_face"> - Stock Altama + Stock vendor </p> </field> </record> - <record id="stock_altama_tree" model="ir.ui.view"> - <field name="name">Stock Altama</field> - <field name="model">stock.altama</field> + <record id="stock_vendor_tree" model="ir.ui.view"> + <field name="name">Stock vendor</field> + <field name="model">stock.vendor</field> <field name="arch" type="xml"> <tree> <field name="product_variant_id"/> @@ -22,9 +22,9 @@ </field> </record> - <record id="stock_altama_form" model="ir.ui.view"> - <field name="name">Stock Altama</field> - <field name="model">stock.altama</field> + <record id="stock_vendor_form" model="ir.ui.view"> + <field name="name">Stock vendor</field> + <field name="model">stock.vendor</field> <field name="arch" type="xml"> <form> <sheet> @@ -40,10 +40,10 @@ </field> </record> - <menuitem id="stock_altama" - name="Stock Altama" + <menuitem id="stock_vendor" + name="Stock vendor" parent="sale.product_menu_catalog" sequence="3" - action="stock_altama_action"/> + action="stock_vendor_action"/> </data> </odoo>
\ No newline at end of file |
