gutschriftensequence, incoterms,
parent
aa3aaaea9f
commit
ccbb24d84c
|
|
@ -13,7 +13,7 @@ def main():
|
||||||
|
|
||||||
argv = sys.argv[1:]
|
argv = sys.argv[1:]
|
||||||
if not len(argv) == 2:
|
if not len(argv) == 2:
|
||||||
if len(argv) == 3 and argv[1] == 'update': # 'update' requires additional param 'module_name'
|
if len(argv) == 3 and argv[1] in ['update','install']: # 'update' requires additional param 'module_name'
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
_usage()
|
_usage()
|
||||||
|
|
@ -53,6 +53,7 @@ def main():
|
||||||
'base_config',
|
'base_config',
|
||||||
'sale_config',
|
'sale_config',
|
||||||
'stock_config',
|
'stock_config',
|
||||||
|
'set_incoterms',
|
||||||
'purchase_config',
|
'purchase_config',
|
||||||
'set_date_format',
|
'set_date_format',
|
||||||
'set_company',
|
'set_company',
|
||||||
|
|
@ -78,6 +79,13 @@ def main():
|
||||||
'update_module',
|
'update_module',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if cmd == 'install':
|
||||||
|
instance.config.module_name = argv[2]
|
||||||
|
methods = [
|
||||||
|
'login',
|
||||||
|
'install_module',
|
||||||
|
]
|
||||||
|
|
||||||
if cmd == 'update_modules':
|
if cmd == 'update_modules':
|
||||||
methods = [
|
methods = [
|
||||||
'login',
|
'login',
|
||||||
|
|
|
||||||
|
|
@ -82,25 +82,28 @@ class Config():
|
||||||
'group_stock_packaging': False, # Ermöglicht die Auswahl einer Verpackung
|
'group_stock_packaging': False, # Ermöglicht die Auswahl einer Verpackung
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Wenn gesetzt, teilen sich Gutschriften und Rechnungen den selben Nummernkreis
|
||||||
|
self.refund_invoice_sequence = True
|
||||||
|
|
||||||
self.sequences = {
|
self.sequences = {
|
||||||
'sale.order': {
|
'sale.order': {
|
||||||
'number_next_actual': 2000,
|
'number_next_actual': 1,
|
||||||
'prefix': 'A-',
|
'prefix': 'A-',
|
||||||
'padding': 5,
|
'padding': 5,
|
||||||
},
|
},
|
||||||
# 'work.order': {
|
# 'work.order': {
|
||||||
# 'number_next_actual': 100,
|
# 'number_next_actual': 1,
|
||||||
# 'prefix': 'AS-',
|
# 'prefix': 'AS-',
|
||||||
# 'padding': 5,
|
# 'padding': 5,
|
||||||
# },
|
# },
|
||||||
# 'picking.out': {
|
# 'picking.out': {
|
||||||
# 'number_next_actual': 2000,
|
# 'number_next_actual': 1,
|
||||||
# 'prefix': 'L-',
|
# 'prefix': 'L-',
|
||||||
# 'padding': 5,
|
# 'padding': 5,
|
||||||
# },
|
# },
|
||||||
# 'purchase.order': {
|
# 'purchase.order': {
|
||||||
# 'number_next_actual': 2000,
|
# 'number_next_actual': 1,
|
||||||
# 'prefix': 'PO-',
|
# 'prefix': 'B-',
|
||||||
# 'padding': 5,
|
# 'padding': 5,
|
||||||
# },
|
# },
|
||||||
# 'account.invoice': {
|
# 'account.invoice': {
|
||||||
|
|
@ -117,6 +120,13 @@ class Config():
|
||||||
#'product.product_uom_hour': 'h',
|
#'product.product_uom_hour': 'h',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Lieferbedingungen
|
||||||
|
self.incoterms = {
|
||||||
|
('Ab Werk', 'ABW'),
|
||||||
|
('Botendienst', 'BOT'),
|
||||||
|
('Zustellung', 'ZUS'),
|
||||||
|
}
|
||||||
|
|
||||||
# Soll das Ändern einer Rechnung im Nachhinein erlaubt sein?
|
# Soll das Ändern einer Rechnung im Nachhinein erlaubt sein?
|
||||||
self.allow_cancel_invoice = True
|
self.allow_cancel_invoice = True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,35 @@ class CamadeusFunctions():
|
||||||
return self._execute('stock.config.settings', 'execute', [wizard_id])
|
return self._execute('stock.config.settings', 'execute', [wizard_id])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def set_incoterms(self):
|
||||||
|
"""Lieferbedingungen setzen"""
|
||||||
|
|
||||||
|
if hasattr(self.config, 'incoterms'):
|
||||||
|
terms = self.config.incoterms
|
||||||
|
|
||||||
|
|
||||||
|
for name,code in terms:
|
||||||
|
existing_ids = self._execute('stock.incoterms', 'search', ['|',('active','=',True),('active','=',False),('code','=',code)])
|
||||||
|
if existing_ids:
|
||||||
|
vals = {
|
||||||
|
'active': True,
|
||||||
|
'name': name,
|
||||||
|
}
|
||||||
|
self._execute('stock.incoterms', 'write', existing_ids, vals)
|
||||||
|
else:
|
||||||
|
vals = {
|
||||||
|
'name': name,
|
||||||
|
'code': code,
|
||||||
|
}
|
||||||
|
self._execute('stock.incoterms', 'create', vals)
|
||||||
|
|
||||||
|
codes = [code for name,code in terms]
|
||||||
|
inactive_ids = self._execute('stock.incoterms', 'search', [('code','not in',codes)])
|
||||||
|
self._execute('stock.incoterms', 'write', inactive_ids, {'active': False})
|
||||||
|
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def base_config(self):
|
def base_config(self):
|
||||||
"""Allgemeine Konfiguration laden"""
|
"""Allgemeine Konfiguration laden"""
|
||||||
|
|
||||||
|
|
@ -181,7 +210,7 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
# Lieferschein
|
# Lieferschein
|
||||||
if seq_dict.get('picking.out',False):
|
if seq_dict.get('picking.out',False):
|
||||||
picking_type_ids = self._execute('stock.picking.type', 'search', [])
|
picking_type_ids = self._execute('stock.picking.type', 'search', [('code','=','outgoing')])
|
||||||
picking_types = self._execute('stock.picking.type', 'read', picking_type_ids, ['sequence_id'])
|
picking_types = self._execute('stock.picking.type', 'read', picking_type_ids, ['sequence_id'])
|
||||||
s_ids = [t['sequence_id'][0] for t in picking_types]
|
s_ids = [t['sequence_id'][0] for t in picking_types]
|
||||||
if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('picking.out')):
|
if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('picking.out')):
|
||||||
|
|
@ -217,10 +246,26 @@ class CamadeusFunctions():
|
||||||
if len(j_ids) != 1:
|
if len(j_ids) != 1:
|
||||||
return False
|
return False
|
||||||
journals = self._execute('account.journal', 'read', j_ids, ['sequence_id'])
|
journals = self._execute('account.journal', 'read', j_ids, ['sequence_id'])
|
||||||
s_ids = [t['sequence_id'][0] for t in journals]
|
s_id = journals[0]['sequence_id'][0]
|
||||||
if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('account.invoice')):
|
if not self._execute('ir.sequence', 'write', [s_id], seq_dict.get('account.invoice')):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Setzen Gutschriftenkreis
|
||||||
|
if self.config.refund_invoice_sequence:
|
||||||
|
j_ids = self._execute('account.journal', 'search', [('code','=','VK')])
|
||||||
|
if len(j_ids) != 1:
|
||||||
|
return False
|
||||||
|
journals = self._execute('account.journal', 'read', j_ids, ['sequence_id'])
|
||||||
|
s_id = journals[0]['sequence_id'][0]
|
||||||
|
|
||||||
|
gj_ids = self._execute('account.journal', 'search', [('code','=','GSV')])
|
||||||
|
if len(gj_ids) != 1:
|
||||||
|
return False
|
||||||
|
vals = {
|
||||||
|
'sequence_id': s_id,
|
||||||
|
}
|
||||||
|
self._execute('account.journal', 'write', gj_ids,vals)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_admin_rights(self):
|
def set_admin_rights(self):
|
||||||
|
|
@ -364,6 +409,17 @@ class CamadeusFunctions():
|
||||||
res = self._execute('base.module.upgrade', 'upgrade_module', [])
|
res = self._execute('base.module.upgrade', 'upgrade_module', [])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def install_module(self):
|
||||||
|
"""Installiere Modul"""
|
||||||
|
module_name = self.config.module_name
|
||||||
|
mod_ids = self._execute('ir.module.module', 'search', [('name','=',module_name),('state','=','uninstalled')])
|
||||||
|
if not len(mod_ids) == 1:
|
||||||
|
raise "Module '%s' not found or is not in state 'uninstalled'." % module_name
|
||||||
|
|
||||||
|
res = self._execute('ir.module.module', 'button_install', mod_ids)
|
||||||
|
res = self._execute('base.module.upgrade', 'upgrade_module', [])
|
||||||
|
return True
|
||||||
|
|
||||||
def update_modules(self):
|
def update_modules(self):
|
||||||
"""Verfügbare Module updaten"""
|
"""Verfügbare Module updaten"""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue