Commit bd62eccd 董杰

0709

1 个父辈 ba0cacb4
正在显示 67 个修改的文件 包含 565 行增加12 行删除
......@@ -39,7 +39,7 @@ class AccTools(models.Model):
toaddrs = toaddrs
# subject = "最新消息"
subject = subjects
password = "Acc@041"
password = "Acc@0707"
# msg = "测试"
msg = message
mail_msg = MIMEMultipart()
......
......@@ -48,6 +48,7 @@ class CFTemplateCategory(models.Model):
('done', 'Locked'),
('cancel', 'Cancelled')
], string='Status', readonly=True, index=True, copy=False, default='draft', track_visibility='onchange')
color = fields.Integer(string='Color Index')
crm_ponumber = fields.Char(string=u'老采购单号',readonly=True)
charge_person = fields.Many2one('res.users',string=u'负责人',default=lambda self: self.env.user.id,required=True)
traffic_rule = fields.Char(string=u'运输条款',required=True)
......
......@@ -4,6 +4,7 @@ from odoo import fields, models, api, http, _
from odoo.addons import decimal_precision as dp
from odoo.http import request
from odoo.exceptions import UserError, ValidationError
import random
class BeforePurchase(models.Model):
"""
......@@ -30,6 +31,8 @@ class BeforePurchase(models.Model):
charge_person = fields.Many2one('res.users',string='采购负责人')
gen_datetime = fields.Datetime(string='生成时间',default=lambda self: fields.Datetime.now(),)
po_number = fields.Text(string='关联的采购单',readonly=True)
color = fields.Integer(string='颜色')
purchase_order_ids = fields.Many2many('purchase.order','before_purchase_rel','before_id','purchase_id',string='关联采购单',readonly=True)
purchase_company = fields.Many2one('acc.company',string='采购公司',required=True)
delivery_address = fields.Many2one('delivery.address',string='交货地址')
state = fields.Selection([('draft', '待确认'), ('done', '已确认'),('cancel', '已取消')], '状态', default='draft',track_visibility='onchange')
......@@ -76,6 +79,7 @@ class BeforePurchase(models.Model):
}
res_line = [(0,0,line_vals)]
po_vals = {
'color':random.randint(1, 12),
'partner_id':line.partner_id.id,
'title':self.name,
'before_purchase_id':self.id,
......@@ -93,7 +97,8 @@ class BeforePurchase(models.Model):
}
if not exits_order:
po_obj = self.env['purchase.order'].create(po_vals)
self.add_ponumber(po_obj)
# self.add_ponumber(po_obj)
self.add_ponumbers(po_obj)
if exits_order:
exits_order.write({'order_line':res_line})
# self.write({'purchase_date':fields.Datetime.now(),'is_purchasing':True})
......@@ -132,6 +137,12 @@ class BeforePurchase(models.Model):
sale_order.write({'po_number':new_po_name})
self.write({'po_number':new_po_name})
@api.multi
def add_ponumbers(self,pobj):
po_id = pobj.id
self.purchase_order_ids = [(4,po_id)]
return True
def merge_before_line(self):
order_id = self.id
......
......@@ -26,7 +26,8 @@
<field name="sale_order_id" readonly="1"/>
<field name="demand_purchase_id" readonly="1"/>
<field name="is_excipients" readonly="1"/>
<field name="po_number" />
<!-- <field name="po_number" /> -->
<field name="purchase_order_ids" widget="many2many_tags" options="{'color_field': 'color','no_create_edit': True}"/>
<field name="delivery_address"/>
</group>
<group>
......
......@@ -296,7 +296,7 @@ class ExcipientsProduct(models.Model):
AND product_id = %s """%(location_id, p_id)
# now_qty = cr.execute(now_qty_sql, (location_id,p_id))
cr.execute(now_qty_sql)
result = request.cr.dictfetchall()
result = cr.dictfetchall()
if result[0]['theory_qty']:
now_qty = result[0]['theory_qty']
else:
......@@ -350,7 +350,7 @@ class ExcipientsProduct(models.Model):
AND product_id = %s """%(location_id, p_id)
# now_qty = cr.execute(now_qty_sql, (location_id,p_id))
cr.execute(now_qty_sql)
result = request.cr.dictfetchall()
result = cr.dictfetchall()
if result[0]['theory_qty']:
now_qty = result[0]['theory_qty']
else:
......
......@@ -18,14 +18,14 @@ except ImportError:
import time
import base64
import socket
import paramiko
# import paramiko
try:
import paramiko
except ImportError:
raise ImportError(
'This module needs paramiko to automatically write backups to the FTP through SFTP. Please install paramiko on your system. (sudo pip3 install paramiko)')
# try:
# import paramiko
# except ImportError:
# raise ImportError(
# 'This module needs paramiko to automatically write backups to the FTP through SFTP. Please install paramiko on your system. (sudo pip3 install paramiko)')
def execute(connector, method, *args):
......@@ -147,7 +147,8 @@ class DbBackup(models.Model):
for rec in conf_ids:
db_list = self.get_db_list(rec.host, rec.port)
print (db_list)
print (rec.folder)
if rec.name in db_list:
try:
if not os.path.isdir(rec.folder):
......
# -*- coding: utf-8 -*-
from . import controllers
\ No newline at end of file
# -*- coding: utf-8 -*-
{
'name': "Document Preview",
'summary': """
Document Preview allows users to preview a document without downloading it that leads to saving
time and storage of users.
""",
'description': """
Best Odoo Document Preview Apps
Odoo Document Preview Apps
Document Preview Apps
Odoo Documents Preview Apps
Documents Preview Apps
Odoo Preview Document Apps
Preview Document Apps
View Document Apps
Odoo View Document Apps
Document View Apps
Display Document Preview Apps
Odoo Display Document Preview Apps
PDF Document Preview Apps
Odoo PDF Document Preview Apps
Video Document Preview Apps
Odoo Video Document Preview Apps
Image Document Preview Apps
Show Document Apps
Binary Preview Apps
Binary File Preview Apps
File Preview Apps
Show File Document
Display Birany Files
Show Attachment Files
Display Attachment Files
Display Files
Check PDF Files
Check File
Check Image
Document Checker
File Checker
Report Preview
Odoo Report Preview
Document Management System
Document Management Portal
Document Preview Portal
Document Views In Website Portal
Document Version
Document Extension
Document Viewer PDF
MuK Documents View
Asset Documents Management
""",
'author': "Ksolves India Pvt. Ltd.",
'license': 'LGPL-3',
'website': "https://www.ksolves.com",
'category': 'Tools',
'support': 'sales@ksolves.com',
'images': ['static/description/banners/banner1.gif'],
'version': '12.0.1.0.0',
'depends': ['base', 'web', 'mail'],
'data': [
'views/ks_preview_templates.xml',
],
'qweb': ['static/src/xml/ks_binary_preview.xml',
],
}
\ No newline at end of file
# -*- coding: utf-8 -*-
#################################################################################
# Author : Webkul Software Pvt. Ltd. (<https://webkul.com/>)
# Copyright(c): 2015-Present Webkul Software Pvt. Ltd.
# License URL : https://store.webkul.com/license.html/
# All Rights Reserved.
#
#
#
# This program is copyright property of the author mentioned above.
# You can`t redistribute it and/or modify it.
#
#
# You should have received a copy of the License along with this program.
# If not, see <https://store.webkul.com/license.html/>
#################################################################################
from . import main
\ No newline at end of file
# -*- coding: utf-8 -*-
from odoo import fields, http, _
from odoo.http import request
class ks_file_preview(http.Controller):
# Controller: Get the file details
@http.route(['/get/record/details'], type='json', auth="public", methods=['POST'], website=True)
def GetRecordData(self,res_id, model, size, res_field, **kw):
data_file = {}
data = request.env['ir.attachment'].sudo().search([('res_model', '=', model), ('res_id', '=', res_id), ('res_field', '=', res_field)])
div = 2014
if size[-2:] == 'Kb' or size[-2:] == 'kb':
div = 1024
elif size[-2:] == 'Mb' or size[-2:] == 'mb':
div = 1024*1024
elif size[-5:] == 'bytes' or size[-5:] == 'Bytes':
div = 1
size = size[:-3]
for d in data:
if float(size[:-3]) == round(d.file_size/div, 2):
data_file = {
'name': d.name or d.dispay_name,
'id': d.id,
'type': d.mimetype,
}
break
return data_file
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * ks_binary_file_preview
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-30 13:34+0000\n"
"PO-Revision-Date: 2019-08-30 13:34+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: ks_binary_file_preview
#. openerp-web
#: code:addons/ks_binary_file_preview/static/src/xml/ks_binary_preview.xml:3
#, python-format
msgid "Preview"
msgstr ""
<?xml version="1.0" encoding="UTF-8"?>
<svg width="475px" height="403px" viewBox="0 0 475 403" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 55.1 (78136) - https://sketchapp.com -->
<title>check</title>
<desc>Created with Sketch.</desc>
<g id="Page-2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Artboard" transform="translate(-455.000000, -400.000000)" fill-rule="nonzero">
<g id="check" transform="translate(455.000000, 400.000000)">
<path d="M396.283,221.097 C395.143,220.522 394.001,220.235 392.85,220.235 C390.372,220.235 388.189,221.186 386.287,223.092 L368.013,241.363 C366.305,243.078 365.447,245.169 365.447,247.646 L365.447,320.159 C365.447,332.724 360.984,343.473 352.032,352.423 C343.087,361.368 332.331,365.841 319.768,365.841 L82.226,365.841 C69.662,365.841 58.907,361.368 49.962,352.423 C41.015,343.474 36.544,332.725 36.544,320.159 L36.544,82.622 C36.544,70.06 41.015,59.306 49.962,50.358 C58.907,41.412 69.662,36.94 82.226,36.94 L319.77,36.94 C323.958,36.94 328.24,37.511 332.617,38.654 C333.76,39.032 334.616,39.225 335.18,39.225 C337.658,39.225 339.848,38.276 341.75,36.373 L355.74,22.383 C358.022,20.102 358.882,17.34 358.306,14.107 C357.735,11.061 356.02,8.871 353.165,7.54 C342.893,2.788 331.753,0.401 319.762,0.401 L82.226,0.401 C59.576,0.401 40.208,8.443 24.124,24.527 C8.042,40.613 0,59.978 0,82.629 L0,320.172 C0,342.819 8.042,362.186 24.125,378.27 C40.209,394.358 59.577,402.4 82.227,402.4 L319.768,402.4 C342.415,402.4 361.785,394.358 377.869,378.27 C393.954,362.186 402.003,342.82 402.003,320.172 L402.003,229.375 C402.003,225.381 400.088,222.623 396.283,221.097 Z" id="Path" fill="#F7B500"></path>
<path d="M467.95,57.216 L436.541,25.807 C431.973,21.24 426.545,18.956 420.262,18.956 C413.987,18.956 408.555,21.24 403.991,25.807 L219.265,210.532 L144.181,135.443 C139.612,130.873 134.186,128.592 127.907,128.592 C121.627,128.592 116.203,130.873 111.633,135.443 L80.228,166.848 C75.66,171.416 73.374,176.842 73.374,183.125 C73.374,189.405 75.66,194.829 80.228,199.399 L202.995,322.166 C207.564,326.737 212.99,329.017 219.269,329.017 C225.548,329.017 230.973,326.738 235.543,322.166 L467.947,89.763 C472.512,85.196 474.801,79.769 474.801,73.489 C474.801,67.209 472.518,61.783 467.95,57.216 Z" id="Path" fill="#040404"></path>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 180"><defs><style>.cls-1{fill:#e92727;}.cls-2,.cls-5{fill:#fff;stroke-miterlimit:10;}.cls-2{stroke:#e8e8e8;}.cls-3{fill:#c82128;}.cls-4{fill:#e72728;}.cls-5{stroke:#e92727;stroke-width:1.5px;}.cls-6{fill:#444;}.cls-6,.cls-7{fill-rule:evenodd;}.cls-7{fill:#e32235;}</style></defs><title>Ads Layout2</title><path class="cls-1" d="M108.25,66.8h0a46.86,46.86,0,0,1,93.71,0h3a49.9,49.9,0,0,0-99.79,0h3Z"/><path class="cls-2" d="M283.34,180H16C7.37,180,.32,172.72.32,163.82V82.6C.32,73.7,7.37,66.41,16,66.41H283.34C292,66.41,299,73.7,299,82.6v81.22C299,172.72,292,180,283.34,180Z"/><path class="cls-3" d="M284,180H24.1C10.84,180,0,172.74,0,163.88V82.47C0,73,3,64,22.15,66.35Z"/><path class="cls-4" d="M299,78.86v86.26s-.76,12.11-14.41,14.88H13.07A17.4,17.4,0,0,1,0,166.3V154.78Z"/><circle class="cls-5" cx="155.11" cy="65.75" r="33.39"/><path class="cls-6" d="M155.59,50.89V80.58a1.63,1.63,0,0,1-2.5,1.4c-1-.57-18.13-13.84-19.83-14.82a1.61,1.61,0,0,1-.64-2.16,1.63,1.63,0,0,1,.64-.66c1.22-.71,18.44-14,19.88-14.84A1.62,1.62,0,0,1,155.59,50.89Z"/><path id="Shape_3_copy" data-name="Shape 3 copy" class="cls-6" d="M178,58.59V72.9a.88.88,0,0,1-.86.91.8.8,0,0,1-.49-.14c-.53-.31-9.79-6.6-10.7-7.14a.9.9,0,0,1-.34-1.21A.92.92,0,0,1,166,65c.66-.39,10-6.72,10.73-7.16a.87.87,0,0,1,1.2.31A.93.93,0,0,1,178,58.59Z"/><path id="Shape_3_copy_2" data-name="Shape 3 copy 2" class="cls-7" d="M161.47,44.31V58.63a.88.88,0,0,0,.85.91.91.91,0,0,0,.49-.14c.54-.31,9.79-6.61,10.71-7.15a.88.88,0,0,0,.33-1.2.86.86,0,0,0-.33-.35c-.66-.39-10-6.72-10.74-7.16a.86.86,0,0,0-1.19.31A.83.83,0,0,0,161.47,44.31Z"/><path id="Shape_3_copy_3" data-name="Shape 3 copy 3" class="cls-7" d="M161.47,72.86V87.18a.88.88,0,0,0,.86.91.9.9,0,0,0,.48-.14c.54-.31,9.79-6.6,10.71-7.14a.9.9,0,0,0,0-1.55c-.66-.4-10-6.72-10.74-7.16a.85.85,0,0,0-1.19.31A.78.78,0,0,0,161.47,72.86Z"/></svg>
\ No newline at end of file
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="459px" height="459px" viewBox="0 0 459 459" style="enable-background:new 0 0 459 459;" xml:space="preserve">
<g>
<g id="share">
<path d="M459,216.75L280.5,38.25v102c-178.5,25.5-255,153-280.5,280.5C63.75,331.5,153,290.7,280.5,290.7v104.55L459,216.75z" fill="#000"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="459px" height="459px" viewBox="0 0 459 459" style="enable-background:new 0 0 459 459;" xml:space="preserve">
<g>
<g id="share">
<path d="M459,216.75L280.5,38.25v102c-178.5,25.5-255,153-280.5,280.5C63.75,331.5,153,290.7,280.5,290.7v104.55L459,216.75z" fill="#007bff"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 12c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM6 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12-8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm-4 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg>
\ No newline at end of file
<svg height="512" viewBox="0 0 64 64" width="512" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="New_Gradient_Swatch_1" gradientUnits="userSpaceOnUse" x1="32" x2="32" y1="8.462" y2="55.216"><stop offset="0" stop-color="#fff33b"/><stop offset=".014" stop-color="#fee72e"/><stop offset=".042" stop-color="#fed51b"/><stop offset=".07" stop-color="#fdca10"/><stop offset=".1" stop-color="#fdc70c"/><stop offset=".4" stop-color="#f3903f"/><stop offset=".8" stop-color="#ed683c"/><stop offset="1" stop-color="#e93e3a"/></linearGradient><linearGradient id="New_Gradient_Swatch_1-2" x1="36" x2="36" xlink:href="#New_Gradient_Swatch_1" y1="8.462" y2="55.216"/><linearGradient id="New_Gradient_Swatch_1-3" x1="18" x2="18" xlink:href="#New_Gradient_Swatch_1" y1="8.462" y2="55.216"/><linearGradient id="New_Gradient_Swatch_1-5" x1="22" x2="22" xlink:href="#New_Gradient_Swatch_1" y1="8.462" y2="55.216"/><g id="Mail-6" data-name="Mail"><path d="m57 10h-50a5.006 5.006 0 0 0 -5 5v34a5.006 5.006 0 0 0 5 5h50a5.006 5.006 0 0 0 5-5v-34a5.006 5.006 0 0 0 -5-5zm-50 2h50a3 3 0 0 1 3 3v.46l-28 18.345-28-18.345v-.46a3 3 0 0 1 3-3zm53 5.851v27.383l-21.817-13.09zm-34.183 14.293-21.817 13.09v-27.383zm31.183 19.856h-50a3 3 0 0 1 -3-3v-1.434l23.675-14.2 3.777 2.474a1 1 0 0 0 1.1 0l3.777-2.474 23.671 14.2v1.434a3 3 0 0 1 -3 3z" fill="url(#New_Gradient_Swatch_1)"/><path d="m22 48h28v2h-28z" fill="url(#New_Gradient_Swatch_1-2)"/><path d="m16 48h4v2h-4z" fill="url(#New_Gradient_Swatch_1-3)"/><path d="m26 44h20v2h-20z" fill="url(#New_Gradient_Swatch_1-2)"/><path d="m20 44h4v2h-4z" fill="url(#New_Gradient_Swatch_1-5)"/></g></svg>
\ No newline at end of file
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:black;" d="M256,512C114.844,512,0,397.156,0,256S114.844,0,256,0s256,114.844,256,256S397.156,512,256,512z" fill="black"/>
<path style="fill:black;" d="M375.467,426.667c-141.156,0-256-114.844-256-256c0-59.087,20.318-113.41,54.071-156.783
C72.768,48.311,0,143.72,0,256c0,141.156,114.844,256,256,256c82.069,0,155.049-38.974,201.929-99.217
C432.012,421.638,404.342,426.667,375.467,426.667z"/>
<path style="fill:#FFFFFF;" d="M203.034,388.414c-4.518,0-9.038-1.725-12.483-5.173L84.62,277.31
c-6.897-6.892-6.897-18.073,0-24.966c6.888-6.897,18.078-6.897,24.966,0l93.449,93.444l181.724-181.72
c6.888-6.897,18.078-6.897,24.966,0c6.897,6.892,6.897,18.073,0,24.966L215.517,383.241
C212.073,386.689,207.552,388.414,203.034,388.414z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 52 52" style="enable-background:new 0 0 52 52;" xml:space="preserve">
<path d="M26,0C11.664,0,0,11.663,0,26s11.664,26,26,26s26-11.663,26-26S40.336,0,26,0z M38.5,28H28v11c0,1.104-0.896,2-2,2
s-2-0.896-2-2V28H13.5c-1.104,0-2-0.896-2-2s0.896-2,2-2H24V14c0-1.104,0.896-2,2-2s2,0.896,2,2v10h10.5c1.104,0,2,0.896,2,2
S39.604,28,38.5,28z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<svg id="Layer_1" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg" data-name="Layer 1"><path d="m466.17 363.03v69.65h-154.45-111.44-154.45v-69.65z" fill="#00efd1"/><path d="m466.17 97.26v265.77h-420.34v-265.77h90.28l-1.01 185.81s85.71.01 144.77.01a61.835 61.835 0 1 0 55.2-89.71c-.16 0-.33 0-.49.01v-96.12z" fill="#fedb41"/><path d="m390.03 40.81v31.65h-55.45v-31.65a27.668 27.668 0 0 1 27.63-27.72h.1a27.662 27.662 0 0 1 27.72 27.63z" fill="#f4b844"/><path d="m284.14 220.14a61.691 61.691 0 0 1 50.44-26.76c.16-.01.33-.01.49-.01a61.828 61.828 0 1 1 -50.93 26.77z" fill="#00efd1"/><path d="m136.11 97.26.31-58.1a26.2 26.2 0 0 1 26.4-26.07h199.39a27.668 27.668 0 0 0 -27.63 27.72v152.57a61.844 61.844 0 0 0 -54.71 89.7c-59.06 0-144.77-.01-144.77-.01zm147.68-2.95a49.545 49.545 0 1 0 -49.54 49.54 49.54 49.54 0 0 0 49.54-49.54z" fill="#00acea"/><path d="m311.72 432.68 18.57 66.23h-148.58l18.57-66.23z" fill="#00acea"/><path d="m234.25 44.77a49.54 49.54 0 1 1 -49.55 49.54 49.54 49.54 0 0 1 49.55-49.54z" fill="#00efd1"/><g fill="#083863"><path d="m466.17 91h-125.17v-13h49.03c3.313 0 5.97-2.227 5.97-5.54v-31.748a33.714 33.714 0 0 0 -33.729-33.712h-199.451a32.2 32.2 0 0 0 -32.4 31.953l-.278 52.047h-84.312a6.085 6.085 0 0 0 -5.83 6.26v335.42c0 3.314 2.516 6.32 5.83 6.32h146.536l-15.205 54h-26.591a6 6 0 1 0 0 12h210.86a6 6 0 1 0 0-12h-26.591l-15.2-54h146.531c3.314 0 5.83-3.006 5.83-6.32v-335.42a6.085 6.085 0 0 0 -5.83-6.26zm-186.93 164.2a55.433 55.433 0 0 1 9.7-31.441c.1-.131.193-.264.281-.4a56.03 56.03 0 0 1 45.4-24.162c.107 0 .17-.194.278-.194h.169a55.969 55.969 0 1 1 -49.846 81.325v.023a55.139 55.139 0 0 1 -5.982-25.151zm83.082-236.2h.043a21.715 21.715 0 0 1 21.635 21.81v25.19h-43v-25.2a21.312 21.312 0 0 1 21.323-21.71l-.061-6.045zm-220.212 78.292.31-58.177a20.3 20.3 0 0 1 20.4-20.115h173.667c-5.129 6-7.487 13.779-7.487 21.81v146.88a59.615 59.615 0 0 0 -15.058 3.151 6.458 6.458 0 0 0 -4.542-1.841h-149.13a6 6 0 1 0 0 12h134.076a76.664 76.664 0 0 0 -13.257 13h-120.819a6 6 0 1 0 0 12h113.5a73.584 73.584 0 0 0 -4.652 13h-108.848a6 6 0 1 0 0 12h107.092c-.073 2-.122 2.743-.122 4.045a67.808 67.808 0 0 0 3.606 21.955c-48.62 0-110.419.031-129.713.029zm180.266 395.708h-132.752l15.205-54h102.342zm137.624-66h-408v-58h408zm-408-70v-254h78.077l-.977 179.907a6.151 6.151 0 0 0 1.746 4.329 6.03 6.03 0 0 0 4.254 1.8s82.325.026 141.206.027a67.514 67.514 0 0 0 58.764 33.958c37.4 0 68.04-30.424 68.04-67.826 0-35.545-28.11-64.767-62.11-67.583v-84.612h119v254z"/><path d="m234.25 149.85a55.54 55.54 0 1 0 -55.55-55.54 55.6 55.6 0 0 0 55.55 55.54zm0-99.08a43.54 43.54 0 1 1 -43.55 43.54 43.589 43.589 0 0 1 43.55-43.54z"/><path d="m234.25 113.02a5.622 5.622 0 0 1 -5.62-5.61 6 6 0 1 0 -12 0 17.621 17.621 0 0 0 10.37 16.032v2.558a6 6 0 0 0 12 0v-1.649a17.6 17.6 0 0 0 -4.75-34.551 5.615 5.615 0 1 1 5.61-5.62 6 6 0 0 0 12 0 17.627 17.627 0 0 0 -11.86-16.627v-2.553a6 6 0 0 0 -12 0v2.735a17.6 17.6 0 0 0 6.25 34.065 5.61 5.61 0 1 1 0 11.22z"/><path d="m160.27 176h149.13a6 6 0 0 0 0-12h-149.13a6 6 0 1 0 0 12z"/><path d="m324.737 273.222a6 6 0 0 0 4.248 1.778h.015a6 6 0 0 0 4.243-1.757l27.61-27.61a6 6 0 1 0 -8.486-8.486l-23.346 23.347-11.228-11.336a6 6 0 0 0 -8.526 8.444z"/></g></svg>
\ No newline at end of file
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 966.653 966.653" style="enable-background:new 0 0 966.653 966.653;" xml:space="preserve">
<g>
<g id="smartphone_1_">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="483.3267" y1="995.5009" x2="483.3267" y2="-20.2906" gradientTransform="matrix(1 0 0 -1 0 949.7782)">
<stop offset="0" style="stop-color:#FFF33B"/>
<stop offset="0.014" style="stop-color:#FEE72E"/>
<stop offset="0.042" style="stop-color:#FED51B"/>
<stop offset="0.07" style="stop-color:#FDCA10"/>
<stop offset="0.1" style="stop-color:#FDC70C"/>
<stop offset="0.4" style="stop-color:#F3903F"/>
<stop offset="0.8" style="stop-color:#ED683C"/>
<stop offset="1" style="stop-color:#E93E3A"/>
</linearGradient>
<path style="fill:url(#SVGID_1_);" d="M694.718,0H271.936c-25.606,0.027-46.357,20.778-46.383,46.383V920.27
c0.027,25.606,20.778,46.357,46.383,46.383h422.782c25.606-0.027,46.357-20.778,46.383-46.383V46.383
C741.074,20.778,720.323,0.027,694.718,0z M271.936,32.222h422.782c7.814,0.018,14.144,6.348,14.161,14.161v50.282H257.774V46.383
C257.792,38.569,264.122,32.24,271.936,32.222z M708.879,128.887v708.879H257.774V128.887H708.879z M694.718,934.432H271.936
c-7.814-0.018-14.144-6.348-14.161-14.161v-50.282h451.105v50.282C708.861,928.084,702.531,934.414,694.718,934.432z"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="483.3267" y1="994.5021" x2="483.3267" y2="5.2613" gradientTransform="matrix(1 0 0 -1 0 949.7782)">
<stop offset="0" style="stop-color:#FFF33B"/>
<stop offset="0.014" style="stop-color:#FEE72E"/>
<stop offset="0.042" style="stop-color:#FED51B"/>
<stop offset="0.07" style="stop-color:#FDCA10"/>
<stop offset="0.1" style="stop-color:#FDC70C"/>
<stop offset="0.4" style="stop-color:#F3903F"/>
<stop offset="0.8" style="stop-color:#ED683C"/>
<stop offset="1" style="stop-color:#E93E3A"/>
</linearGradient>
<rect x="434.994" y="48.333" style="fill:url(#SVGID_2_);" width="96.665" height="32.222"/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="676.6573" y1="998.7875" x2="676.6573" y2="-11.0591" gradientTransform="matrix(1 0 0 -1 0 949.7782)">
<stop offset="0" style="stop-color:#FFF33B"/>
<stop offset="0.014" style="stop-color:#FEE72E"/>
<stop offset="0.042" style="stop-color:#FED51B"/>
<stop offset="0.07" style="stop-color:#FDCA10"/>
<stop offset="0.1" style="stop-color:#FDC70C"/>
<stop offset="0.4" style="stop-color:#F3903F"/>
<stop offset="0.8" style="stop-color:#ED683C"/>
<stop offset="1" style="stop-color:#E93E3A"/>
</linearGradient>
<rect x="660.546" y="48.333" style="fill:url(#SVGID_3_);" width="32.222" height="32.222"/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="483.3267" y1="978.3428" x2="483.3267" y2="-21.08" gradientTransform="matrix(1 0 0 -1 0 949.7782)">
<stop offset="0" style="stop-color:#FFF33B"/>
<stop offset="0.014" style="stop-color:#FEE72E"/>
<stop offset="0.042" style="stop-color:#FED51B"/>
<stop offset="0.07" style="stop-color:#FDCA10"/>
<stop offset="0.1" style="stop-color:#FDC70C"/>
<stop offset="0.4" style="stop-color:#F3903F"/>
<stop offset="0.8" style="stop-color:#ED683C"/>
<stop offset="1" style="stop-color:#E93E3A"/>
</linearGradient>
<rect x="451.105" y="886.099" style="fill:url(#SVGID_4_);" width="64.444" height="32.222"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<svg height="512" viewBox="0 0 58 58" width="512" xmlns="http://www.w3.org/2000/svg"><g id="024---Star" fill="none"><path id="Shape" d="m40.01 35.73 17.82-14.73h-57.65l17.81 14.73z" fill="#e57e25"/><path id="Shape" d="m11.36 58 17.64-13.83 17.64 13.83c-13.06-44.58-9.09-31.62-17.64-58-11.26 34.76-2.18 6.09-17.64 58z" fill="#f0c419"/><path id="Shape" d="m46.64 58-17.64-13.83v-44.17c8.56 26.44 4.63 13.6 17.64 58z" fill="#f29c1f"/></g></svg>
\ No newline at end of file
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="512px" height="512px"><g><g>
<g>
<path d="M256,0c-49.629,0-90,41.371-90,91c0,49.629,40.371,90,90,90c49.629,0,90-40.371,90-90C346,41.371,305.629,0,256,0z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#FAB446"/>
</g>
</g><g>
<g>
<path d="M286,181h-30h-30c-21.158,0-41.603,5.469-60.19,14.773c31.569,8.518,61.293,20.786,90.19,37.372 c28.898-16.586,58.621-28.854,90.19-37.372C327.603,186.469,307.158,181,286,181z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#FAB446"/>
</g>
</g><g>
<g>
<path d="M482,271c-16.569,0-30,13.431-30,30v60c0,16.567,13.431,30,30,30c16.569,0,30-13.433,30-30v-60 C512,284.431,498.569,271,482,271z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#FAB446"/>
</g>
</g><g>
<g>
<path d="M30,271c-16.569,0-30,13.431-30,30v60c0,16.567,13.431,30,30,30c16.569,0,30-13.433,30-30v-60 C60,284.431,46.569,271,30,271z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#FAB446"/>
</g>
</g><g>
<g>
<path d="M45,211c-8.291,0-15,6.709-15,15v15c33.091,0,60,26.909,60,60v60c0,33.091-26.909,60-60,60v15c0,8.291,6.709,15,15,15 c76.901,0,138.39,24.286,196,61V259.594C183.13,226.414,120.903,211,45,211z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#FAB446"/>
</g>
</g><g>
<g>
<path d="M482,241v-15c0-8.291-6.709-15-15-15c-75.903,0-138.13,15.414-196,48.594V512c57.61-36.714,119.099-61,196-61 c8.291,0,15-6.709,15-15v-15c-33.091,0-60-26.909-60-60v-60C422,267.909,448.909,241,482,241z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#FAB446"/>
</g>
</g></g> </svg>
odoo.define('ks_binary_file_preview.ks_binary_preview', function(require){
var BasicFields = require('web.basic_fields');
var DocumentViewer = require('mail.DocumentViewer');
var core = require('web.core');
var ajax = require('web.ajax');
var ks_file_data = undefined;
BasicFields.FieldBinaryFile.include({
events: _.extend({}, BasicFields.FieldBinaryFile.prototype.events, {
'click .ks_binary_file_preview': "ks_onAttachmentView",
}),
_renderReadonly: function(){
var self = this;
self._super.apply(this,arguments);
if (!self.res_id) {
self.$el.css('cursor', 'not-allowed');
} else {
self.$el.css('cursor', 'pointer');
self.$el.attr('title', 'Download');
}
self.$el.append(core.qweb.render("ks_preview_button"));
},
ks_onAttachmentView: function(ev){
var self = this;
try {
ev.preventDefault();
ev.stopPropagation();
var ks_mimetype = this.recordData.mimetype;
function ks_docView(ks_file_data){
if(ks_file_data){
var ks_attachment = [{
filename: ks_file_data.name,
id: ks_file_data.id,
is_main: false,
mimetype: ks_file_data.type,
name: ks_file_data.name,
type: ks_file_data.type,
url: "/web/content/" + ks_file_data.id + "?download=true",
}]
var ks_activeAttachmentID = ks_file_data.id;
var ks_attachmentViewer = new DocumentViewer(self, ks_attachment, ks_activeAttachmentID);
ks_attachmentViewer.appendTo($('body'));
}
}
if(ks_mimetype){
ks_file_data = {
'id' : this.recordData.id,
'type' : this.recordData.mimetype || 'application/octet-stream',
'name' : this.recordData.name || this.recordData.display_name || "",
}
ks_docView(ks_file_data);
}
else{
var def = ajax.jsonRpc("/get/record/details", 'call',{
'res_id': this.res_id,
'model': this.model,
'size': this.value,
'res_field': this.field.string || this.name,
});
}
return $.when(def).then(function(vals){
if (vals){
ks_docView(vals);
}
});
}
catch(err) {
alert(err);
}
},
});
});
<template xml:spacer="preserve">
<t t-name="ks_preview_button">
<button type="button" class="ks_binary_file_preview btn btn-secondary fa fa-file-text-o" style="padding: 0px 4px; color: #7C7BAD;" title="Preview" aria-label="Preview"/>
</t>
</template>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="board assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/ks_binary_file_preview/static/src/js/ks_binary_preview.js"/>
</xpath>
</template>
</odoo>
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!