clinic/netforce_clinic/models/department_product.py

23 lines
951 B
Python
Raw Normal View History

2015-04-22 16:43:00 +00:00
from netforce.model import Model, fields
class DepartmentProduct(Model):
_name="clinic.department.product"
_string="Department Product"
_key=['product_id','department_id']
2015-04-22 16:43:00 +00:00
_fields={
"product_id": fields.Many2One("product","Product", required=True),
"department_id": fields.Many2One("clinic.department","Working Department", required=True),
"stock_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True),
2015-04-22 16:43:00 +00:00
}
def get_location(self,department_id,product_id,context={}):
for obj in self.search_browse([]):
if obj.department_id.id==department_id and obj.product_id.id==product_id:
return {
'wh_loc_id': obj.stock_journal_id.location_from_id.id,
'cust_loc_id': obj.stock_journal_id.location_to_id.id,
'journal_id': obj.stock_journal_id.id,
}
2015-04-22 16:43:00 +00:00
DepartmentProduct.register()