Fall 4914: Spezifisches Bild von Designbox importieren
							parent
							
								
									149c3f80d2
								
							
						
					
					
						commit
						d90bee85e6
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -199,6 +199,7 @@ class SaleOrder(models.Model): | ||||||
|                     'name': vals['lot_id']['name'], |                     'name': vals['lot_id']['name'], | ||||||
|                     'product_id': vals['product_id'], |                     'product_id': vals['product_id'], | ||||||
|                     'weight': vals['lot_id'].get('weight'), |                     'weight': vals['lot_id'].get('weight'), | ||||||
|  |                     'image': vals['lot_id'].get('image'), | ||||||
|                     'notes': vals['lot_id']['notes'] |                     'notes': vals['lot_id']['notes'] | ||||||
|                 }) |                 }) | ||||||
|                 for lot_attachment_vals in lot_attachment_values: |                 for lot_attachment_vals in lot_attachment_values: | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ | ||||||
| # | # | ||||||
| ############################################################################## | ############################################################################## | ||||||
| 
 | 
 | ||||||
| from odoo import fields, models | from odoo import fields, models, api, tools | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class StockProductionLot(models.Model): | class StockProductionLot(models.Model): | ||||||
|  | @ -27,3 +27,17 @@ class StockProductionLot(models.Model): | ||||||
| 
 | 
 | ||||||
|     notes = fields.Text() |     notes = fields.Text() | ||||||
|     weight = fields.Float(string='Gewicht') |     weight = fields.Float(string='Gewicht') | ||||||
|  |     image = fields.Binary("Produktbild", attachment=True, | ||||||
|  |                           help="Wenn vorhanden, wird dieses Bild in den Angeboten/Aufträgen angedruckt") | ||||||
|  |     image_medium = fields.Binary("Produktbild (resized)", attachment=True, | ||||||
|  |                                  help="Produktbild 'resized' auf 128x128") | ||||||
|  | 
 | ||||||
|  |     @api.model | ||||||
|  |     def create(self, vals): | ||||||
|  |         tools.image_resize_images(vals) | ||||||
|  |         return super(StockProductionLot, self).create(vals) | ||||||
|  | 
 | ||||||
|  |     @api.multi | ||||||
|  |     def write(self, vals): | ||||||
|  |         tools.image_resize_images(vals) | ||||||
|  |         return super(StockProductionLot, self).write(vals) | ||||||
|  |  | ||||||
|  | @ -10,6 +10,9 @@ | ||||||
|                 <field name="weight"/> |                 <field name="weight"/> | ||||||
|                 <field name="notes"/> |                 <field name="notes"/> | ||||||
|             </field> |             </field> | ||||||
|  |             <div class="oe_title" position="before"> | ||||||
|  |                 <field name="image_medium" widget="image" class="oe_avatar"/> | ||||||
|  |             </div> | ||||||
|         </field> |         </field> | ||||||
|     </record> |     </record> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -118,7 +118,9 @@ | ||||||
|                             </tr> |                             </tr> | ||||||
|                             <tr> |                             <tr> | ||||||
|                                 <td colspan="4" style="border: 0;text-align: center;"> |                                 <td colspan="4" style="border: 0;text-align: center;"> | ||||||
|                                     <img t-if="order_line.product_id.image_medium" |                                     <img t-if="order_line.lot_id.image_medium" | ||||||
|  |                                          t-att-src="'data:image/png;base64,%s' % order_line.lot_id.image_medium.decode()"/> | ||||||
|  |                                     <img t-if="not order_line.lot_id.image_medium and order_line.product_id.image_medium" | ||||||
|                                          t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()"/> |                                          t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()"/> | ||||||
|                                 </td> |                                 </td> | ||||||
|                             </tr> |                             </tr> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue