我有两个模块,它们彼此相关但显示错误没有找到参考字段
请告诉我我错过了什么
我的job.card.desc模块如下所示:
class jobCardDesc(models.Model):
_inherit = 'job.card.desc'
project_id = fields.Many2one('mrp.projects', string="Project ID")
和像这样的mrp.projects
class project_mrp(models.Model):
_name = 'mrp.projects'
name = fields.Char(string = "Project Name")
code = fields.Char(string = "Project Code", default = 'New')
jobCardIds = fields.One2many('job.card.desc','project_id',string="Job Card Ids")
答案 0 :(得分:0)
我通过添加
来实现这一目标class ViewController: UIViewController {
@IBOutlet weak var sampleView: UIView!
var animator: UIDynamicAnimator?
override func viewDidLoad() {
super.viewDidLoad()
setupRotationGesture()
}
override func viewDidAppear(animated: Bool) {
animator = UIDynamicAnimator(referenceView: self.view)
let sampleViewBehavior = UIDynamicItemBehavior(items: [self.sampleView])
sampleViewBehavior.allowsRotation = true // view can rotate
animator?.addBehavior(sampleViewBehavior)
let anchoredSuperViewBehavior = UIDynamicItemBehavior(items: [self.view])
anchoredSuperViewBehavior.anchored = true
animator?.addBehavior(anchoredSuperViewBehavior)
// Attachment between the sample view and super view at center anchor point.
let attachment = UIAttachmentBehavior.pinAttachmentWithItem(self.sampleView, attachedToItem: self.view, attachmentAnchor: CGPointMake(self.view.center.x + 1, self.view.center.y + 1))
animator?.addBehavior(attachment)
}
// MARK: - Rotation Gesture -
func setupRotationGesture(){
let rotationGesture = UIRotationGestureRecognizer(target: self, action: #selector(handleRotationGesture(_:)))
self.sampleView.addGestureRecognizer(rotationGesture)
}
func handleRotationGesture(gesture: UIRotationGestureRecognizer){
if gesture.state == .Ended {
let push = UIPushBehavior(items: [self.sampleView], mode: .Instantaneous)
push.magnitude = abs(50.5 * gesture.velocity)
let transform = self.sampleView.transform
push.angle = atan2(transform.b, transform.a);
animator?.addBehavior(push)
}
}
}
直接在'job.card.desc'模块中,而不是在已继承的 job.card.desc 模块中添加 project_id 字段