gutschriftensequence, incoterms,
parent
aa3aaaea9f
commit
ccbb24d84c
|
|
@ -13,7 +13,7 @@ def main():
|
|||
|
||||
argv = sys.argv[1:]
|
||||
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
|
||||
else:
|
||||
_usage()
|
||||
|
|
@ -53,6 +53,7 @@ def main():
|
|||
'base_config',
|
||||
'sale_config',
|
||||
'stock_config',
|
||||
'set_incoterms',
|
||||
'purchase_config',
|
||||
'set_date_format',
|
||||
'set_company',
|
||||
|
|
@ -78,6 +79,13 @@ def main():
|
|||
'update_module',
|
||||
]
|
||||
|
||||
if cmd == 'install':
|
||||
instance.config.module_name = argv[2]
|
||||
methods = [
|
||||
'login',
|
||||
'install_module',
|
||||
]
|
||||
|
||||
if cmd == 'update_modules':
|
||||
methods = [
|
||||
'login',
|
||||
|
|
|
|||
|
|
@ -81,26 +81,29 @@ class Config():
|
|||
'group_stock_tracking_lot': False, # Benutze Verpackungen: Paletten, Boxen, ...
|
||||
'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 = {
|
||||
'sale.order': {
|
||||
'number_next_actual': 2000,
|
||||
'number_next_actual': 1,
|
||||
'prefix': 'A-',
|
||||
'padding': 5,
|
||||
},
|
||||
# 'work.order': {
|
||||
# 'number_next_actual': 100,
|
||||
# 'number_next_actual': 1,
|
||||
# 'prefix': 'AS-',
|
||||
# 'padding': 5,
|
||||
# },
|
||||
# 'picking.out': {
|
||||
# 'number_next_actual': 2000,
|
||||
# 'number_next_actual': 1,
|
||||
# 'prefix': 'L-',
|
||||
# 'padding': 5,
|
||||
# },
|
||||
# 'purchase.order': {
|
||||
# 'number_next_actual': 2000,
|
||||
# 'prefix': 'PO-',
|
||||
# 'number_next_actual': 1,
|
||||
# 'prefix': 'B-',
|
||||
# 'padding': 5,
|
||||
# },
|
||||
# 'account.invoice': {
|
||||
|
|
@ -116,6 +119,13 @@ class Config():
|
|||
#'product.product_uom_litre': 'l',
|
||||
#'product.product_uom_hour': 'h',
|
||||
}
|
||||
|
||||
#Lieferbedingungen
|
||||
self.incoterms = {
|
||||
('Ab Werk', 'ABW'),
|
||||
('Botendienst', 'BOT'),
|
||||
('Zustellung', 'ZUS'),
|
||||
}
|
||||
|
||||
# Soll das Ändern einer Rechnung im Nachhinein erlaubt sein?
|
||||
self.allow_cancel_invoice = True
|
||||
|
|
|
|||
|
|
@ -149,6 +149,35 @@ class CamadeusFunctions():
|
|||
wizard_id = self._execute('stock.config.settings', 'create', vals)
|
||||
return self._execute('stock.config.settings', 'execute', [wizard_id])
|
||||
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):
|
||||
"""Allgemeine Konfiguration laden"""
|
||||
|
|
@ -181,7 +210,7 @@ class CamadeusFunctions():
|
|||
|
||||
# Lieferschein
|
||||
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'])
|
||||
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')):
|
||||
|
|
@ -217,10 +246,26 @@ class CamadeusFunctions():
|
|||
if len(j_ids) != 1:
|
||||
return False
|
||||
journals = self._execute('account.journal', 'read', j_ids, ['sequence_id'])
|
||||
s_ids = [t['sequence_id'][0] for t in journals]
|
||||
if not self._execute('ir.sequence', 'write', s_ids, seq_dict.get('account.invoice')):
|
||||
s_id = journals[0]['sequence_id'][0]
|
||||
if not self._execute('ir.sequence', 'write', [s_id], seq_dict.get('account.invoice')):
|
||||
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
|
||||
|
||||
def set_admin_rights(self):
|
||||
|
|
@ -364,6 +409,17 @@ class CamadeusFunctions():
|
|||
res = self._execute('base.module.upgrade', 'upgrade_module', [])
|
||||
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):
|
||||
"""Verfügbare Module updaten"""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue