Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1894 มุมมอง

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...


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 24
1523
2
พ.ย. 20
4477
Odoo Mail Sending Limit แก้ไขแล้ว
2
ธ.ค. 23
14795
0
ต.ค. 23
33
3
ต.ค. 23
788