Merge pull request #2022 from expsa/tasks_trans_31_

Tasks trans 31
This commit is contained in:
enagahh 2024-12-31 16:57:09 +02:00 committed by GitHub
commit d190fcbb3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 28 additions and 19 deletions

View File

@ -55,7 +55,8 @@ class IncomingTransaction(models.Model):
attachment_rule_ids = fields.One2many('cm.attachment.rule', 'incoming_transaction_id', string='Attaches')
attachment_ids = fields.One2many('cm.attachment', 'incoming_transaction_id', string='Attachments')
trace_ids = fields.One2many('cm.transaction.trace', 'incoming_transaction_id', string='Trace Log')
to_ids = fields.Many2one(comodel_name='cm.entity',string='Send To')
# to_ids = fields.Many2one(comodel_name='cm.entity',string='Send To')
# to_delegate = fields.Boolean(string='To Delegate?', related='to_ids.to_delegate')
cc_ids = fields.Many2many(comodel_name='cm.entity', relation='incoming_entity_cc_rel',
column1='incoming_id', column2='entity_id', string='CC To',)

View File

@ -23,11 +23,11 @@ class InternalTransaction(models.Model):
],
required=False, default='unit')
to_ids = fields.Many2one(comodel_name='cm.entity', string='Send To')
delegate_employee_id = fields.Many2one('cm.entity', related='to_ids.delegate_employee_id')
from_date = fields.Datetime(string='Delegation From Date', related='to_ids.from_date')
to_date = fields.Datetime(string='Delegation To Date', related='to_ids.to_date')
to_delegate = fields.Boolean(string='To Delegate?', related='to_ids.to_delegate')
# to_ids = fields.Many2one(comodel_name='cm.entity', string='Send To')
# delegate_employee_id = fields.Many2one('cm.entity', related='to_ids.delegate_employee_id',store=True)
# from_date = fields.Datetime(string='Delegation From Date', related='to_ids.from_date')
# to_date = fields.Datetime(string='Delegation To Date', related='to_ids.to_date')
# to_delegate = fields.Boolean(string='To Delegate?', related='to_ids.to_delegate')
@api.onchange('type_sender')
def _onchange_type_sender(self):

View File

@ -19,7 +19,8 @@ class OutgoingTransaction(models.Model):
is_partner = fields.Boolean()
partner_id = fields.Many2one('res.partner')
incoming_transaction_id = fields.Many2one('incoming.transaction', string='Related Incoming')
to_ids = fields.Many2one(comodel_name='cm.entity',string='Send To')
# to_ids = fields.Many2one(comodel_name='cm.entity',string='Send To')
# to_delegate = fields.Boolean(string='To Delegate?', related='to_ids.to_delegate')
company_name = fields.Many2one('res.partner',string='Delivery Company')
to_users = fields.Many2many(comodel_name='res.users', string="To Users",relation='your_out_to_users_rel',column1='your_out_id',column2='user_id2',)

View File

@ -80,6 +80,8 @@ class Transaction(models.Model):
add_rank = fields.Integer(string='Transaction Rank')
seen_user_ids = fields.Many2many('res.users')
seen_before = fields.Boolean(compute="_compute_seen_before")
to_ids = fields.Many2one(comodel_name='cm.entity', string='Send To')
to_delegate = fields.Boolean(string='To Delegate?')
@api.depends('type','subject')
@ -258,6 +260,9 @@ class Transaction(models.Model):
user_id = record.env.user.id
if user_id not in record.seen_user_ids.ids:
record.seen_user_ids = [(6, 0, [user_id])]
record.to_delegate = record.to_ids.to_delegate
if record.to_delegate:
record.to_ids = record.to_ids.delegate_employee_id.id
def action_approve(self):
for record in self:

View File

@ -26,9 +26,9 @@
<field name="type" required="True"/>
<field name="to_delegate" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="employee_id" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="delegate_employee_id" attrs="{'invisible':[('type','not in',['employee'])]}"/>
<field name="from_date" attrs="{'invisible':[('type','not in',['employee'])]}" readonly="1" force_save="1"/>
<field name="to_date" attrs="{'invisible':[('type','not in',['employee'])]}" readonly="1" force_save="1"/>
<field name="delegate_employee_id" attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}"/>
<field name="from_date" attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}" readonly="1" force_save="1"/>
<field name="to_date" attrs="{'invisible':['|',('type','not in',['employee']),('to_delegate','=',False)]}" readonly="1" force_save="1"/>
<field name="department_id" attrs="{'invisible': [('type','not in',['unit'])]}"/>
<field name="partner_id"
attrs="{'invisible': [('type','not in',['external'])]}"/>

View File

@ -112,9 +112,9 @@
</xpath>
<xpath expr="//field[@name='tran_tag']" position="after">
<field name="to_delegate"/>
<field name="delegate_employee_id"/>
<field name="from_date"/>
<field name="to_date"/>
<!-- <field name="delegate_employee_id"/>-->
<!-- <field name="from_date"/>-->
<!-- <field name="to_date"/>-->
</xpath>
</field>
</record>
@ -189,9 +189,9 @@
<xpath expr="//field[@name='to_ids']" position="after">
<field name="partner_id"/>
<field name="to_delegate"/>
<field name="delegate_employee_id"/>
<field name="from_date"/>
<field name="to_date"/>
<!-- <field name="delegate_employee_id"/>-->
<!-- <field name="from_date"/>-->
<!-- <field name="to_date"/>-->
</xpath>
<xpath expr="//field[@name='to_ids']" position="before">
<field name="type_sender" attrs="{'readonly':[('state','not in', ['draft'])]}"/>

View File

@ -13,9 +13,8 @@
attrs="{'required': True}"
domain="[('type','in',['unit'])]"
options="{'no_open': True, 'no_create': True}"/>
<field name="employee"
attrs="{'required': [('forward_type','=','employee')], 'invisible': [('forward_type','!=','employee')]}"
options="{'no_open': True, 'no_create': True}"/>
<field name="to_delegate" attrs="{'invisible': [('forward_type','!=','employee')]}"/>
<field name="employee" attrs="{'required': [('forward_type','=','employee')], 'invisible': [('forward_type','!=','employee')]}" options="{'no_open': True, 'no_create': True}"/>
<field name="cc_ids" widget="many2many_tags"/>
<field name="note"/>
<field name="is_secret"/>

View File

@ -9,6 +9,7 @@ class ForwardTransactionWizard(models.TransientModel):
required=True)
internal_unit = fields.Many2one('cm.entity', string='Internal Unit')
employee = fields.Many2one('cm.entity', string='Employee')
to_delegate = fields.Boolean(string='To Delegate?', related='employee.to_delegate')
cc_ids = fields.Many2many(comodel_name='cm.entity', string='CC To')
note = fields.Text(string="Notes")
description = fields.Text(string="Description")
@ -40,6 +41,8 @@ class ForwardTransactionWizard(models.TransientModel):
def action_forward(self):
transaction = ''
name = ''
if self.to_delegate:
self.employee = self.employee.delegate_employee_id.id
to_id = self.employee.id
if self.internal_transaction_id:
transaction = self.internal_transaction_id