GoodERP
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

47 líneas
2.2KB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 上海开阖软件有限公司 (http://www.osbzr.com)
  3. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  4. from odoo import fields, models, api, _
  5. change = [('time', '计时'),
  6. ('piece', '计件'),
  7. ('efficiency', '计效')]
  8. class CreateWagesLineWizard(models.TransientModel):
  9. _name = 'create.wages.line.wizard'
  10. _description = 'input staff wages'
  11. wages_change = fields.Selection(change, '记工类型')
  12. def input_change_wages(self):
  13. if not self.env.context.get('active_id'):
  14. return
  15. date = fields.Date.context_today(self)
  16. wages = self.env['staff.wages'].browse(
  17. self.env.context.get('active_id'))
  18. staff_ids = self.env['staff'].search(['&',
  19. ('active', '=', True),
  20. ('contract_ids', '!=', False)])
  21. for staff in staff_ids:
  22. for line in staff.contract_ids:
  23. if date < line.over_date and (self.wages_change == line.wages_change or not self.wages_change):
  24. self.env['wages.line'].create({
  25. 'name': staff.id,
  26. 'order_id': wages.id,
  27. 'basic_wage': line.basic_wage,
  28. 'basic_date': line.basic_date if hasattr(line, 'basic_date') else 21.75,
  29. 'endowment': line.endowment,
  30. 'health': line.health,
  31. 'unemployment': line.unemployment,
  32. 'housing_fund': line.housing_fund,
  33. 'endowment_co': line.endowment_co if hasattr(line, 'endowment_co') else 0,
  34. 'health_co': line.health_co if hasattr(line, 'health_co') else 0,
  35. 'unemployment_co': line.unemployment_co if hasattr(line, 'unemployment_co') else 0,
  36. 'housing_fund_co': line.housing_fund_co if hasattr(line, 'housing_fund_co') else 0,
  37. 'injury': line.injury if hasattr(line, 'injury') else 0,
  38. 'maternity': line.maternity if hasattr(line, 'maternity') else 0,
  39. })
  40. continue
上海开阖软件有限公司 沪ICP备12045867号-1