fix
							parent
							
								
									774c96225d
								
							
						
					
					
						commit
						b4296e54a3
					
				| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
<action>
 | 
			
		||||
    <field name="string">Period Line</field>
 | 
			
		||||
    <field name="view_cls">multi_view</field>
 | 
			
		||||
    <field name="model">clinic.period.line</field>
 | 
			
		||||
    <field name="menu">account_menu</field>
 | 
			
		||||
    <field name="tabs">[
 | 
			
		||||
        ["All",[]],
 | 
			
		||||
        ["Open",[["state","=","open"]]],
 | 
			
		||||
        ["Close",[["state","=","close"]]]
 | 
			
		||||
        ]</field>
 | 
			
		||||
</action>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
<form model="clinic.period.line" attrs='{"readonly":[["state","in",["close"]]]}'>
 | 
			
		||||
    <head>
 | 
			
		||||
        <field name="state"/>
 | 
			
		||||
    </head>
 | 
			
		||||
    <field name="date_start"/>
 | 
			
		||||
    <field name="date_stop"/>
 | 
			
		||||
    <field name="day_total"/>
 | 
			
		||||
    <foot>
 | 
			
		||||
        <button string="Close" states="open" method="do_close" type="danger"/>
 | 
			
		||||
        <button string="Reopen" states="close" method="do_open" icon="repeat" type="default"/>
 | 
			
		||||
    </foot>
 | 
			
		||||
</form>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
<list model="clinic.period.line">
 | 
			
		||||
    <field name="date_start"/>
 | 
			
		||||
    <field name="date_stop"/>
 | 
			
		||||
    <field name="day_total"/>
 | 
			
		||||
    <field name="state"/>
 | 
			
		||||
</list>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
<form model="clinic.report.labor.cost">
 | 
			
		||||
    <field name="period_id" span="2"/>
 | 
			
		||||
    <field name="date" mode="month" onchange="onchange_date" span="2"/>
 | 
			
		||||
    <field name="date_from" onchange="onchange_from" required="1" span="2"/>
 | 
			
		||||
    <field name="date_to" required="1" span="2"/>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,21 +19,23 @@ class PeriodLine(Model):
 | 
			
		|||
    def _get_name(self,ids,context={}):
 | 
			
		||||
        res={}
 | 
			
		||||
        for obj in self.browse(ids):
 | 
			
		||||
            res[obj.id]='%s - %s'%(obj.date_start, obj.date_stop)
 | 
			
		||||
            res[obj.id]={
 | 
			
		||||
                'name': '%s - %s'%(obj.date_start, obj.date_stop),
 | 
			
		||||
            }
 | 
			
		||||
        return res
 | 
			
		||||
 | 
			
		||||
    _fields={
 | 
			
		||||
        'name': fields.Char("Name",function="_get_name",store=True),
 | 
			
		||||
        'name': fields.Char("Name",function="_get_name", function_multi=True, store=True),
 | 
			
		||||
        "period_id": fields.Many2One("clinic.period", "Period"),
 | 
			
		||||
        'date_start': fields.Date("Date Start"),
 | 
			
		||||
        'date_stop': fields.Date("Date Stop"),
 | 
			
		||||
        'date_stop': fields.Date("Date End"),
 | 
			
		||||
        'day_total': fields.Integer("Duration (Day)",function="_get_total"),
 | 
			
		||||
        'state': fields.Selection([['draft','Draft'],['done','Done']],"State"),
 | 
			
		||||
        'state': fields.Selection([['open','Open'],['close','Close']],"State"),
 | 
			
		||||
        'close': fields.Boolean("Close"),
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    _defaults={
 | 
			
		||||
        'state': 'draft',
 | 
			
		||||
        'state': 'open',
 | 
			
		||||
        'close': False,
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -46,4 +48,31 @@ class PeriodLine(Model):
 | 
			
		|||
        super().write(ids,vals,**kw)
 | 
			
		||||
        self.function_store(ids)
 | 
			
		||||
    
 | 
			
		||||
    def do_close(self,ids,context={}):
 | 
			
		||||
        obj=self.browse(ids)[0]
 | 
			
		||||
        obj.write({
 | 
			
		||||
            'state': 'close',
 | 
			
		||||
        })
 | 
			
		||||
        return {
 | 
			
		||||
            'next': {
 | 
			
		||||
                'name': 'clinic_period_line',
 | 
			
		||||
                'mode': 'form',
 | 
			
		||||
                'active_id': obj.id,
 | 
			
		||||
            },
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    def do_open(self,ids,context={}):
 | 
			
		||||
        obj=self.browse(ids)[0]
 | 
			
		||||
        obj.write({
 | 
			
		||||
            'state': 'open',
 | 
			
		||||
        })
 | 
			
		||||
        return {
 | 
			
		||||
            'next': {
 | 
			
		||||
                'name': 'clinic_period_line',
 | 
			
		||||
                'mode': 'form',
 | 
			
		||||
                'active_id': obj.id,
 | 
			
		||||
            },
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
PeriodLine.register()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@ class ReportLaborCost(Model):
 | 
			
		|||
    
 | 
			
		||||
    _fields={
 | 
			
		||||
        "date": fields.Date("Month"),
 | 
			
		||||
        "period_id": fields.Many2One("clinic.period.line","Period"),
 | 
			
		||||
        "date_from": fields.Date("From", required=True),
 | 
			
		||||
        "date_to": fields.Date("To", required=True),
 | 
			
		||||
        "branch_id": fields.Many2One("clinic.branch","Branch"),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,6 +107,8 @@ class ReportLaborCostSubDetail(Model):
 | 
			
		|||
            if qty:
 | 
			
		||||
                amount=amount/qty
 | 
			
		||||
            for hdcase in citem.hd_cases:
 | 
			
		||||
                if hdcase.state not in ("waiting_payment","paid"):
 | 
			
		||||
                    continue
 | 
			
		||||
                patient=hdcase.patient_id
 | 
			
		||||
                doctor=hdcase.doctor_id
 | 
			
		||||
                vals={
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,7 @@
 | 
			
		|||
                <th rowspan="3">ตำแหน่ง</th>
 | 
			
		||||
                <th rowspan="3">หมวดหมู่</th>
 | 
			
		||||
            {{else}}
 | 
			
		||||
                <th rowspan="3"></th>
 | 
			
		||||
                <th rowspan="3" colspan="3">ชื่อ-สกุล</th>
 | 
			
		||||
            {{/ifeq}}
 | 
			
		||||
            {{#each dpts}}
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +47,7 @@
 | 
			
		|||
                        <td>{{staff_level}}</th>
 | 
			
		||||
                        <td>{{categ_name}}</th>
 | 
			
		||||
                    {{else}}
 | 
			
		||||
                        <td></th>
 | 
			
		||||
                        <td colspan="3">
 | 
			
		||||
                            {{view "link" string=staff_name action="clinic_staff" action_options="mode=form" active_id=staff_id}}
 | 
			
		||||
                        </td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue