Fall 4434: Sammelrechnung

develop
Ahmed Aly 2017-12-11 10:56:09 +01:00
parent 3f644e084e
commit db656cbaa2
9 changed files with 87 additions and 67 deletions

View File

@ -35,7 +35,6 @@
'views/res_partner_views.xml', 'views/res_partner_views.xml',
'views/sale_views.xml', 'views/sale_views.xml',
'views/account_views.xml', 'views/account_views.xml',
'security/ir.model.access.csv',
], ],
'installable': True, 'installable': True,
'auto_install': False, 'auto_install': False,

View File

@ -20,5 +20,4 @@
############################################################################## ##############################################################################
from . import sale from . import sale
from . import account
from . import res_partner from . import res_partner

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# datenpol gmbh
# Copyright (C) 2013-TODAY datenpol gmbh (<http://www.datenpol.at/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import models
class AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'

View File

@ -34,6 +34,6 @@ class Partner(models.Model):
for record in self: for record in self:
if record.commercial_partner_id.retail_partner_id: if record.commercial_partner_id.retail_partner_id:
pass res.update({'invoice': record.commercial_partner_id.retail_partner_id.id})
return res return res

View File

@ -26,7 +26,20 @@ class SaleLayoutCategory(models.Model):
order_id = fields.Many2one(comodel_name='sale.order') order_id = fields.Many2one(comodel_name='sale.order')
@api.model
def name_search(self, name, args=None, operator='ilike', limit=100): class SaleOrderLine(models.Model):
res = super(SaleLayoutCategory, self).name_search(name, args=args, operator=operator, limit=limit) _inherit = 'sale.order.line'
layout_category_id = fields.Many2one(domain=[('order_id', '=', False)])
@api.multi
def _prepare_invoice_line(self, qty):
res = super(SaleOrderLine, self)._prepare_invoice_line(qty)
layout_category_id = self.env['sale.layout_category'].search([('order_id', '=', self.order_id.id)])
if not layout_category_id:
layout_category_id = self.env['sale.layout_category'].create({
'order_id': self.order_id.id,
'name': self.order_id.name
})
res.update({'layout_category_id': layout_category_id.id})
return res return res

View File

@ -1 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink

View File

@ -1,7 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="account_invoice_form_view" model="ir.ui.view">
<field name="name">account_invoice_form_view</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree//field[@name='layout_category_id']"
position="attributes">
<attribute name="options">{'no_create': True}</attribute>
</xpath>
</field>
</record>
</odoo> </odoo>

View File

@ -1,6 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="sale_layout_category_form_view" model="ir.ui.view">
<field name="name">sale_layout_category_form_view</field>
<field name="model">sale.layout_category</field>
<field name="inherit_id" ref="sale.report_configuration_form_view"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="order_id"/>
</field>
</field>
</record>
<record id="sale_order_form_view" model="ir.ui.view">
<field name="name">sale_order_form_view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/form//field[@name='layout_category_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree//field[@name='layout_category_id']" position="attributes">
<attribute name="options">{'no_create': True}</attribute>
</xpath>
</field>
</record>
</odoo> </odoo>

View File

@ -1,15 +1,16 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
class Config():
class Config(object):
def __init__(self): def __init__(self):
self.dump_file = 'odoo_backup.dump' self.dump_file = 'odoo_backup.dump'
self.module_name = None self.module_name = None
self.lang = 'de_DE' # de_DE, en_US self.lang = 'de_DE' # de_DE, en_US
self.default_sales_tax = 'Mehrwertsteuer 20%' self.default_sales_tax = 'Mehrwertsteuer 20%'
self.default_supplier_tax = 'Vorsteuer 20%' self.default_supplier_tax = 'Vorsteuer 20%'
self.price_decimals = 2 # Nachkommastellen Preis self.price_decimals = 2 # Nachkommastellen Preis
self.uom_decimals = 3 # Nachkommastellen Mengeneinheiten self.uom_decimals = 3 # Nachkommastellen Mengeneinheiten
self.load_languages = ['en_US'] self.load_languages = ['en_US']
@ -31,9 +32,9 @@ class Config():
# Aktive Steuerzuordnungen # Aktive Steuerzuordnungen
self.valid_fiscal_positions = [ self.valid_fiscal_positions = [
#'Lieferant EU (ohne Ust-ID)', # 'Lieferant EU (ohne Ust-ID)',
#'Lieferant EU Unternehmen (mit USt-ID)', # 'Lieferant EU Unternehmen (mit USt-ID)',
#'Lieferant Ausland', # 'Lieferant Ausland',
'Kunde Ausland', 'Kunde Ausland',
'Kunde EU (ohne USt-ID)', 'Kunde EU (ohne USt-ID)',
'Kunde EU Unternehmen (mit USt-ID)', 'Kunde EU Unternehmen (mit USt-ID)',
@ -45,39 +46,39 @@ class Config():
'group_multi_company': True, 'group_multi_company': True,
# Einstellungen Verkauf # Einstellungen Verkauf
'group_product_variant': False, # Produkte können mehrere Attribute haben, die Varianten definieren 'group_product_variant': False, # Produkte können mehrere Attribute haben, die Varianten definieren
'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': 'percentage', '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,
'use_sale_note': True, 'use_sale_note': True,
'group_sale_layout': False, 'group_sale_layout': True,
'group_proforma_sales': True, 'group_proforma_sales': True,
'group_sale_delivery_address': True, # Verschiedene Adressen für Rechnung und Lieferung 'group_sale_delivery_address': True, # Verschiedene Adressen für Rechnung und Lieferung
'group_warning_sale': False, 'group_warning_sale': False,
'auto_done_setting': False, 'auto_done_setting': False,
'module_delivery': True, # Für Intrastat benötigt 'module_delivery': True, # Für Intrastat benötigt
'group_display_incoterm': True, 'group_display_incoterm': True,
'module_sale_order_dates': False, 'module_sale_order_dates': False,
'group_route_so_lines': False, 'group_route_so_lines': False,
# Einstellungen Lager # Einstellungen Lager
'group_warning_stock': False, 'group_warning_stock': False,
'group_stock_production_lot': True, # Verfolgen Sie Los- und Seriennummern 'group_stock_production_lot': True, # Verfolgen Sie Los- und Seriennummern
'default_picking_policy': 'direct', 'default_picking_policy': 'direct',
'group_stock_multi_locations': False, 'group_stock_multi_locations': False,
'group_stock_multi_warehouses': False, 'group_stock_multi_warehouses': False,
'group_stock_adv_location': False, # Advanced routing of products using rules 'group_stock_adv_location': False, # Advanced routing of products using rules
'use_security_lead': False, 'use_security_lead': False,
'security_lead': 0, 'security_lead': 0,
# Einstellungen Finanzen # Einstellungen Finanzen
'tax_calculation_rounding_method': 'round_per_line', 'tax_calculation_rounding_method': 'round_per_line',
'vat_check_vies': True, 'vat_check_vies': True,
'group_multi_currency': True, # Multiwährungsfunktion aktivieren 'group_multi_currency': True, # Multiwährungsfunktion aktivieren
'module_account_reports_followup': False, 'module_account_reports_followup': False,
'group_warning_account': False, 'group_warning_account': False,
@ -88,8 +89,8 @@ class Config():
'manufacturing_lead': 0, 'manufacturing_lead': 0,
} }
self.removal_strategy = 'fifo' #[fifo], [lifo], [fefo] self.removal_strategy = 'fifo' # [fifo], [lifo], [fefo]
self.stock_cost_method = 'standard' # [standard], [average], [real] self.stock_cost_method = 'standard' # [standard], [average], [real]
self.active_uoms = { self.active_uoms = {
'product.product_uom_unit': 'Stk.', 'product.product_uom_unit': 'Stk.',
@ -137,7 +138,7 @@ class Config():
] ]
# Setze das Feld "Attachment" im Report (wenn gesetzt wird das PDF in den Anhängen gespeichert) # Setze das Feld "Attachment" im Report (wenn gesetzt wird das PDF in den Anhängen gespeichert)
timestamp = " + '_' + time.strftime('%Y-%m-%d-%H%M') + '.pdf')" timestamp = " + '_' + time.strftime('%Y-%m-%d-%H%M') + '.pdf')"
self.reports = { self.reports = {
'sale.action_report_saleorder': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp, 'sale.action_report_saleorder': "((object.state in ('draft','sent') and 'KV_' or 'AB_') + object.name" + timestamp,
@ -147,27 +148,27 @@ class Config():
self.users_file = 'res.users.csv' self.users_file = 'res.users.csv'
self.translation_files = [ # Reihenfolge! self.translation_files = [ # Reihenfolge!
#'auto_translated2.po', # 'auto_translated2.po',
'ir.translation.csv', 'ir.translation.csv',
#'auto_translated.po', # 'auto_translated.po',
#'auto_translated3.po', # 'auto_translated3.po',
] ]
self.default_values = [ # ir.values self.default_values = [ # ir.values
# ('product.template', 'type', 'product'), # ('product.template', 'type', 'product'),
#('product.template', 'type', 'service'), # ('product.template', 'type', 'service'),
] ]
self.order_policy = 'order' self.order_policy = 'order'
self.data_updates = { self.data_updates = {
#'mrp.route_warehouse0_manufacture': {'name': 'Produzieren'}, # 'mrp.route_warehouse0_manufacture': {'name': 'Produzieren'},
#'purchase.route_warehouse0_buy': {'name': 'Einkaufen'}, # 'purchase.route_warehouse0_buy': {'name': 'Einkaufen'},
#'stock.route_warehouse0_mto': {'name': 'Beschaffe von Auftrag'}, # 'stock.route_warehouse0_mto': {'name': 'Beschaffe von Auftrag'},
} }
self.system_parameters = { self.system_parameters = {
'ir_attachment.location': 'file', # [db] oder [file] 'ir_attachment.location': 'file', # [db] oder [file]
'database.expiration_date': '2038-01-19', 'database.expiration_date': '2038-01-19',
} }