Materialtyp: new flag 'production_relevant'; Product_view: 3 new groupings (type,categ_id,material_type_id)
							parent
							
								
									3084e105fd
								
							
						
					
					
						commit
						8a0d32434e
					
				|  | @ -30,6 +30,7 @@ class MaterialType(models.Model): | |||
|     print_default_code = fields.Boolean(string='Drucke Artikelnummer', required=True, help='Definiert, ob die Artikelnummer gedruckt wird') | ||||
|     print_sales_pic = fields.Boolean(string='Drucke Artikelbild', default=True, required=False, help='Definiert, ob ein Artikelbild gedruckt wird (Angebot/Auftrag)') | ||||
|     print_production_pic = fields.Boolean(string='Drucke Produktionsbild', default=False, required=False, help='Definiert, ob ein Produktionsbild gedruckt wird (Produktionsauftrag)') | ||||
|     production_relevant = fields.Boolean(string='Drucke auf Produktionsschein', default=True, required=False, help='Definiert, ob ein Artikel mit diesem Materiatyp am Produktionsschein angedruckt wird. (Produktionsauftrag)') | ||||
| 
 | ||||
|     _sql_constraints = [ | ||||
|         ('name_uniq', 'unique(name)', 'Die Bezeichnung muss eindeutig sein') | ||||
|  |  | |||
|  | @ -57,6 +57,7 @@ class SaleOrder(models.Model): | |||
|     assembly_notes = fields.Text() | ||||
|     earliest_scheduled_date = fields.Datetime(compute='_compute_earliest_scheduled_date') | ||||
|     positions = fields.Integer(string='Positionen', compute='_compute_positions') | ||||
|     production_positions = fields.Integer(string='Positionen', compute='_compute_positions', store=False) | ||||
|     num_items = fields.Integer(string='Anzahl der Artikel', compute='_compute_num_items') | ||||
|     weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total') | ||||
|     confirmation_nr = fields.Char('Freigabenummer') | ||||
|  | @ -113,7 +114,14 @@ class SaleOrder(models.Model): | |||
|     @api.multi | ||||
|     def _compute_positions(self): | ||||
|         for record in self: | ||||
|             record.positions = len(record.order_line) | ||||
|             p = 0 | ||||
|             pp = 0 | ||||
|             for line in record.order_line: | ||||
|                 p += 1 | ||||
|                 if line.product_id.material_type_id.production_relevant: | ||||
|                     pp += 1 | ||||
|         record.positions = p | ||||
|         record.production_positions = pp | ||||
| 
 | ||||
|     @api.multi | ||||
|     def _compute_num_items(self): | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ | |||
|                     <field name="print_default_code"/> | ||||
|                     <field name="print_sales_pic"/> | ||||
|                     <field name="print_production_pic"/> | ||||
|                     <field name="production_relevant"/> | ||||
|                 </group> | ||||
|             </form> | ||||
|         </field> | ||||
|  | @ -25,6 +26,7 @@ | |||
|                 <field name="print_default_code"/> | ||||
|                 <field name="print_sales_pic"/> | ||||
|                 <field name="print_production_pic"/> | ||||
|                 <field name="production_relevant"/> | ||||
|             </tree> | ||||
|         </field> | ||||
|     </record> | ||||
|  |  | |||
|  | @ -110,4 +110,17 @@ | |||
|               name="X-Kategorien" | ||||
|               action="product_xcategory_action"/> | ||||
| 
 | ||||
|     <record id="product_template_search_view_tz" model="ir.ui.view"> | ||||
|         <field name="name">product.template.search.tz</field> | ||||
|         <field name="model">product.template</field> | ||||
|         <field name="inherit_id" ref="product.product_template_search_view"/> | ||||
|         <field name="arch" type="xml"> | ||||
|             <xpath expr="//field[@name='categ_id']" position="after"> | ||||
|                 <filter string="Produktart" domain="[]" context="{'group_by':'type'}"/> | ||||
|                 <filter string="Interne Kategorie" domain="[]" context="{'group_by':'categ_id'}"/> | ||||
|                 <filter string="Materialtyp" domain="[]" context="{'group_by':'material_type_id'}"/> | ||||
|             </xpath> | ||||
|         </field> | ||||
|     </record> | ||||
| 
 | ||||
| </odoo> | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ | |||
|                     <strong> | ||||
|                         <span class="col-xs-2">Positionen:</span> | ||||
|                     </strong> | ||||
|                     <span class="col-xs-2" t-field="o.positions"/> | ||||
|                     <span class="col-xs-2" t-field="o.production_positions"/> | ||||
|                 </div> | ||||
|                 <div class="row height-20"> | ||||
|                     <div class="col-xs-3" style="padding-right: 4px"> | ||||
|  | @ -100,84 +100,86 @@ | |||
|                     <tbody class="sale-tbody"> | ||||
|                         <t t-set="pos_nr" t-value="0"/> | ||||
|                         <t t-foreach="o.order_line" t-as="order_line"> | ||||
|                             <tr> | ||||
|                                 <t t-set="pos_nr" t-value="pos_nr+1"/> | ||||
|                                 <td class="text-center"> | ||||
|                                     <span t-esc="pos_nr"/> | ||||
|                                 </td> | ||||
|                                 <td class="text-right"/> | ||||
|                                 <td rowspan="2" class="text-left"> | ||||
|                                     <t t-if="order_line.product_id.default_code and order_line.product_id.material_type_id.print_default_code"> | ||||
|                                         <strong> | ||||
|                                             <span t-field="order_line.product_id.default_code"/> | ||||
|                                         </strong> | ||||
|                                         <br/> | ||||
|                                     </t> | ||||
| <!-- | ||||
|                                     <t t-if="order_line.intrastat_id"> | ||||
|                                         <span> | ||||
|                                             <strong>Zolltarif Nr.:</strong> | ||||
|                                             <span t-field="order_line.intrastat_id"/> | ||||
|                                         </span> | ||||
|                                         <br/> | ||||
|                                     </t> | ||||
| --> | ||||
|                                     <span t-field="order_line.name"/> | ||||
| <!-- | ||||
|                                     <t t-if="order_line.delivery_date and (order_line.delivery_date != o.delivery_date)"> | ||||
|                                         <br/> | ||||
|                                         <strong>Voraussichtliches Lieferdatum:</strong> | ||||
|                                         <span t-field="order_line.delivery_date"/> | ||||
|                                     </t> | ||||
|                                     <p t-if="order_line.lot_id"> | ||||
|                                         <span t-esc="order_line.lot_id.name.split('.')[2]"/> | ||||
|                                     </p> | ||||
| --> | ||||
|                                     <p t-if="order_line.lot_id.notes"> | ||||
|                                         <span t-field="order_line.lot_id.notes"/> | ||||
|                                     </p> | ||||
|                                     <p t-if="o.note_line"> | ||||
|                                         <span t-field="o.note_line"/> | ||||
|                                     </p> | ||||
|                                 </td> | ||||
|                                 <td class="text-right"> | ||||
|                                     <t t-if="order_line.product_uom_qty"> | ||||
|                                         <span t-esc="o._formatLang(order_line.product_uom_qty, False).strip('0').strip(',').strip('.')"/> | ||||
|                                     </t> | ||||
|                                 </td> | ||||
|                                 <td class="text-right"> | ||||
|                                     <t t-if="order_line.weight"> | ||||
|                                         <span t-field="order_line.weight"/> | ||||
|                                         kg | ||||
|                                     </t> | ||||
|                                 </td> | ||||
| <!-- | ||||
|                                 <td rowspan="2" class="text-right"> | ||||
|                                     <span t-if="order_line.hide_discount" | ||||
|                                           t-field="order_line.price_reduce"/> | ||||
|                                     <span t-if="not order_line.hide_discount" | ||||
|                                           t-field="order_line.price_unit"/> | ||||
|                                 </td> | ||||
|                             <t t-if="order_line.product_id.material_type_id.production_relevant"> | ||||
|                                 <tr> | ||||
|                                     <t t-set="pos_nr" t-value="pos_nr+1"/> | ||||
|                                     <td class="text-center"> | ||||
|                                         <span t-esc="pos_nr"/> | ||||
|                                     </td> | ||||
|                                     <td class="text-right"/> | ||||
|                                     <td rowspan="2" class="text-left"> | ||||
|                                         <t t-if="order_line.product_id.default_code and order_line.product_id.material_type_id.print_default_code"> | ||||
|                                             <strong> | ||||
|                                                 <span t-field="order_line.product_id.default_code"/> | ||||
|                                             </strong> | ||||
|                                             <br/> | ||||
|                                         </t> | ||||
|     <!-- | ||||
|                                         <t t-if="order_line.intrastat_id"> | ||||
|                                             <span> | ||||
|                                                 <strong>Zolltarif Nr.:</strong> | ||||
|                                                 <span t-field="order_line.intrastat_id"/> | ||||
|                                             </span> | ||||
|                                             <br/> | ||||
|                                         </t> | ||||
|     --> | ||||
|                                         <span t-field="order_line.name"/> | ||||
|     <!-- | ||||
|                                         <t t-if="order_line.delivery_date and (order_line.delivery_date != o.delivery_date)"> | ||||
|                                             <br/> | ||||
|                                             <strong>Voraussichtliches Lieferdatum:</strong> | ||||
|                                             <span t-field="order_line.delivery_date"/> | ||||
|                                         </t> | ||||
|                                         <p t-if="order_line.lot_id"> | ||||
|                                             <span t-esc="order_line.lot_id.name.split('.')[2]"/> | ||||
|                                         </p> | ||||
|     --> | ||||
|                                         <p t-if="order_line.lot_id.notes"> | ||||
|                                             <span t-field="order_line.lot_id.notes"/> | ||||
|                                         </p> | ||||
|                                         <p t-if="o.note_line"> | ||||
|                                             <span t-field="o.note_line"/> | ||||
|                                         </p> | ||||
|                                     </td> | ||||
|                                     <td class="text-right"> | ||||
|                                         <t t-if="order_line.product_uom_qty"> | ||||
|                                             <span t-esc="o._formatLang(order_line.product_uom_qty, False).strip('0').strip(',').strip('.')"/> | ||||
|                                         </t> | ||||
|                                     </td> | ||||
|                                     <td class="text-right"> | ||||
|                                         <t t-if="order_line.weight"> | ||||
|                                             <span t-field="order_line.weight"/> | ||||
|                                             kg | ||||
|                                         </t> | ||||
|                                     </td> | ||||
|     <!-- | ||||
|                                     <td rowspan="2" class="text-right"> | ||||
|                                         <span t-if="order_line.hide_discount" | ||||
|                                               t-field="order_line.price_reduce"/> | ||||
|                                         <span t-if="not order_line.hide_discount" | ||||
|                                               t-field="order_line.price_unit"/> | ||||
|                                     </td> | ||||
| 
 | ||||
|                                 <td rowspan="2" class="text-right" t-if="discount_is_set"> | ||||
|                                     <t t-if="not order_line.hide_discount and order_line.discount"> | ||||
|                                         <span t-esc="o._formatLang(order_line.discount, False).strip('0').strip(',').strip('.')"/> | ||||
|                                         % | ||||
|                                     </t> | ||||
|                                 </td> | ||||
|                                 <td rowspan="2" class="text-right"> | ||||
|                                     <span t-field="order_line.price_subtotal"/> | ||||
|                                 </td> | ||||
| --> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td colspan="2" style="border: 0;text-align: center;"> | ||||
|                                     <img t-if="order_line.lot_id.image_medium and order_line.product_id.material_type_id.print_production_pic" | ||||
|                                          t-att-src="'data:image/png;base64,%s' % order_line.lot_id.image_medium.decode()" style="max-width: 128px;"/> | ||||
|                                     <img t-if="not order_line.lot_id.image_medium and order_line.product_id.image_medium and order_line.product_id.material_type_id.print_production_pic" | ||||
|                                          t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()" style="max-width: 128px;"/> | ||||
|                                 </td> | ||||
|                             </tr> | ||||
|                                     <td rowspan="2" class="text-right" t-if="discount_is_set"> | ||||
|                                         <t t-if="not order_line.hide_discount and order_line.discount"> | ||||
|                                             <span t-esc="o._formatLang(order_line.discount, False).strip('0').strip(',').strip('.')"/> | ||||
|                                             % | ||||
|                                         </t> | ||||
|                                     </td> | ||||
|                                     <td rowspan="2" class="text-right"> | ||||
|                                         <span t-field="order_line.price_subtotal"/> | ||||
|                                     </td> | ||||
|     --> | ||||
|                                 </tr> | ||||
|                                 <tr> | ||||
|                                     <td colspan="2" style="border: 0;text-align: center;"> | ||||
|                                         <img t-if="order_line.lot_id.image_medium and order_line.product_id.material_type_id.print_production_pic" | ||||
|                                              t-att-src="'data:image/png;base64,%s' % order_line.lot_id.image_medium.decode()" style="max-width: 128px;"/> | ||||
|                                         <img t-if="not order_line.lot_id.image_medium and order_line.product_id.image_medium and order_line.product_id.material_type_id.print_production_pic" | ||||
|                                              t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()" style="max-width: 128px;"/> | ||||
|                                     </td> | ||||
|                                 </tr> | ||||
|                             </t> | ||||
|                         </t> | ||||
|                     </tbody> | ||||
|                 </table> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue