khaz_trans

This commit is contained in:
mohammed-alkhazrji 2025-11-03 14:26:00 +03:00
parent 2c2b7c2cf6
commit f2f9ff0043
7 changed files with 21 additions and 5 deletions

View File

@ -229,6 +229,20 @@ class TransactionTrace(models.Model):
cc_ids = fields.Many2many('cm.entity', string='CC To')
body = fields.Html(string='Transaction Details')
@api.model
def create(self, vals):
record = super(TransactionTrace, self).create(vals)
now = fields.Datetime.now()
if record.incoming_transaction_id:
record.incoming_transaction_id.last_action_date = now
elif record.internal_transaction_id:
record.internal_transaction_id.last_action_date = now
elif record.outgoing_transaction_id:
record.outgoing_transaction_id.last_action_date = now
return record
class ProjectType(models.Model):
_name = "project.type"

View File

@ -15,7 +15,7 @@ class Entity(models.Model):
_name = 'cm.entity'
_description = 'Transactions Contacts'
_order = 'name'
active = fields.Boolean(string='Active', default=True)
def _normalize_arabic_text(self, text):
translation_map = str.maketrans({

View File

@ -8,6 +8,7 @@ class InternalTransaction(models.Model):
_name = 'internal.transaction'
_inherit = ['transaction.transaction', 'mail.thread']
_description = 'internal Transaction'
_order = 'last_action_date desc'
# due_date = fields.Date(string='Deadline', compute='_compute_due_date')
reason = fields.Text('Reason')

View File

@ -23,6 +23,7 @@ class Transaction(models.Model):
_name = 'transaction.transaction'
_inherit = ['mail.thread']
_description = 'for common attribute between transaction'
_order = 'last_action_date desc'
name = fields.Char(string='Transaction Number')
type = fields.Selection(string='Transaction Type', selection=[
@ -81,7 +82,7 @@ class Transaction(models.Model):
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?')
last_action_date = fields.Datetime(string='Last Action', )
@api.depends('type','subject')
def compute_img(self):

View File

@ -46,7 +46,7 @@
<field name="name">common.incoming.transaction.tree</field>
<field name="model">incoming.transaction</field>
<field name="arch" type="xml">
<tree default_order="transaction_date desc" decoration-info="seen_before == False"
<tree default_order="last_action_date desc" decoration-info="seen_before == False"
string="Incoming Transaction" create="false" edit="false">
<field name="from_id"/>
<field name="partner_id"/>

View File

@ -45,7 +45,7 @@
<field name="model">internal.transaction</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<tree default_order="transaction_date desc" decoration-info="seen_before == False"
<tree default_order="last_action_date desc" decoration-info="seen_before == False"
string="Internal Transaction" create="false" edit="false">
<field name="name"/>
<field name="transaction_date"/>

View File

@ -44,7 +44,7 @@
<field name="model">outgoing.transaction</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<tree default_order="transaction_date desc" decoration-info="seen_before == False"
<tree default_order="last_action_date desc" decoration-info="seen_before == False"
string="Outgoing External Transaction" create="false" edit="false">
<field name="name"/>
<field name="transaction_date"/>