Fall 4424: Nummernkreise
parent
db656cbaa2
commit
efd658f91e
|
|
@ -1,12 +1,17 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
from urllib.parse import urlparse
|
try:
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
except ImportError:
|
||||||
|
from urlparse import urlparse
|
||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .environments import ENVIRONMENTS, Environment
|
from .environments import ENVIRONMENTS, Environment
|
||||||
from .functions import DatenpolFunctions
|
from .functions import DatenpolFunctions
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
def _usage():
|
def _usage():
|
||||||
print('Verwendung: dp <environment> <command> [<module_name>/<setup_function>]')
|
print('Verwendung: dp <environment> <command> [<module_name>/<setup_function>]')
|
||||||
|
|
@ -145,7 +150,7 @@ def main():
|
||||||
if cmd == 'rollout':
|
if cmd == 'rollout':
|
||||||
methods = [
|
methods = [
|
||||||
'login',
|
'login',
|
||||||
#'set_sequences',
|
'set_sequences',
|
||||||
#'set_dmi_noupdate',
|
#'set_dmi_noupdate',
|
||||||
#'dmi_confirm_inventory',
|
#'dmi_confirm_inventory',
|
||||||
#'import_users',
|
#'import_users',
|
||||||
|
|
@ -234,7 +239,7 @@ def main():
|
||||||
|
|
||||||
env.pwd = input('Passwort: ')
|
env.pwd = input('Passwort: ')
|
||||||
|
|
||||||
if cmd in ['create','dump','restore']:
|
if cmd in ['create', 'dump', 'restore']:
|
||||||
env.super_admin_pw = input('Super-Admin-Passwort: ')
|
env.super_admin_pw = input('Super-Admin-Passwort: ')
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
|
||||||
|
|
||||||
class ConfigGlaser(Config):
|
class ConfigGlaser(Config):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(ConfigGlaser, self).__init__()
|
super(ConfigGlaser, self).__init__()
|
||||||
|
|
@ -35,29 +36,28 @@ class ConfigGlaser(Config):
|
||||||
self.sequences = {
|
self.sequences = {
|
||||||
'sale.order': {
|
'sale.order': {
|
||||||
# 'number_next_actual': 1,
|
# 'number_next_actual': 1,
|
||||||
'prefix': 'GL%(y)s',
|
'prefix': 'ATOC%(range_y)s-',
|
||||||
'padding': 4,
|
'padding': 6,
|
||||||
'use_date_range': True,
|
'use_date_range': True,
|
||||||
'monthly_date_range': False
|
'monthly_date_range': False
|
||||||
},
|
},
|
||||||
'account.invoice': {
|
'account.invoice': {
|
||||||
# 'number_next_actual': 0001,
|
# 'number_next_actual': 0001,
|
||||||
'prefix': 'GL%(y)s%(month)s',
|
'prefix': '%(range_year)s-',
|
||||||
'padding': 4,
|
'padding': 6,
|
||||||
'use_date_range': True,
|
'use_date_range': True,
|
||||||
'monthly_date_range': False
|
|
||||||
},
|
},
|
||||||
# Wenn 'account.invoice_refund' auskommentiert ist, dann wird
|
# Wenn 'account.invoice_refund' auskommentiert ist, dann wird
|
||||||
# für die Gutschrift der selbe Nummernkreis verwendet
|
# für die Gutschrift der selbe Nummernkreis verwendet
|
||||||
'account.invoice_refund': {
|
# 'account.invoice_refund': {
|
||||||
# 'number_next_actual': 0001,
|
# # 'number_next_actual': 0001,
|
||||||
'name': 'Gutschriften',
|
# 'name': 'Gutschriften',
|
||||||
'implementation': 'no_gap',
|
# 'implementation': 'no_gap',
|
||||||
'prefix': 'GL%(y)s',
|
# 'prefix': 'GL%(y)s',
|
||||||
'padding': 4,
|
# 'padding': 4,
|
||||||
'use_date_range': True,
|
# 'use_date_range': True,
|
||||||
'monthly_date_range': False
|
# 'monthly_date_range': False
|
||||||
},
|
# },
|
||||||
# 'picking.out': {
|
# 'picking.out': {
|
||||||
# # 'number_next_actual': 1,
|
# # 'number_next_actual': 1,
|
||||||
# 'prefix': 'LS-',
|
# 'prefix': 'LS-',
|
||||||
|
|
@ -83,4 +83,3 @@ class ConfigGlaser(Config):
|
||||||
self.multi_company_settings = {
|
self.multi_company_settings = {
|
||||||
'chart_template_id': ('xmlid', 'l10n_at.austria_chart_template')
|
'chart_template_id': ('xmlid', 'l10n_at.austria_chart_template')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
|
||||||
|
|
||||||
class ConfigTZA(Config):
|
class ConfigTZA(Config):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(ConfigTZA, self).__init__()
|
super(ConfigTZA, self).__init__()
|
||||||
|
|
@ -35,29 +36,28 @@ class ConfigTZA(Config):
|
||||||
self.sequences = {
|
self.sequences = {
|
||||||
'sale.order': {
|
'sale.order': {
|
||||||
# 'number_next_actual': 1,
|
# 'number_next_actual': 1,
|
||||||
'prefix': '%(y)s',
|
'prefix': 'ATOC%(range_y)s-',
|
||||||
'padding': 4,
|
'padding': 6,
|
||||||
'use_date_range': True,
|
'use_date_range': True,
|
||||||
'monthly_date_range': False
|
'monthly_date_range': False
|
||||||
},
|
},
|
||||||
'account.invoice': {
|
'account.invoice': {
|
||||||
# 'number_next_actual': 0001,
|
# 'number_next_actual': 0001,
|
||||||
'prefix': '%(y)s%(month)s',
|
'prefix': '%(range_year)s-',
|
||||||
'padding': 4,
|
'padding': 6,
|
||||||
'use_date_range': True,
|
'use_date_range': True,
|
||||||
'monthly_date_range': False
|
|
||||||
},
|
},
|
||||||
# Wenn 'account.invoice_refund' auskommentiert ist, dann wird
|
# Wenn 'account.invoice_refund' auskommentiert ist, dann wird
|
||||||
# für die Gutschrift der selbe Nummernkreis verwendet
|
# für die Gutschrift der selbe Nummernkreis verwendet
|
||||||
'account.invoice_refund': {
|
# 'account.invoice_refund': {
|
||||||
# 'number_next_actual': 0001,
|
# # 'number_next_actual': 0001,
|
||||||
'name': 'Gutschriften',
|
# 'name': 'Gutschriften',
|
||||||
'implementation': 'no_gap',
|
# 'implementation': 'no_gap',
|
||||||
'prefix': '%(y)s',
|
# 'prefix': '%(y)s',
|
||||||
'padding': 4,
|
# 'padding': 4,
|
||||||
'use_date_range': True,
|
# 'use_date_range': True,
|
||||||
'monthly_date_range': False
|
# 'monthly_date_range': False
|
||||||
},
|
# },
|
||||||
# 'picking.out': {
|
# 'picking.out': {
|
||||||
# # 'number_next_actual': 1,
|
# # 'number_next_actual': 1,
|
||||||
# 'prefix': 'LS-',
|
# 'prefix': 'LS-',
|
||||||
|
|
@ -79,4 +79,3 @@ class ConfigTZA(Config):
|
||||||
# 'padding': 5,
|
# 'padding': 5,
|
||||||
# },
|
# },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import print_function
|
||||||
import base64
|
import base64
|
||||||
import sys
|
import sys
|
||||||
import odoorpc
|
import odoorpc
|
||||||
|
|
||||||
from urllib.parse import urlparse
|
try:
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
except ImportError:
|
||||||
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
|
||||||
class DatenpolFunctions:
|
class DatenpolFunctions(object):
|
||||||
def __init__(self, environment, config):
|
def __init__(self, environment, config):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
@ -252,9 +255,19 @@ class DatenpolFunctions:
|
||||||
|
|
||||||
# Angebot
|
# Angebot
|
||||||
if seq_dict.get('sale.order', False):
|
if seq_dict.get('sale.order', False):
|
||||||
s_ids = ir_seq.search([('code', '=', 'sale.order')])
|
s_ids = ir_seq.search([('code', '=', 'sale.order'), ('company_id', '=', self.company_id.id)])
|
||||||
|
if not s_ids:
|
||||||
|
s_ids = ir_seq.search([('code', '=', 'sale.order'), ('company_id', '=', False)])
|
||||||
if len(s_ids) != 1:
|
if len(s_ids) != 1:
|
||||||
return False
|
s_ids = ir_seq.search([('code', '=', 'sale.order')], limit=1)
|
||||||
|
if not s_ids:
|
||||||
|
return False
|
||||||
|
ir_seq_id = ir_seq.browse(s_ids)
|
||||||
|
if ir_seq_id.company_id and ir_seq_id.company_id.id != self.company_id.id:
|
||||||
|
seq_dict['sale.order']['company_id'] = self.company_id.id
|
||||||
|
s_ids = [ir_seq_id.copy()]
|
||||||
|
if not ir_seq_id.company_id:
|
||||||
|
seq_dict['sale.order']['company_id'] = self.company_id.id
|
||||||
if not ir_seq.write(s_ids, seq_dict.get('sale.order')):
|
if not ir_seq.write(s_ids, seq_dict.get('sale.order')):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -275,7 +288,9 @@ class DatenpolFunctions:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Hole Journal für Ausgangsrechnungen
|
# Hole Journal für Ausgangsrechnungen
|
||||||
j_ids = self.odoo.env['account.journal'].search([('code', '=', 'Re.:')])
|
j_ids = self.odoo.env['account.journal'].search([('code', '=', 'Re.:'), ('company_id', '=', self.company_id.id)])
|
||||||
|
if not j_ids:
|
||||||
|
j_ids = self.odoo.env['account.journal'].search([('code', '=', 'Re.:')])
|
||||||
if len(j_ids) != 1:
|
if len(j_ids) != 1:
|
||||||
return False
|
return False
|
||||||
journals = self.odoo.env['account.journal'].read(j_ids,
|
journals = self.odoo.env['account.journal'].read(j_ids,
|
||||||
|
|
@ -727,7 +742,7 @@ class DatenpolFunctions:
|
||||||
self.odoo.env['res.partner'].write([id], vals)
|
self.odoo.env['res.partner'].write([id], vals)
|
||||||
|
|
||||||
def make_anonymous_project(self):
|
def make_anonymous_project(self):
|
||||||
if (self.odoo.env['ir.module.module'].search([('name', '=', 'project'), ('state', '=', 'installed')])):
|
if self.odoo.env['ir.module.module'].search([('name', '=', 'project'), ('state', '=', 'installed')]):
|
||||||
ids = self.odoo.env['project.project'].search([])
|
ids = self.odoo.env['project.project'].search([])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
|
|
@ -744,7 +759,7 @@ class DatenpolFunctions:
|
||||||
self.odoo.env['project.task'].write([id], vals)
|
self.odoo.env['project.task'].write([id], vals)
|
||||||
|
|
||||||
def make_anonymous_employee(self):
|
def make_anonymous_employee(self):
|
||||||
if (self.odoo.env['ir.module.module'].search([('name', '=', 'hr'), ('state', '=', 'installed')])):
|
if self.odoo.env['ir.module.module'].search([('name', '=', 'hr'), ('state', '=', 'installed')]):
|
||||||
ids = self.odoo.env['hr.employee'].search([])
|
ids = self.odoo.env['hr.employee'].search([])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
|
|
@ -754,7 +769,7 @@ class DatenpolFunctions:
|
||||||
self.odoo.env['hr.employee'].write([id], vals)
|
self.odoo.env['hr.employee'].write([id], vals)
|
||||||
|
|
||||||
def make_anonymous_leads(self):
|
def make_anonymous_leads(self):
|
||||||
if (self.odoo.env['ir.module.module'].search([('name', '=', 'crm'), ('state', '=', 'installed')])):
|
if self.odoo.env['ir.module.module'].search([('name', '=', 'crm'), ('state', '=', 'installed')]):
|
||||||
ids = self.odoo.env['crm.lead'].search([])
|
ids = self.odoo.env['crm.lead'].search([])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue