trytonpsk-sale_charge/agent.py

27 lines
963 B
Python
Raw Normal View History

2020-04-15 21:42:19 +02:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
2021-06-22 20:39:04 +02:00
from trytond.pool import PoolMeta
from trytond.model import fields, ModelSQL
2020-04-15 21:42:19 +02:00
2023-02-09 03:27:23 +01:00
class AgentNeighbourhood(ModelSQL):
2020-04-15 21:42:19 +02:00
'Agent - Zones'
2023-02-09 03:27:23 +01:00
__name__ = 'sale.sale_charge.agent_neighbourhood'
_table = 'sale-sale_charge-agent_neighbourhood_rel'
2020-04-15 21:42:19 +02:00
agent = fields.Many2One('commission.agent', 'Agent', ondelete='CASCADE',
required=True)
2023-02-09 03:27:23 +01:00
neighbourhood = fields.Many2One('country.city.neighbourhood',
'Neighbourhood', ondelete='RESTRICT', required=True)
2020-04-15 21:42:19 +02:00
class Agent(metaclass=PoolMeta):
__name__ = 'commission.agent'
active = fields.Boolean('Active')
2023-02-09 03:27:23 +01:00
neighbourhood = fields.Many2Many('sale.sale_charge.agent_neighbourhood',
'agent', 'neighbourhood', 'Neighbourhood')
2020-04-15 21:42:19 +02:00
user = fields.Many2One('res.user', 'user')
@staticmethod
def default_active():
return True