Merge branch 'master' of https://gitlab.com/flectra-hq/flectra into 1.0
This commit is contained in:
commit
ef822e9442
@ -12,7 +12,7 @@ Core mechanisms for the accounting modules. To display the menuitems, install th
|
||||
'category': 'Accounting',
|
||||
'website': 'https://flectrahq.com/accounting',
|
||||
'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'],
|
||||
'depends' : ['base_setup', 'product', 'analytic', 'web_planner', 'portal', 'digest'],
|
||||
'depends' : ['base_setup', 'product', 'analytic', 'web_planner', 'portal', 'digest', 'base_branch_company'],
|
||||
'data': [
|
||||
'security/account_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
@ -7,7 +7,7 @@
|
||||
'version': '1.1',
|
||||
'website' : 'https://flectrahq.com/accounting',
|
||||
'category': 'Hidden/Dependency',
|
||||
'depends' : ['base', 'decimal_precision', 'mail'],
|
||||
'depends' : ['base', 'decimal_precision', 'mail', 'base_branch_company'],
|
||||
'description': """
|
||||
Module for defining analytic accounting object.
|
||||
===============================================
|
||||
|
@ -92,6 +92,19 @@ class Users(models.Model):
|
||||
|
||||
_inherit = "res.users"
|
||||
|
||||
@api.multi
|
||||
def read(self, fields=None, load='_classic_read'):
|
||||
result = super(Users, self).read(fields, load=load)
|
||||
self.with_context({'check_branch': True}).check_missing_branch()
|
||||
return result
|
||||
|
||||
@api.multi
|
||||
def check_missing_branch(self):
|
||||
for user_id in self:
|
||||
if self._context.get('check_branch', False) and user_id.company_id.branch_id and not user_id.default_branch_id:
|
||||
user_id.default_branch_id = user_id.company_id.branch_id.id
|
||||
user_id.branch_ids = [(4, user_id.company_id.branch_id.id)]
|
||||
|
||||
@api.model
|
||||
def branch_default_get(self, user):
|
||||
if not user:
|
||||
|
@ -134,7 +134,7 @@ class ResConfigSettings(models.TransientModel):
|
||||
if self.activator_key and self.contract_id:
|
||||
try:
|
||||
set_param = self.env['ir.config_parameter'].sudo().set_param
|
||||
binary = json.loads(base64.decodestring(self.activator_key)).encode('ascii')
|
||||
binary = json.loads(base64.decodestring(self.activator_key).decode('utf-8')).encode('ascii')
|
||||
binary = base64.decodestring(binary)
|
||||
enc = json.dumps(decrypt(binary, self.contract_id))
|
||||
if enc:
|
||||
|
@ -22,6 +22,7 @@
|
||||
'web_tour',
|
||||
'contacts',
|
||||
'digest',
|
||||
'base_branch_company'
|
||||
],
|
||||
'data': [
|
||||
'security/crm_security.xml',
|
||||
|
@ -19,7 +19,8 @@
|
||||
'web',
|
||||
'web_planner',
|
||||
'web_tour',
|
||||
'digest'
|
||||
'digest',
|
||||
'base_branch_company'
|
||||
],
|
||||
'description': "",
|
||||
'data': [
|
||||
|
@ -333,7 +333,9 @@
|
||||
<a class="o_kanban_manage_toggle_button o_left" href="#" groups="project.group_project_manager"><i class="fa fa-ellipsis-v" /></a>
|
||||
<span class="o_right"><field name="is_favorite" widget="boolean_favorite" nolabel="1" force_save="1" /></span>
|
||||
</div>
|
||||
|
||||
<div t-if="record.displayed_image_id.value">
|
||||
<field name="displayed_image_id" widget="attachment_image"/>
|
||||
</div>
|
||||
<div class="o_project_kanban_boxes">
|
||||
<a class="o_project_kanban_box" name="%(act_project_project_2_project_task_all)d" type="action">
|
||||
<div>
|
||||
|
@ -9,7 +9,7 @@
|
||||
'sequence': 40,
|
||||
'summary': 'A module for Scrum implementation',
|
||||
'depends': [
|
||||
'project', 'resource'
|
||||
'project', 'resource', 'base_branch_company'
|
||||
],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
|
@ -10,7 +10,7 @@
|
||||
'summary': 'Purchase Orders, Receipts, Vendor Bills',
|
||||
'description': "",
|
||||
'website': 'https://flectrahq.com/purchase',
|
||||
'depends': ['stock_account'],
|
||||
'depends': ['stock_account', 'base_branch_company'],
|
||||
'data': [
|
||||
'security/purchase_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
@ -13,6 +13,7 @@
|
||||
'depends': [
|
||||
'purchase',
|
||||
'purchase_requisition',
|
||||
'base_branch_company'
|
||||
],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
|
@ -10,7 +10,7 @@
|
||||
'description': """
|
||||
This module contains all the common features of Sales Management and eCommerce.
|
||||
""",
|
||||
'depends': ['sales_team', 'account', 'portal'],
|
||||
'depends': ['sales_team', 'account', 'portal', 'base_branch_company'],
|
||||
'data': [
|
||||
'security/sale_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
@ -11,7 +11,7 @@ Using this application you can manage Sales Channels with CRM and/or Sales
|
||||
===========================================================================
|
||||
""",
|
||||
'website': 'https://flectrahq.com/page/crm',
|
||||
'depends': ['base', 'mail'],
|
||||
'depends': ['base', 'mail', 'base_branch_company'],
|
||||
'data': ['security/sales_team_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'data/sales_team_data.xml',
|
||||
|
@ -8,7 +8,7 @@
|
||||
'summary': 'Inventory, Logistics, Warehousing',
|
||||
'description': "",
|
||||
'website': 'https://flectrahq.com/page/warehouse',
|
||||
'depends': ['product', 'barcodes', 'web_planner'],
|
||||
'depends': ['product', 'barcodes', 'web_planner', 'base_branch_company'],
|
||||
'category': 'Warehouse',
|
||||
'sequence': 13,
|
||||
'demo': [
|
||||
|
@ -135,7 +135,7 @@ class Location(models.Model):
|
||||
('lot_stock_id', 'in', record.ids),
|
||||
('wh_output_stock_loc_id', 'in', record.ids)])
|
||||
for warehouse_id in warehouses_ids:
|
||||
if record.branch_id and record.branch_id != warehouse_id.branch_id:
|
||||
if record.branch_id and warehouse_id.branch_id and record.branch_id != warehouse_id.branch_id:
|
||||
raise ValidationError(
|
||||
_('Configuration Error of Branch:\n'
|
||||
'The Location Branch (%s) and '
|
||||
|
@ -1867,13 +1867,44 @@ class ReportController(http.Controller):
|
||||
|
||||
class LicensingController(http.Controller):
|
||||
@http.route('/flectra/licensing', type='http', auth="user")
|
||||
def download(self, binary='', **kwargs):
|
||||
filename = '%s.%s' % (FILENAME, EXT)
|
||||
content = binary
|
||||
return request.make_response(
|
||||
content,
|
||||
headers=[
|
||||
('Content-Type', 'plain/text' or 'application/octet-stream'),
|
||||
('Content-Disposition', content_disposition(filename))
|
||||
]
|
||||
)
|
||||
def download(self, contract_id=None, type=None, binary='', **kwargs):
|
||||
if type == 'offline':
|
||||
filename = '%s.%s' % (FILENAME, EXT)
|
||||
content = binary
|
||||
return request.make_response(
|
||||
content,
|
||||
headers=[
|
||||
('Content-Type', 'plain/text' or 'application/octet-stream'),
|
||||
('Content-Disposition', content_disposition(filename))
|
||||
]
|
||||
)
|
||||
elif type == 'online':
|
||||
error = {
|
||||
'code': 200,
|
||||
'message': "Invalid License Key",
|
||||
'data': ''
|
||||
}
|
||||
try:
|
||||
if contract_id:
|
||||
data = {
|
||||
'data': binary,
|
||||
'contract_id': contract_id
|
||||
}
|
||||
p = requests.post(
|
||||
server_url + '/my/contract/validate/online',
|
||||
params=data,
|
||||
headers={'Content-type': 'plain/text' or 'application/octet-stream'})
|
||||
content = json.loads(p.content.decode('utf-8'))
|
||||
if 'activation_key' in content:
|
||||
date = datetime.datetime.now() + datetime.timedelta(days=(12 * 30 * 1))
|
||||
set_param = request.env['ir.config_parameter'].sudo().set_param
|
||||
set_param('database.expiration_date', date)
|
||||
set_param('contract.validity',
|
||||
base64.encodestring(
|
||||
encrypt(json.dumps(str(date)),str(date))))
|
||||
if 'error_in_key' in content:
|
||||
return request.make_response(html_escape(json.dumps(error)))
|
||||
except Exception as e:
|
||||
error['code'] = 400
|
||||
error['message'] = 'Flectra Error!'
|
||||
return request.make_response(html_escape(json.dumps(error)))
|
@ -61,17 +61,28 @@ class Http(models.AbstractModel):
|
||||
currencies = Currency.search([]).read(['symbol', 'position', 'decimal_places'])
|
||||
return { c['id']: {'symbol': c['symbol'], 'position': c['position'], 'digits': [69,c['decimal_places']]} for c in currencies}
|
||||
|
||||
def get_contracted_modules(self, contract_key='', ir_module_module_ids=None):
|
||||
def get_contracted_modules(self, type=None, contract_key=None, ir_module_module_ids=None):
|
||||
if ir_module_module_ids:
|
||||
contract_key = contract_key or ''
|
||||
contracted_module_list = ir_module_module_ids.mapped('name')
|
||||
contracts = encrypt(json.dumps(contracted_module_list), contract_key)
|
||||
warrant = self.env['publisher_warranty.contract'].sudo()._get_message()
|
||||
warrant.update({
|
||||
'contracts': contracted_module_list,
|
||||
'contract_id': contract_key
|
||||
})
|
||||
if type != 'online':
|
||||
contracts = encrypt(json.dumps(warrant), contract_key)
|
||||
else:
|
||||
contracts = str.encode(json.dumps(warrant))
|
||||
return contracts
|
||||
|
||||
@api.model
|
||||
def contract_validate_file(self, contract_id):
|
||||
ir_module_module_ids = self.env['ir.module.module'].sudo().search(
|
||||
[('contract_certificate', '!=', False), ('state', '=', 'installed')])
|
||||
contracts = self.get_contracted_modules(contract_id,ir_module_module_ids)
|
||||
def contract_validate_file(self, contract_id, type):
|
||||
contracts = []
|
||||
if contract_id:
|
||||
ir_module_module_ids = self.env['ir.module.module'].sudo().search(
|
||||
[('contract_certificate', '!=', False), ('state', '=', 'installed')])
|
||||
contracts = self.get_contracted_modules(type, contract_id, ir_module_module_ids)
|
||||
return json.dumps(base64.encodestring(contracts).decode('ascii'))
|
||||
|
||||
def check_validate_date(self, config):
|
||||
|
@ -24,15 +24,16 @@ flectra.define('FlectraLicensing.DialogRegisterContract', function (require) {
|
||||
save: function () {
|
||||
var contract_id = this.$el.find('#contract_id').val();
|
||||
var self = this;
|
||||
if (!contract_id) {
|
||||
var type = this.$el.find("input[name='activate']:checked").val();
|
||||
if (!contract_id || !type) {
|
||||
return;
|
||||
}
|
||||
rpc.query({
|
||||
model: 'ir.http',
|
||||
method: 'contract_validate_file',
|
||||
args: [contract_id]
|
||||
args: [contract_id,type]
|
||||
}).done(function (bin) {
|
||||
self.trigger('get_key', {'key': contract_id, 'binary': bin});
|
||||
self.trigger('get_key', {'key': contract_id, 'binary': bin, 'type': type});
|
||||
self.close();
|
||||
});
|
||||
}
|
||||
|
@ -244,7 +244,17 @@ return AbstractWebClient.extend({
|
||||
session.get_file({
|
||||
url: '/flectra/licensing',
|
||||
data: {
|
||||
'binary': key['binary']
|
||||
'binary': key['binary'],
|
||||
'type': key['type'],
|
||||
'contract_id': key['key']
|
||||
},
|
||||
error: function (err) {
|
||||
new require('web.Dialog').alert(null,err['message']);
|
||||
},
|
||||
success:function () {
|
||||
if (key['type'] === 'online') {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -291,7 +301,7 @@ return AbstractWebClient.extend({
|
||||
overlayCSS: {cursor: 'auto'}
|
||||
});
|
||||
self.contract_expired();
|
||||
}, 15000);
|
||||
}, 150000);
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -122,6 +122,14 @@
|
||||
<div t-name="FlectraLicense.dialog_contract_registration" >
|
||||
<div id="register_contract_form">
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<label for="activate_online">
|
||||
<input id="activate_online" type="radio" name="activate" value="online">Online</input>
|
||||
</label>
|
||||
<label for="activate_offline">
|
||||
<input id="activate_offline" type="radio" name="activate" value="offline" checked="">Offline</input>
|
||||
</label>
|
||||
</div>
|
||||
<label for="contract_id">Contract ID</label>
|
||||
<input type="text" class="form-control" id="contract_id" placeholder="Contract ID"/>
|
||||
<input type="hidden" value=""/>
|
||||
|
Loading…
Reference in New Issue
Block a user