콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1915 화면

First, I made changes to a model stock.production.lot

class ProductionLot(models.Model):
   _inherit = "stock.production.lot"
   # We are only overriding the default attribute of the name.
# In the base model, the default was getting the next number/code
# from sequence stock.lot.serial.
# We are adding a new field as well 
   name = fields.Char(default=lambda self: self.determine_serial_name(),)
   vendor_serial = fields.Char(        "Vendor Serial Number",        required=False,        help="Vendor Serial or Lot Number",    )

The above seems to work since when I opened up the screen/form, the name field is populated.

However, there is another "extension" of the same model which overrides the create method to update an attribute based on this field:

    @api.model_create_multi    def create(self, vals_list):
_logger.info(f"CLEY: inside dynamics stock create with {vals_list}")

In the above method, I will see the vendor_serial being set (I type in "testing"):

CLEY: inside dynamics stock create with [{'product_id': 77127, 'vendor_serial': 'testing', 'ref': False, 'use_date': False, 'removal_date': False, 'life_date': False, 'alert_date': False, 'message_attachment_count': 0}]

Can someone suggests what I did wrong and/or if there is a way to fix/correct this?

Thanks...


아바타
취소
관련 게시물 답글 화면 활동
1
2월 24
1538
2
11월 20
4491
2
12월 23
14850
0
10월 23
33
3
10월 23
788