prepare department location
							parent
							
								
									1adc3c7864
								
							
						
					
					
						commit
						688a46ab88
					
				| 
						 | 
				
			
			@ -11,8 +11,4 @@
 | 
			
		|||
    <field name="active"/>
 | 
			
		||||
    <field name="branch_id" required="1"/>
 | 
			
		||||
    <field name="company_id" invisible="1"/>
 | 
			
		||||
    <related>
 | 
			
		||||
    <!--<field name="staffs"/>-->
 | 
			
		||||
    <!--<field name="patients"/>-->
 | 
			
		||||
    </related>
 | 
			
		||||
</form>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,4 +2,14 @@
 | 
			
		|||
    <field name="categ_id" position="after">
 | 
			
		||||
        <field name="patient_types"/>
 | 
			
		||||
    </field>
 | 
			
		||||
    <field name="attributes" position="before">
 | 
			
		||||
        <field name="departments">
 | 
			
		||||
            <list>
 | 
			
		||||
                <field name="department_id"/>
 | 
			
		||||
            </list>
 | 
			
		||||
            <form>
 | 
			
		||||
                <field name="department_id"/>
 | 
			
		||||
            </form>
 | 
			
		||||
        </field>
 | 
			
		||||
    </field>
 | 
			
		||||
</inherit>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,3 +131,4 @@ from . import report_shop
 | 
			
		|||
from . import account_tax_component
 | 
			
		||||
from . import report_thai_wht_certif
 | 
			
		||||
from . import num2word
 | 
			
		||||
from . import department_product
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,8 +14,10 @@ class Department(Model):
 | 
			
		|||
        'branch_id': fields.Many2One("clinic.branch","Branch"),
 | 
			
		||||
        "pick_out_journal_id": fields.Many2One("stock.journal","Stock Journal",required=True),
 | 
			
		||||
        'patients':  fields.One2Many("clinic.patient","department_id","Patients"),
 | 
			
		||||
        'products':  fields.One2Many("clinic.department.product","product_id","Products"),
 | 
			
		||||
        'staffs':  fields.One2Many("clinic.staff","department_id","Staffs"),
 | 
			
		||||
        'active': fields.Boolean("Active"),
 | 
			
		||||
        'product_wharehouse': fields.Boolean("Get Location From Product Warehouse"),
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    def _get_branch(self,context={}):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
from netforce.model import Model, fields
 | 
			
		||||
 | 
			
		||||
class DepartmentProduct(Model):
 | 
			
		||||
    _name="clinic.department.product"
 | 
			
		||||
    _string="Department Product"
 | 
			
		||||
 | 
			
		||||
    _fields={
 | 
			
		||||
        "product_id": fields.Many2One("product","Product"),
 | 
			
		||||
        "department_id": fields.Many2One("clinic.department","Department"),
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
DepartmentProduct.register()
 | 
			
		||||
| 
						 | 
				
			
			@ -797,7 +797,7 @@ class HDCase(Model):
 | 
			
		|||
                "location_from_id": wh_loc_id,
 | 
			
		||||
                "location_to_id": cust_loc_id,
 | 
			
		||||
            }
 | 
			
		||||
            #XXX whare house in profile product
 | 
			
		||||
            #XXX wharehouse in profile product
 | 
			
		||||
            if prod.location_id:
 | 
			
		||||
                line_vals['location_from_id']=prod.location_id.id
 | 
			
		||||
            pick_vals["lines"].append(("create",line_vals))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@ class Product(Model):
 | 
			
		|||
    _inherit="product"
 | 
			
		||||
    _fields={
 | 
			
		||||
        'patient_types': fields.Many2Many("clinic.patient.type","Patient Types"),
 | 
			
		||||
        'departments': fields.One2Many('clinic.department.product','product_id','Departments'),
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
Product.register()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue