Merge pull request #465 from expsa/dev_odex25_transactions
Dev odex25 transactions
This commit is contained in:
commit
131417a161
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, api, fields, _
|
||||
import base64
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import ValidationError,UserError
|
||||
TRACE_ACTIONS = [
|
||||
('forward', _('Forwarded')),
|
||||
('receive', _('Received')),
|
||||
|
|
@ -81,7 +81,7 @@ class AttachmentRule(models.Model):
|
|||
entity_id = fields.Many2one(comodel_name='cm.entity', string='Unit Responsible', related='employee_id.parent_id',
|
||||
store=True)
|
||||
file_save = fields.Binary('Save File')
|
||||
external_drive_link = fields.Char('External Drive Link')
|
||||
external_drive_link = fields.Text('External Drive Link')
|
||||
attachment_filename = fields.Char(string="Attachment Filename")
|
||||
incoming_transaction_id = fields.Many2one(comodel_name='incoming.transaction', string='Incoming Transaction')
|
||||
internal_transaction_id = fields.Many2one(comodel_name='internal.transaction', string='Internal Transaction')
|
||||
|
|
@ -89,14 +89,14 @@ class AttachmentRule(models.Model):
|
|||
date = fields.Datetime(string='Date', default=fields.Datetime.now)
|
||||
description = fields.Char(string='Description')
|
||||
|
||||
@api.constrains('file_save')
|
||||
def _check_attachment_size(self):
|
||||
max_size = 4 * 1024 * 1024 # 4 MB
|
||||
for record in self:
|
||||
if record.file_save:
|
||||
file_size = len(base64.b64decode(record.file_save))
|
||||
if file_size > max_size:
|
||||
raise ValidationError(_('Attachment %s exceeds the maximum allowed size of 4 MB.') % record.attachment_filename)
|
||||
# @api.constrains('file_save')
|
||||
# def _check_attachment_size(self):
|
||||
# max_size = 4 * 1024 * 1024 # 4 MB
|
||||
# for record in self:
|
||||
# if record.file_save:
|
||||
# file_size = len(base64.b64decode(record.file_save))
|
||||
# if file_size > max_size:
|
||||
# raise ValidationError(_('Attachment %s exceeds the maximum allowed size of 4 MB.') % record.attachment_filename)
|
||||
|
||||
@api.onchange('file_save')
|
||||
def _onchange_file_save(self):
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@
|
|||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='to_ids']" position="before">
|
||||
<field name='company_name'/>
|
||||
<field name="is_partner" widget="boolean_toggle"/>
|
||||
<field name="partner_id"
|
||||
attrs="{'invisible':[('is_partner','!=',True)],'required':[('is_partner','=',True)]}"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue