This question has been flagged
1 Reply
5926 Views

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.

Avatar
Discard
Best Answer


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.

 

Avatar
Discard