Fall 4422: Angebotslegung
							parent
							
								
									5ab62cd904
								
							
						
					
					
						commit
						644619d3c4
					
				|  | @ -45,6 +45,7 @@ | ||||||
|         'views/sale_views.xml', |         'views/sale_views.xml', | ||||||
|         'views/material_type_views.xml', |         'views/material_type_views.xml', | ||||||
|         'views/product_views.xml', |         'views/product_views.xml', | ||||||
|  |         'views/ir_attachment_views.xml', | ||||||
|         'security/ir.model.access.csv', |         'security/ir.model.access.csv', | ||||||
|     ], |     ], | ||||||
|     'installable': True, |     'installable': True, | ||||||
|  |  | ||||||
|  | @ -28,3 +28,4 @@ from . import stock | ||||||
| from . import sale | from . import sale | ||||||
| from . import material_type | from . import material_type | ||||||
| from . import product | from . import product | ||||||
|  | from . import ir_attachment | ||||||
|  |  | ||||||
|  | @ -0,0 +1,46 @@ | ||||||
|  | # -*- 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, fields, api, _ | ||||||
|  | from odoo.exceptions import ValidationError | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Attachment(models.Model): | ||||||
|  |     _inherit = 'ir.attachment' | ||||||
|  | 
 | ||||||
|  |     from_designbox = fields.Boolean(string='Import von Designbox', readonly=True) | ||||||
|  | 
 | ||||||
|  |     @api.multi | ||||||
|  |     def write(self, vals): | ||||||
|  |         for record in self: | ||||||
|  |             if record.from_designbox: | ||||||
|  |                 raise ValidationError( | ||||||
|  |                     _("Dokumente, die aus der Designbox importiert wurden, können nicht gelöscht werden.")) | ||||||
|  | 
 | ||||||
|  |         return super(Attachment, self).write(vals) | ||||||
|  | 
 | ||||||
|  |     @api.multi | ||||||
|  |     def unlink(self): | ||||||
|  |         for record in self: | ||||||
|  |             if record.from_designbox: | ||||||
|  |                 raise ValidationError( | ||||||
|  |                     _("Dokumente, die aus der Designbox importiert wurden, können nicht gelöscht werden.")) | ||||||
|  | 
 | ||||||
|  |         return super(Attachment, self).unlink() | ||||||
|  | @ -36,9 +36,9 @@ class PartnerEventListener(Component): | ||||||
|         if record.active and record.portal_id: |         if record.active and record.portal_id: | ||||||
|             if 'property_product_pricelist' in fields: |             if 'property_product_pricelist' in fields: | ||||||
|                 for contact in record.child_ids: |                 for contact in record.child_ids: | ||||||
|                     self.env['product.pricelist.item'].with_delay().job_export_portal_price(contact) |                     self.env['res.partner'].with_delay().job_export_portal_price(contact) | ||||||
|             if 'parent_id' in fields: |             if 'parent_id' in fields: | ||||||
|                 self.env['product.pricelist.item'].with_delay().job_export_portal_price(record) |                 self.env['res.partner'].with_delay().job_export_portal_price(record) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Partner(models.Model): | class Partner(models.Model): | ||||||
|  |  | ||||||
|  | @ -106,7 +106,7 @@ class SaleOrder(models.Model): | ||||||
|         order_id = self.create(vals) |         order_id = self.create(vals) | ||||||
|         if attachment_vals: |         if attachment_vals: | ||||||
|             order_id.pg_create_sale_order_attachments(attachment_vals) |             order_id.pg_create_sale_order_attachments(attachment_vals) | ||||||
|         if attachment_vals: |         if order_line_vals: | ||||||
|             order_id.pg_create_order_lines(order_line_vals) |             order_id.pg_create_order_lines(order_line_vals) | ||||||
|         return {'id': order_id.id, 'name': order_id.name} |         return {'id': order_id.id, 'name': order_id.name} | ||||||
| 
 | 
 | ||||||
