Skip to content

Commit

Permalink
[Rahul] | BAH-3695 | Add. Odoo Order Type Initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
rahu1ramesh committed Apr 22, 2024
1 parent 8ffb855 commit 36a6e6b
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 38 deletions.
27 changes: 12 additions & 15 deletions bahmni_api_feed/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@
'images': [],
'depends': ['base','product','bahmni_sale'],
'data': [
'security/ir.model.access.csv',
'views/event_records_view.xml',
'views/res_company.xml',
'views/order_type_view.xml',
'views/syncable_units_mapping_view.xml',
'views/order_type_shop_map_view.xml',
'views/res_users_view.xml',
'data/mrs_person_attributes_data.xml',
'views/menus.xml',
#'data/order_type.xml',
#'data/order_type_shop_map.xml',
'data/syncable_units_mapping.xml',


],
'security/ir.model.access.csv',
'views/event_records_view.xml',
'views/res_company.xml',
'views/order_type_view.xml',
'views/syncable_units_mapping_view.xml',
'views/order_type_shop_map_view.xml',
'views/res_users_view.xml',
'data/mrs_person_attributes_data.xml',
'views/menus.xml',
'data/sale_shop.xml',
'data/syncable_units_mapping.xml'
],
'demo': [],
'qweb': [],
'license': 'LGPL-3',
Expand Down
14 changes: 0 additions & 14 deletions bahmni_api_feed/data/order_type.xml

This file was deleted.

17 changes: 14 additions & 3 deletions bahmni_api_feed/models/order_type.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
from odoo import models, fields, api
import logging

_logger = logging.getLogger(__name__)

class OrderType(models.Model):
_name = 'order.type'
_description = 'Order Type'

name = fields.Char(string='Name')
name = fields.Char(string='Name', required=True, help='Name of the order type')
description = fields.Text(string='Description', help='Description of the order type')

_sql_constraints = [('unique_name', 'unique(name)',
'Order type with this name already exists!')]
_sql_constraints = [('unique_name', 'unique(name)', 'Order type with this name already exists!')]

@api.model
def create(self,vals):
try:
record = super(OrderType,self).create(vals)
_logger.info("Created New Order Type {} With Id {}.".format(*(vals.get("name"),record.id)))
return record
except Exception as error:
_logger.error("Failed To Create New Order Type {}".format(vals.get("name")))
6 changes: 3 additions & 3 deletions bahmni_api_feed/views/order_type_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<field name="arch" type="xml">
<tree string="Order Type">
<field name="name"/>
<field name="description"/>
</tree>
</field>
</record>
Expand All @@ -17,7 +18,8 @@
<field name="arch" type="xml">
<form string="Order Type">
<group>
<field name="name" required="1"/>
<field name="name" required="1" style="width:40% !important"/>
<field name="description"/>
</group>
</form>
</field>
Expand All @@ -29,6 +31,4 @@
<field name="view_mode">tree,form</field>
</record>



</odoo>
3 changes: 2 additions & 1 deletion bahmni_initializer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
'website': "https://www.yourcompany.com",
'category': 'Services',
'license': 'LGPL-3',
'depends': ['base','bahmni_address_mapping'],
'depends': ['base','bahmni_address_mapping','bahmni_api_feed'],
'data': [
'security/ir.model.access.csv',
'data/address.seed.csv',
'data/order_type.xml'
],
'demo': [],
'qweb': [],
Expand Down
4 changes: 2 additions & 2 deletions package/docker/odoo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ COPY community_modules/report_pdf_options ${ADDON_PATH}/report_pdf_options/
COPY community_modules/stock_picking_filter_lot ${ADDON_PATH}/stock_picking_filter_lot
COPY community_modules/br_custom_list_view ${ADDON_PATH}/br_custom_list_view
COPY openerp7_data_import ${ADDON_PATH}/openerp7_data_import/
COPY package/resources/data/address.seed.csv ${ADDON_PATH}/bahmni_initializer/data/
COPY bahmni_reports ${ADDON_PATH}/bahmni_reports

COPY package/resources/data/address.seed.csv ${ADDON_PATH}/bahmni_initializer/data/
COPY package/resources/data/order_type.xml ${ADDON_PATH}/bahmni_initializer/data/
RUN pip3 install python-decouple

CMD ["odoo", "-u", "all", "-i", "sale_management,purchase,stock,point_of_sale,l10n_generic_coa,bahmni_account,bahmni_product,bahmni_api_feed,bahmni_stock,bahmni_purchase,bahmni_address_mapping,bahmni_sale,restful_api,bahmni_reports", "--without-demo", "-d odoo"]
15 changes: 15 additions & 0 deletions package/resources/data/order_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="order_type_drug" model="order.type">
<field name="name">Drug Order</field>
<field name="description">This order type is used for prescribing medications to patients. It includes details such as the name of the medication, dosage, frequency, and duration of treatment.</field>
</record>
<record id="order_type_lab" model="order.type">
<field name="name">Lab Order</field>
<field name="description">Lab orders are used to request various laboratory tests and investigations for patients. They specify the type of test required, along with any specific instructions or details for the lab to follow.</field>
</record>
<record id="order_type_radiology" model="order.type">
<field name="name">Radiology Order</field>
<field name="description">Radiology orders are used to request imaging studies such as X-rays, CT scans, MRI scans, and ultrasound examinations for patients. These orders provide details about the type of imaging study needed, the body part to be examined, and any relevant clinical information.</field>
</record>
</odoo>

0 comments on commit 36a6e6b

Please sign in to comment.