mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[FIX] hr_commission: filter to sales invoices
Additionally, don't require salesperson (e.g. commission structure or timesheets)
This commit is contained in:
@@ -100,7 +100,7 @@ class Commission(models.Model):
|
|||||||
return super(Commission, self).unlink()
|
return super(Commission, self).unlink()
|
||||||
|
|
||||||
def _filter_source_moves_for_creation(self, moves):
|
def _filter_source_moves_for_creation(self, moves):
|
||||||
return moves.filtered(lambda i: i.user_id and not i.commission_ids)
|
return moves.filtered(lambda i: i.is_sale_document() and not i.commission_ids)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _commissions_to_confirm(self, moves):
|
def _commissions_to_confirm(self, moves):
|
||||||
@@ -123,7 +123,7 @@ class Commission(models.Model):
|
|||||||
|
|
||||||
if commission_structure:
|
if commission_structure:
|
||||||
commission_structure.create_for_source_move(move, move_amount)
|
commission_structure.create_for_source_move(move, move_amount)
|
||||||
else:
|
elif move.user_id:
|
||||||
employee = employee_obj.search([('user_id', '=', move.user_id.id)], limit=1)
|
employee = employee_obj.search([('user_id', '=', move.user_id.id)], limit=1)
|
||||||
contract = employee.contract_id
|
contract = employee.contract_id
|
||||||
if all((employee, contract, contract.commission_rate)):
|
if all((employee, contract, contract.commission_rate)):
|
||||||
|
|||||||
Reference in New Issue
Block a user