|  | @ -144,7 +144,8 @@ class SaleOrder(models.Model): | ||||||
|                 'product_id': vals['product_id'], |                 'product_id': vals['product_id'], | ||||||
|                 'price_unit': vals['price_unit'], |                 'price_unit': vals['price_unit'], | ||||||
|                 'product_uom_qty': vals['product_uom_qty'], |                 'product_uom_qty': vals['product_uom_qty'], | ||||||
|                 'lot_id': lot_id |                 'lot_id': lot_id, | ||||||
|  |                 'from_designbox': True, | ||||||
|             })) |             })) | ||||||
|         return order_lines |         return order_lines | ||||||
| 
 | 
 | ||||||
|  | @ -153,6 +154,7 @@ class SaleOrder(models.Model): | ||||||
|         attachment_vals = { |         attachment_vals = { | ||||||
|             'name': vals['filename'], |             'name': vals['filename'], | ||||||
|             'datas': vals['binary'], |             'datas': vals['binary'], | ||||||
|  |             'from_designbox': True, | ||||||
|             'datas_fname': vals['filename'], |             'datas_fname': vals['filename'], | ||||||
|             'res_model': record._name, |             'res_model': record._name, | ||||||
|             'res_id': record.id, |             'res_id': record.id, | ||||||
|  | @ -180,6 +182,7 @@ class SaleOrderLine(models.Model): | ||||||
|     _inherit = 'sale.order.line' |     _inherit = 'sale.order.line' | ||||||
| 
 | 
 | ||||||
|     lot_id = fields.Many2one(comodel_name='stock.production.lot', string='Lot') |     lot_id = fields.Many2one(comodel_name='stock.production.lot', string='Lot') | ||||||
|  |     from_designbox = fields.Boolean(string='Import von Designbox', readonly=True) | ||||||
| 
 | 
 | ||||||
|     @api.model |     @api.model | ||||||
|     def correct_values(self, vals): |     def correct_values(self, vals): | ||||||
|  |  | ||||||
|  | @ -0,0 +1,13 @@ | ||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <odoo> | ||||||
|  |     <record id="ir_attachment_form_view" model="ir.ui.view"> | ||||||
|  |         <field name="name">ir_attachment_form_view</field> | ||||||
|  |         <field name="model">ir.attachment</field> | ||||||
|  |         <field name="inherit_id" ref="base.view_attachment_form"/> | ||||||
|  |         <field name="arch" type="xml"> | ||||||
|  |             <field name="mimetype" position="after"> | ||||||
|  |                 <field name="from_designbox"/> | ||||||
|  |             </field> | ||||||
|  |         </field> | ||||||
|  |     </record> | ||||||
|  | </odoo> | ||||||
|  | @ -19,12 +19,15 @@ | ||||||
|             </field> |             </field> | ||||||
|             <xpath expr="//field[@name='order_line']/form//field[@name='product_id']" position="after"> |             <xpath expr="//field[@name='order_line']/form//field[@name='product_id']" position="after"> | ||||||
|                 <field name="lot_id"/> |                 <field name="lot_id"/> | ||||||
|  |                 <field name="from_designbox"/> | ||||||
|             </xpath> |             </xpath> | ||||||
|             <xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after"> |             <xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after"> | ||||||
|                 <field name="lot_id"/> |                 <field name="lot_id"/> | ||||||
|  |                 <field name="from_designbox"/> | ||||||
|             </xpath> |             </xpath> | ||||||
|             <xpath expr="//field[@name='order_line']/kanban//field[@name='product_id']" position="after"> |             <xpath expr="//field[@name='order_line']/kanban//field[@name='product_id']" position="after"> | ||||||
|                 <field name="lot_id"/> |                 <field name="lot_id"/> | ||||||
|  |                 <field name="from_designbox"/> | ||||||
|             </xpath> |             </xpath> | ||||||
|         </field> |         </field> | ||||||
|     </record> |     </record> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue