diff options
| -rw-r--r-- | fixco_custom/models/purchasing_job.py | 11 | ||||
| -rw-r--r-- | fixco_custom/views/purchasing_job.xml | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/fixco_custom/models/purchasing_job.py b/fixco_custom/models/purchasing_job.py index 1a8ccb1..2c7138a 100644 --- a/fixco_custom/models/purchasing_job.py +++ b/fixco_custom/models/purchasing_job.py @@ -17,7 +17,7 @@ class PurchasingJob(models.Model): action = fields.Char(string='Action') product_id = fields.Many2one('product.product', string='Product') vendor_id = fields.Many2one('res.partner', string='Vendor') - # brand_id = fields.Many2one('brands', string='Brand') + brand_id = fields.Many2one('brands', string='Brand') def create_automatic_purchase(self): if not self: @@ -86,7 +86,8 @@ class PurchasingJob(models.Model): ELSE 'cukup' END AS action, a.product_id, - pp2.vendor_id + pp2.vendor_id, + b.id AS brand_id FROM ( SELECT COALESCE(pp.default_code, pt.default_code) AS item_code, @@ -94,7 +95,8 @@ class PurchasingJob(models.Model): get_qty_onhand(pp.id::numeric) AS onhand, get_qty_incoming(pp.id::numeric) AS incoming, get_qty_outgoing(pp.id::numeric) AS outgoing, - pp.id AS product_id + pp.id AS product_id, + pp.brand_id FROM stock_move sm JOIN stock_picking sp ON sp.id = sm.picking_id JOIN product_product pp ON pp.id = sm.product_id @@ -102,8 +104,9 @@ class PurchasingJob(models.Model): WHERE sp.state IN ('draft', 'waiting', 'confirmed', 'assigned') AND sp.name LIKE '%%OUT%%' AND sm.location_id = 55 - GROUP BY pp.id, pp.default_code, pt.default_code, pt.name + GROUP BY pp.id, pp.default_code, pt.default_code, pt.name, pp.brand_id ) a + LEFT JOIN brands b ON b.id = a.brand_id LEFT JOIN LATERAL ( SELECT vendor_id FROM purchase_pricelist diff --git a/fixco_custom/views/purchasing_job.xml b/fixco_custom/views/purchasing_job.xml index 270652c..7a15160 100644 --- a/fixco_custom/views/purchasing_job.xml +++ b/fixco_custom/views/purchasing_job.xml @@ -8,7 +8,7 @@ <tree string="Procurement Monitoring by Product" create="false" delete="false"> <field name="item_code"/> <field name="product"/> - <!-- <field name="brand_id"/> --> + <field name="brand_id"/> <field name="vendor_id"/> <field name="onhand"/> <field name="incoming"/> |
