19 lines
461 B
JavaScript
19 lines
461 B
JavaScript
var moment=require("moment");
|
|
|
|
add_method("hos.patient","get_age",function(ids) {
|
|
var vals={};
|
|
var now=moment();
|
|
this.browse(ids).forEach(function(obj) {
|
|
vals[obj.id]=now.diff(obj.birth_date,"years");
|
|
});
|
|
return vals;
|
|
});
|
|
|
|
add_method("hos.visit","set_done",function(ids) {
|
|
var obj=this.browse(ids)[0];
|
|
obj.write({"state":"done"});
|
|
});
|
|
|
|
add_default("hos.visit","date",function() {
|
|
return moment().format("YYYY-MM-DD");
|
|
}); |