dp_script: pricelisten können jetzt richtig gesetzt werden
parent
644619d3c4
commit
3499d5aa29
|
|
@ -49,7 +49,7 @@ class Config():
|
||||||
'group_uom': True, # Verwende Mengeneinheiten
|
'group_uom': True, # Verwende Mengeneinheiten
|
||||||
'group_discount_per_so_line': True, # Rabatt auf Verkaufszeilen
|
'group_discount_per_so_line': True, # Rabatt auf Verkaufszeilen
|
||||||
'multi_sales_price': True, # Mehrere Verkaufspreise pro Produkt
|
'multi_sales_price': True, # Mehrere Verkaufspreise pro Produkt
|
||||||
'multi_sales_price_method': 'formula',
|
'multi_sales_price_method': 'percentage',
|
||||||
# [percentage] Multiple prices per product (e.g. customer segments, currencies)
|
# [percentage] Multiple prices per product (e.g. customer segments, currencies)
|
||||||
# [formula] rices computed from formulas (discounts, margins, roundings)
|
# [formula] rices computed from formulas (discounts, margins, roundings)
|
||||||
'module_sale_margin': False,
|
'module_sale_margin': False,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import odoorpc
|
||||||
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
|
||||||
class DatenpolFunctions:
|
class DatenpolFunctions:
|
||||||
def __init__(self, environment, config):
|
def __init__(self, environment, config):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
@ -40,8 +41,10 @@ class DatenpolFunctions:
|
||||||
with open(self.config.dump_file, 'rb') as dump_file:
|
with open(self.config.dump_file, 'rb') as dump_file:
|
||||||
self.odoo.db.restore(self.env.super_admin_pw, self.env.dbname, dump_file, True)
|
self.odoo.db.restore(self.env.super_admin_pw, self.env.dbname, dump_file, True)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise Exception("Wiederherstellen der Datenbank fehlgeschlagen. Eventuell wurde './dp [env] dump' nicht ausgeführt.")
|
raise Exception(
|
||||||
print("\nACHTUNG: Nicht vergessen './dp [env] anonym' auszuführen, sodass es zu keiner Kommunikation mit dem Produktivsystem kommt")
|
"Wiederherstellen der Datenbank fehlgeschlagen. Eventuell wurde './dp [env] dump' nicht ausgeführt.")
|
||||||
|
print(
|
||||||
|
"\nACHTUNG: Nicht vergessen './dp [env] anonym' auszuführen, sodass es zu keiner Kommunikation mit dem Produktivsystem kommt")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def drop_db(self):
|
def drop_db(self):
|
||||||
|
|
@ -62,6 +65,24 @@ class DatenpolFunctions:
|
||||||
|
|
||||||
res_settings = self.odoo.env['res.config.settings']
|
res_settings = self.odoo.env['res.config.settings']
|
||||||
vals = res_settings.default_get([])
|
vals = res_settings.default_get([])
|
||||||
|
if self.config.settings.get('multi_sales_price', False):
|
||||||
|
if self.config.settings.get('multi_sales_price_method', False) and self.config.settings.get(
|
||||||
|
'multi_sales_price_method', False) == 'percentage':
|
||||||
|
self.config.settings.update({
|
||||||
|
"group_sale_pricelist": True,
|
||||||
|
"group_product_pricelist": False,
|
||||||
|
"group_pricelist_item": True,
|
||||||
|
"sale_pricelist_setting": "formula",
|
||||||
|
})
|
||||||
|
if self.config.settings.get('multi_sales_price_method', False) and self.config.settings.get(
|
||||||
|
'multi_sales_price_method', False) == 'formula':
|
||||||
|
self.config.settings.update({
|
||||||
|
"group_sale_pricelist": True,
|
||||||
|
"group_product_pricelist": True,
|
||||||
|
"group_pricelist_item": False,
|
||||||
|
"sale_pricelist_setting": "percentage",
|
||||||
|
})
|
||||||
|
|
||||||
vals.update(self.config.settings)
|
vals.update(self.config.settings)
|
||||||
wizard_id = res_settings.create(vals)
|
wizard_id = res_settings.create(vals)
|
||||||
return res_settings.execute(wizard_id)
|
return res_settings.execute(wizard_id)
|
||||||
|
|
@ -156,7 +177,8 @@ class DatenpolFunctions:
|
||||||
# Standard Purchase Tax
|
# Standard Purchase Tax
|
||||||
supplier_tax_ids = self.odoo.env['account.tax'].search(
|
supplier_tax_ids = self.odoo.env['account.tax'].search(
|
||||||
[('name', '=', c.default_supplier_tax)])
|
[('name', '=', c.default_supplier_tax)])
|
||||||
self.odoo.env['ir.default'].set('product.template', 'supplier_taxes_id', supplier_tax_ids, company_id=self.company_id.id)
|
self.odoo.env['ir.default'].set('product.template', 'supplier_taxes_id', supplier_tax_ids,
|
||||||
|
company_id=self.company_id.id)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_incoterms(self):
|
def set_incoterms(self):
|
||||||
|
|
@ -192,7 +214,8 @@ class DatenpolFunctions:
|
||||||
"""Module installieren"""
|
"""Module installieren"""
|
||||||
|
|
||||||
module_to_install = [module] if module else self.config.modules
|
module_to_install = [module] if module else self.config.modules
|
||||||
mod_ids = self.odoo.env['ir.module.module'].search([('name', 'in', module_to_install), ('state', '!=', 'installed')])
|
mod_ids = self.odoo.env['ir.module.module'].search(
|
||||||
|
[('name', 'in', module_to_install), ('state', '!=', 'installed')])
|
||||||
if not len(mod_ids) == 1 and raise_exception:
|
if not len(mod_ids) == 1 and raise_exception:
|
||||||
raise Exception('Module %s not found or is not in state "uninstalled".' % module_to_install)
|
raise Exception('Module %s not found or is not in state "uninstalled".' % module_to_install)
|
||||||
self.odoo.env['ir.module.module'].button_immediate_install(mod_ids)
|
self.odoo.env['ir.module.module'].button_immediate_install(mod_ids)
|
||||||
|
|
@ -255,7 +278,8 @@ class DatenpolFunctions:
|
||||||
j_ids = self.odoo.env['account.journal'].search([('code', '=', 'Re.:')])
|
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, ['refund_sequence', 'sequence_id', 'refund_sequence_id'])
|
journals = self.odoo.env['account.journal'].read(j_ids,
|
||||||
|
['refund_sequence', 'sequence_id', 'refund_sequence_id'])
|
||||||
|
|
||||||
# Rechnungsnummer
|
# Rechnungsnummer
|
||||||
if seq_dict.get('account.invoice', False):
|
if seq_dict.get('account.invoice', False):
|
||||||
|
|
@ -583,7 +607,8 @@ class DatenpolFunctions:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
product_category_ids = self.odoo.env['product.category'].search([])
|
product_category_ids = self.odoo.env['product.category'].search([])
|
||||||
return self.odoo.env['product.category'].write(product_category_ids, {'removal_strategy_id': strategy_ids[0]})
|
return self.odoo.env['product.category'].write(product_category_ids,
|
||||||
|
{'removal_strategy_id': strategy_ids[0]})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_default_values(self):
|
def set_default_values(self):
|
||||||
|
|
@ -825,4 +850,3 @@ class DatenpolFunctions:
|
||||||
if res_ids:
|
if res_ids:
|
||||||
return self.odoo.env['ir.translation'].unlink(res_ids)
|
return self.odoo.env['ir.translation'].unlink(res_ids)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue