diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-01-02 11:28:12 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-01-02 11:28:12 +0700 |
| commit | 9d4ec4d054858368d21a1efc9f58f1fbd080baaf (patch) | |
| tree | eea9b772124aad8cbcaf021575b988727b43225e | |
| parent | 80cbff436261c85af8b826317037fc5ee07b2d86 (diff) | |
change logic for po status and add table for product spec trusco
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/product_spec.py | 19 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 20 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 1 |
4 files changed, 35 insertions, 6 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index c8cd85b5..356f69f0 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -36,3 +36,4 @@ from . import website_brand_homepage from . import mail_mail from . import website_categories_homepage from . import sales_target +from . import product_spec diff --git a/indoteknik_custom/models/product_spec.py b/indoteknik_custom/models/product_spec.py new file mode 100644 index 00000000..161438b6 --- /dev/null +++ b/indoteknik_custom/models/product_spec.py @@ -0,0 +1,19 @@ +from odoo import fields, models, api +from datetime import datetime, timedelta +import logging + +_logger = logging.getLogger(__name__) + + +class ProductTemplateSpec(models.Model): + _name = 'product.template.spec' + product_tmpl_id = fields.Many2one('product.template', string='Product Template') + attribute = fields.Char(string='Attribute', help='Attribute of Product') + value = fields.Char(string='Values', help='Value of Attribute') + + +class ProductVariantSpec(models.Model): + _name = 'product.variant.spec' + product_variant_id = fields.Many2one('product.product', string='Product Variant') + attribute = fields.Char(string='Attribute', help='Attribute of Product') + value = fields.Char(string='Values', help='Value of Attribute') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a816038e..b4d671b6 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -70,19 +70,29 @@ class PurchaseOrder(models.Model): def calculate_po_status(self): purchases = self.env['purchase.order'].search([ ('po_status', '!=', 'terproses'), + # ('id', '=', 213), ]) for order in purchases: sum_qty_received = sum_qty_po = 0 + + have_outstanding_pick = False + for pick in order.picking_ids: + if pick.state == 'draft' or pick.state == 'assigned' or pick.state == 'confirmed' or pick.state == 'waiting': + have_outstanding_pick = True + for po_line in order.order_line: sum_qty_po += po_line.product_uom_qty sum_qty_received += po_line.qty_received - if order.summary_qty_po == order.summary_qty_receipt: - order.po_status = 'terproses' - elif order.summary_qty_po > order.summary_qty_receipt > 0: - order.po_status = 'sebagian' + if have_outstanding_pick: + # if order.summary_qty_po == order.summary_qty_receipt: + # order.po_status = 'terproses' + if order.summary_qty_po > order.summary_qty_receipt > 0: + order.po_status = 'sebagian' + else: + order.po_status = 'menunggu' else: - order.po_status = 'menunggu' + order.po_status = 'terproses' _logger.info("Calculate PO Status %s" % order.id) def _compute_summary_qty(self): diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index fcd38677..c4a06a6c 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -71,7 +71,6 @@ <field name="inherit_id" ref="purchase.purchase_order_view_tree"/> <field name="arch" type="xml"> <field name="invoice_status" position="after"> - <field name="procurement_status" /> <field name="po_status" /> </field> </field> |
