Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
6918 Vizualizări

Below method is existing in
Query 1:
**stock.move**
       

        @api.multi   

      def action_assign(self, no_prepare=False):
            for move in moves:
            if move.product_id.type == 'consu'               

                moves_to_assign |= move         

                continue      

           else:
                moves_to_do |= move

I just want to add one line changes (i.e)


         @api.multi   

def action_assign(self, no_prepare=False):
         for move in moves:
            if move.product_id.type == 'consu' or move.product_id.type == 'service':
                moves_to_assign |= move                continue            else:
                moves_to_do |= move

  I just want to customize only this line
      **if move.product_id.type == 'consu' or move.product_id.type == 'service':**


and also **Query 2:** **'mrp.production'**

in this method
    def _generate_raw_move(self, bom_line, line_data):


I just want to remove the below line      

    if bom_line.product_id.type not in ['product', 'consu']:
            return self.env['stock.move']


How to do write this methods in Custom module in Odoo 10.

Imagine profil
Abandonează
Cel mai bun răspuns


Hi Silviaa,


Following are to override a method

from odoo import models, fields

class YourModelName(models.Model):
     _inherit = 'your.model'

   def your_function(self, data):
        res = super(YourModelName, self).your_function(data)  
        # ....your additional lines....
   return res

    # Or copy the whole method and paste here. You can edit.

 

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
feb. 25
25356
0
iun. 18
2834
1
dec. 17
2955
0
mai 25
165
2
apr. 25
2419