Skip to content

Commit

Permalink
BAH-3441 | Fix. product category added under the parent tree. (#37)
Browse files Browse the repository at this point in the history
* [Hari] | BAH-3441 Fix. product category added under the parent tree.

* [Hari] | BAH-3441 Update. resolved the indentation error
  • Loading branch information
Hari Prasath A authored Jan 2, 2024
1 parent a478cc6 commit 98c53ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bahmni_api_feed/models/drug_data_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def _fill_drug_object(self, drug_from_feed, drug_ids_from_db):
category_from_db = category.read([])[0]
categ_id = category_from_db and category_from_db.get('id') or self._create_in_drug_category(category_name)
else:
categ_id = self.env["product.category"].sudo().create({'name':category_name}).id
categ_parent_id = self.env['product.category'].sudo().search([('complete_name', '=', 'All / Saleable / Drugs')], limit=1).id
categ_id = self.env["product.category"].sudo().create({'name':category_name, 'parent_id': categ_parent_id}).id
list_price = drug_ids_from_db and self.env['product.product'].sudo().browse(drug_ids_from_db[0]).list_price or 0.0
drug["uuid"] = drug_from_feed.get("uuid")
drug["name"] = drug_from_feed.get("name")
Expand Down

0 comments on commit 98c53ef

Please sign in to comment.